This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix -fprofile-use warnings/errors.


This patch corrects (and in some cases, appeases) compiler warnings
generated through the use of -fprofile-use.  We've had a variant patch
for sometime in the Fedora GDB.  This updates HEAD.

For reference, my configure and compile setup:

../gdb-patched/configure --enable-targets=all --prefix=/usr
                         --libdir=/usr/lib64 --sysconfdir=/etc --mandir=/usr/share/man
                         --infodir=/usr/share/info --with-gdb-datadir=/usr/share/gdb
                         --with-pythondir=/usr/share/gdb/python
                         --enable-gdb-build-warnings=,-Wno-unused --enable-werror
                         --with-separate-debug-dir=/usr/lib/debug --disable-sim --disable-rpath
                         --with-system-readline --with-expat --without-libexpat-prefix
                         --enable-tui --with-python --with-rpm=librpm.so.1 --without-libunwind
                         --enable-64-bit-bfd x86_64-redhat-linux-gnu

make CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
     -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
     -fprofile-use"


Test on x8664 with no regressions.

Cheers,

Phil

--
2010-11-19  Phil Muldoon  <pmuldoon@redhat.com>

	* cris-tdep.c (cris_software_single_step): Initialize variables
          to appease fprofile-use warnings.
        * macroexp.c (expand): Ditto.
        * remote-m32r-sdi.c: Ditto.
        * xcoffread.c (read_xcoff_symtab): Ditto.

gdbserver:

2010-11-19  Phil Muldoon  <pmuldoon@redhat.com>

        * linux-x86-low.c (ATTR_NOINLINE_NOCLONE): Define.
        (add_insns): Use ATTR_NOLINE_NOCLONE.

--

diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 52a89de..7045cb9 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -2134,10 +2134,15 @@ cris_software_single_step (struct frame_info *frame)
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct address_space *aspace = get_frame_address_space (frame);
   inst_env_type inst_env;
+  int status;
+
+  /* GCC -fprofile-use warning.  */
+  memset (&inst_env, 0, sizeof (inst_env));
 
   /* Analyse the present instruction environment and insert 
      breakpoints.  */
-  int status = find_step_target (frame, &inst_env);
+  status = find_step_target (frame, &inst_env);
+
   if (status == -1)
     {
       /* Could not find a target.  Things are likely to go downhill 
diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
index 49e9e55..bfd4698 100644
--- a/gdb/gdbserver/linux-x86-low.c
+++ b/gdb/gdbserver/linux-x86-low.c
@@ -89,6 +89,12 @@ static const char *xmltarget_amd64_linux_no_xml = "@<target>\
 #define ARCH_GET_GS 0x1004
 #endif
 
+#if defined(__GNUC__)
+#  define ATTR_NOINLINE_NOCLONE __attribute__((noinline, noclone))
+#else
+#  define ATTR_NOINLINE_NOCLONE
+#endif
+
 /* Per-process arch-specific data we want to keep.  */
 
 struct arch_process_info
@@ -1520,7 +1526,7 @@ x86_install_fast_tracepoint_jump_pad (CORE_ADDR tpoint, CORE_ADDR tpaddr,
 						adjusted_insn_addr_end);
 }
 
-static void
+static void ATTR_NOINLINE_NOCLONE
 add_insns (unsigned char *start, int len)
 {
   CORE_ADDR buildaddr = current_insn_ptr;
diff --git a/gdb/macroexp.c b/gdb/macroexp.c
index 86689c3..972e953 100644
--- a/gdb/macroexp.c
+++ b/gdb/macroexp.c
@@ -1184,6 +1184,9 @@ expand (const char *id,
       struct macro_buffer va_arg_name;
       int is_varargs = 0;
 
+      /* GCC false -fprofile-use warning.  */
+      memset (&va_arg_name, 0, sizeof (va_arg_name));
+
       if (def->argc >= 1)
 	{
 	  if (strcmp (def->argv[def->argc - 1], "...") == 0)
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 2b67927..bd06950 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -273,7 +273,7 @@ send_three_arg_cmd (unsigned char cmd, unsigned long arg1, unsigned long arg2,
 static unsigned char
 recv_char_data (void)
 {
-  unsigned char val;
+  unsigned char val = 0;  /* GCC -fprofile-use warning.  */
 
   recv_data (&val, 1);
   return val;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 902d48f..196fec1 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -961,6 +961,9 @@ read_xcoff_symtab (struct partial_symtab *pst)
   CORE_ADDR last_csect_val;
   int last_csect_sec;
 
+  /* GCC -fprofile-use warning.  */
+  memset (&fcn_aux_saved, 0, sizeof (fcn_aux_saved));
+
   this_symtab_psymtab = pst;
 
   /* Get the appropriate COFF "constants" related to the file we're


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]