gdb/darwin-nat.c: Fix template argument for scoped_restore_tmpl
authorWataru Ashihara <wataash@wataash.com>
Sun, 8 Dec 2019 08:00:43 +0000 (17:00 +0900)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 9 Dec 2019 13:02:00 +0000 (08:02 -0500)
This should be the type of startup_with_shell, whose type was changed
from int to bool at commit 80fd28264.

This fixes the build on macOS:

      CXX    darwin-nat.o
    In file included from ../../gdb/darwin-nat.c:22:
    In file included from ../../gdb/top.h:25:
    In file included from ../../gdb/value.h:23:
    In file included from ../../gdb/frame.h:72:
    In file included from ../../gdb/language.h:26:
    In file included from ../../gdb/symtab.h:33:
    ../../gdb/gdbsupport/gdb_optional.h:155:19: error: no matching constructor for initialization of 'scoped_restore_tmpl<int>'
        new (&m_item) T (std::forward<Args>(args)...);
                      ^  ~~~~~~~~~~~~~~~~~~~~~~~~
    ../../gdb/darwin-nat.c:1995:31: note: in instantiation of function template specialization 'gdb::optional<scoped_restore_tmpl<int> >::emplace<bool *, int>' requested here
              restore_startup_with_shell.emplace (&startup_with_shell, 0);
                                         ^
    ../../gdb/gdbsupport/scoped_restore.h:69:3: note: candidate constructor template not viable: no known conversion from 'bool *' to 'int *' for 1st argument
      scoped_restore_tmpl (T *var, T2 value)
      ^
    ../../gdb/gdbsupport/scoped_restore.h:57:3: note: candidate constructor not viable: requires single argument 'var', but 2 arguments were provided
      scoped_restore_tmpl (T *var)
      ^
    ../../gdb/gdbsupport/scoped_restore.h:76:3: note: candidate constructor not viable: requires single argument 'other', but 2 arguments were provided
      scoped_restore_tmpl (const scoped_restore_tmpl<T> &other)
      ^
    1 error generated.

gdb/ChangeLog
2019-12-08  Wataru Ashihara  <wataash@wataash.com>

* darwin-nat.c (darwin_nat_target::create_inferior): Fix
template argument for scoped_restore_tmpl from bool to int.

Change-Id: Ia0202efd34dbce69b6af5d035fa55ed89215138a

gdb/ChangeLog
gdb/darwin-nat.c

index ee45156e391bcc0dd152f009b0ce8f7d20655f21..9709d0de33551fcb089229afb48ca853a84207e7 100644 (file)
@@ -1,3 +1,8 @@
+2019-12-08  Wataru Ashihara  <wataash@wataash.com>
+
+       * darwin-nat.c (darwin_nat_target::create_inferior): Fix
+       template argument for scoped_restore_tmpl from bool to int.
+
 2019-12-07  Keith Seitz  <keiths@redhat.com>
 
        * build-id.c (build_id_bfd_get): Permit bfd_core, too.
index 123d2c0b698e06891615767d729b78cfb8d339bf..ecc7fc07f69a8a4ccc80cfa1a7db01c2b2a26e36 100644 (file)
@@ -1985,7 +1985,7 @@ darwin_nat_target::create_inferior (const char *exec_file,
                                    const std::string &allargs,
                                    char **env, int from_tty)
 {
-  gdb::optional<scoped_restore_tmpl<int>> restore_startup_with_shell;
+  gdb::optional<scoped_restore_tmpl<bool>> restore_startup_with_shell;
 
   if (startup_with_shell && may_have_sip ())
     {