From: Phil Muldoon <pmuldoon@redhat.com>
To: gdb-patches@sourceware.org
Subject: (reposted) Fix -fprofile-use warnings/errors.
Date: Fri, 19 Nov 2010 16:13:00 -0000 [thread overview]
Message-ID: <m3pqu1xped.fsf_-_@redhat.com> (raw)
In-Reply-To: <m3d3q1z6fo.fsf@redhat.com> (Phil Muldoon's message of "Fri, 19 Nov 2010 15:20:11 +0000")
Phil Muldoon <pmuldoon@redhat.com> writes:
> Phil Muldoon <pmuldoon@redhat.com> writes:
>
>> 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.
>
> And just as soon as I post the patch I realize some of the profile data
> was stale. Sorry for the noise, but I will post another (larger) patch
> very shortly.
Here is an updated patch
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.
* gcore.c (objfile_find_memory_regions): Ditto.
* infcall.c (find_function_addr): Ditto.
* printcmd.c (sym_info): Ditto.
* symfile.c (overlay_invalidate_all, find_pc_overlay,
find_pc_mapped_section, list_overlays_command,
map_overlay_command, unmap_overlay_command): 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/gcore.c b/gdb/gcore.c
index 9fc0a7f..e45a8df 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -465,7 +465,7 @@ objfile_find_memory_regions (find_memory_region_ftype func, void *obfd)
{
/* Use objfile data to create memory sections. */
struct objfile *objfile;
- struct obj_section *objsec;
+ struct obj_section *objsec = NULL; /* GCC -fprofile-use warning. */
bfd_vma temp_bottom, temp_top;
/* Call callback function for each objfile section. */
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/infcall.c b/gdb/infcall.c
index 7f60e56..0f63baf 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -235,7 +235,7 @@ find_function_addr (struct value *function, struct type **retval_type)
struct gdbarch *gdbarch = get_type_arch (ftype);
enum type_code code = TYPE_CODE (ftype);
struct type *value_type = NULL;
- CORE_ADDR funaddr;
+ CORE_ADDR funaddr = 0; /* GCC -fprofile-use warning. */
/* If it's a member function, just look at the function
part of it. */
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/printcmd.c b/gdb/printcmd.c
index 5586767..a518958 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1089,7 +1089,7 @@ sym_info (char *arg, int from_tty)
{
struct minimal_symbol *msymbol;
struct objfile *objfile;
- struct obj_section *osect;
+ struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */
CORE_ADDR addr, sect_addr;
int matches = 0;
unsigned int offset;
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/symfile.c b/gdb/symfile.c
index f1c2941..098962b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2872,7 +2872,7 @@ static void
overlay_invalidate_all (void)
{
struct objfile *objfile;
- struct obj_section *sect;
+ struct obj_section *sect = NULL; /* GCC -fprofile-use warning. */
ALL_OBJSECTIONS (objfile, sect)
if (section_is_overlay (sect))
@@ -3050,7 +3050,8 @@ struct obj_section *
find_pc_overlay (CORE_ADDR pc)
{
struct objfile *objfile;
- struct obj_section *osect, *best_match = NULL;
+ /* GCC -fprofile-use warning. Set to NULL*/
+ struct obj_section *osect = NULL, *best_match = NULL;
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
@@ -3077,7 +3078,7 @@ struct obj_section *
find_pc_mapped_section (CORE_ADDR pc)
{
struct objfile *objfile;
- struct obj_section *osect;
+ struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
@@ -3095,7 +3096,7 @@ list_overlays_command (char *args, int from_tty)
{
int nmapped = 0;
struct objfile *objfile;
- struct obj_section *osect;
+ struct obj_section *osect = NULL; /* GCC -fprofile-use warning. */
if (overlay_debugging)
ALL_OBJSECTIONS (objfile, osect)
@@ -3134,7 +3135,9 @@ void
map_overlay_command (char *args, int from_tty)
{
struct objfile *objfile, *objfile2;
- struct obj_section *sec, *sec2;
+ /* GCC -fprofile-use warning. Set to NULL*/
+ struct obj_section *sec = NULL, *sec2 = NULL;
+
if (!overlay_debugging)
error (_("\
@@ -3179,7 +3182,7 @@ void
unmap_overlay_command (char *args, int from_tty)
{
struct objfile *objfile;
- struct obj_section *sec;
+ struct obj_section *sec = NULL; /* GCC-fprofile-use warning. */
if (!overlay_debugging)
error (_("\
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
next prev parent reply other threads:[~2010-11-19 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-19 14:50 Phil Muldoon
2010-11-19 15:20 ` Phil Muldoon
2010-11-19 16:13 ` Phil Muldoon [this message]
2010-11-19 17:46 ` (reposted) " Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3pqu1xped.fsf_-_@redhat.com \
--to=pmuldoon@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox