This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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 -Wshadow warnings in dwarf2.c (seen on alpha-tru64)


The patch itself is fairly mechanical; I just renamed a couple of local
variables.  One of them (dirname) was renamed because it shadowed a function
with the same name.  The second one (subdirname) was renamed out of
consistency...

2010-01-01  Joel Brobecker  <brobecker@adacore.com>

        Fix -Wshadow warnings in dwarf2.c (seen on alpha-tru64).
        * dwarf2.c (concat_filename): Rename dirname with dir_name
        to void shadowing the dirname function.
        Rename subdirname with subdir_name to stay consistent with
        the new dir_name variable name.

OK to apply?

Thanks,
-- 
Joel
>From dd5fa7a66afeb6dfdbcb58fd8f3cc891ac048a6c Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 1 Jan 2010 14:08:56 +0100
Subject: [PATCH 1/2] Fix -Wshadow warnings in dwarf2.c (seen on alpha-tru64).

        * dwarf2.c (concat_filename): Rename dirname with dir_name
        to void shadowing the dirname function.
        Rename subdirname with subdir_name to stay consistent with
        the new dir_name variable name.
---
 bfd/dwarf2.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 0e875a1..e5eccfc 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1109,40 +1109,40 @@ concat_filename (struct line_info_table *table, unsigned int file)
 
   if (!IS_ABSOLUTE_PATH (filename))
     {
-      char *dirname = NULL;
-      char *subdirname = NULL;
+      char *dir_name = NULL;
+      char *subdir_name = NULL;
       char *name;
       size_t len;
 
       if (table->files[file - 1].dir)
-	subdirname = table->dirs[table->files[file - 1].dir - 1];
+	subdir_name = table->dirs[table->files[file - 1].dir - 1];
 
-      if (!subdirname || !IS_ABSOLUTE_PATH (subdirname))
-	dirname = table->comp_dir;
+      if (!subdir_name || !IS_ABSOLUTE_PATH (subdir_name))
+	dir_name = table->comp_dir;
 
-      if (!dirname)
+      if (!dir_name)
 	{
-	  dirname = subdirname;
-	  subdirname = NULL;
+	  dir_name = subdir_name;
+	  subdir_name = NULL;
 	}
 
-      if (!dirname)
+      if (!dir_name)
 	return strdup (filename);
 
-      len = strlen (dirname) + strlen (filename) + 2;
+      len = strlen (dir_name) + strlen (filename) + 2;
 
-      if (subdirname)
+      if (subdir_name)
 	{
-	  len += strlen (subdirname) + 1;
+	  len += strlen (subdir_name) + 1;
 	  name = (char *) bfd_malloc (len);
 	  if (name)
-	    sprintf (name, "%s/%s/%s", dirname, subdirname, filename);
+	    sprintf (name, "%s/%s/%s", dir_name, subdir_name, filename);
 	}
       else
 	{
 	  name = (char *) bfd_malloc (len);
 	  if (name)
-	    sprintf (name, "%s/%s", dirname, filename);
+	    sprintf (name, "%s/%s", dir_name, filename);
 	}
 
       return name;
-- 
1.6.5.rc2


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