[gdbserver] Fix Wlto-type-mismatch for debug_agent
authorTom de Vries <tdevries@suse.de>
Fri, 12 Jun 2020 16:36:56 +0000 (18:36 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 12 Jun 2020 16:36:56 +0000 (18:36 +0200)
When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto,
I run into:
...
src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \
  does not match original declaration [-Werror=lto-type-mismatch]
 extern bool debug_agent;
             ^
src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool'
 int debug_agent = 0;
     ^
src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here
src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \
  -fno-strict-aliasing is used
...

Fix this by changing the type of debug_agent in ax.cc from int to bool.

Tested on x86_64-linux.

gdbserver/ax.cc

index 213db410a07e9d5764d1f8c6e9f033a5b630c243..42d28128fa6afe24c38ddacd1d783306d40e8a28 100644 (file)
@@ -25,7 +25,7 @@
 static void ax_vdebug (const char *, ...) ATTRIBUTE_PRINTF (1, 2);
 
 #ifdef IN_PROCESS_AGENT
-int debug_agent = 0;
+bool debug_agent = 0;
 #endif
 
 static void
This page took 0.025347 seconds and 4 git commands to generate.