Fix mismatched type in declaration for startup_with_shell
Commit Message
When compiling GDB with -flto, I got this error:
../../../gdb/gdbserver/../nat/fork-inferior.h:75:13: error: type of ‘startup_with_shell’ does not match original declaration [-Werror=lto-type-mismatch]
extern bool startup_with_shell;
^
../../../gdb/gdbserver/server.c:74:5: note: type ‘int’ should match type ‘bool’
int startup_with_shell = 1;
^
../../../gdb/gdbserver/server.c:74:5: note: ‘startup_with_shell’ was previously declared here
../../../gdb/gdbserver/server.c:74:5: note: code may be misoptimized unless -fno-strict-aliasing is used
lto1: all warnings being treated as errors
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
This fixes that.
gdb/gdbserver/ChangeLog:
2019-09-30 Christian Biesinger <cbiesinger@google.com>
* server.c (startup_with_shell): Change type to bool to match
fork-inferior.h and include fork-inferior.h so that this
error could be found more easily.
---
gdb/gdbserver/server.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
>>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
Christian> 2019-09-30 Christian Biesinger <cbiesinger@google.com>
Christian> * server.c (startup_with_shell): Change type to bool to match
Christian> fork-inferior.h and include fork-inferior.h so that this
Christian> error could be found more easily.
Funny, I debugged this today too.
See https://sourceware.org/ml/gdb-patches/2019-10/msg00010.html
Tom
On Tue, Oct 1, 2019 at 10:16 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> writes:
>
> Christian> 2019-09-30 Christian Biesinger <cbiesinger@google.com>
>
> Christian> * server.c (startup_with_shell): Change type to bool to match
> Christian> fork-inferior.h and include fork-inferior.h so that this
> Christian> error could be found more easily.
>
> Funny, I debugged this today too.
> See https://sourceware.org/ml/gdb-patches/2019-10/msg00010.html
Ah, great. Your version does look better.
Christian
@@ -41,6 +41,7 @@
#include "gdbsupport/environ.h"
#include "filenames.h"
#include "gdbsupport/pathstuff.h"
+#include "nat/fork-inferior.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/scope-exit.h"
@@ -71,7 +72,7 @@ static gdb_environ our_environ;
/* We always try to start the inferior using a shell. */
-int startup_with_shell = 1;
+bool startup_with_shell = true;
int server_waiting;