[PATCH] Fix build breakages on OSX due to -Wshadow and use of mempcpy.

Doug Kwan (關振德) dougkwan@google.com
Mon Dec 14 20:11:00 GMT 2009


Hi,

      This patch fixes a number of errors caused by use of -Wshadow and mempcpy.

-Doug

2009-12-14  Doug Kwan  <dougkwan@google.com>

bfd/ChangeLog:

        * bfd-in2.h (bfd_opnr_iovec): Rename parameters to avoid shawdowed
        declaration warnings.

gas/ChangeLog:

        * config/tc-i386.c (show_arch): Replace uses of mempcpy with
        equivalent code sequences with memcpy for portability.

include/ChangeLog:

        * bfdlink.h (struct bfd_link_callbacks): Rename function parameters
        to avoid shadowed declaration warnings.
        * dis-asm.h (struct disassemble_info): Ditto.
        (disassemble_init_for_target): Ditto.
        (init_disassemble_info): Ditto.
-------------- next part --------------
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.499
diff -u -p -r1.499 bfd-in2.h
--- bfd/bfd-in2.h	23 Nov 2009 14:41:28 -0000	1.499
+++ bfd/bfd-in2.h	14 Dec 2009 19:59:31 -0000
@@ -971,17 +971,17 @@ bfd *bfd_fdopenr (const char *filename, 
 bfd *bfd_openstreamr (const char *, const char *, void *);
 
 bfd *bfd_openr_iovec (const char *filename, const char *target,
-    void *(*open) (struct bfd *nbfd,
+    void *(*open_func) (struct bfd *nbfd,
     void *open_closure),
     void *open_closure,
-    file_ptr (*pread) (struct bfd *nbfd,
+    file_ptr (*pread_func) (struct bfd *nbfd,
     void *stream,
     void *buf,
     file_ptr nbytes,
     file_ptr offset),
-    int (*close) (struct bfd *nbfd,
+    int (*close_func) (struct bfd *nbfd,
     void *stream),
-    int (*stat) (struct bfd *abfd,
+    int (*stat_func) (struct bfd *abfd,
     void *stream,
     struct stat *sb));
 
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.411
diff -u -p -r1.411 tc-i386.c
--- gas/config/tc-i386.c	11 Dec 2009 13:42:10 -0000	1.411
+++ gas/config/tc-i386.c	14 Dec 2009 19:59:32 -0000
@@ -8140,7 +8140,8 @@ show_arch (FILE *stream, int ext)
 	      *p++ = ',';
 	      *p++ = ' ';
 	    }
-	  p = mempcpy (p, name, len);
+	  memcpy (p, name, len);
+	  p += len;
 	}
       else
 	{
@@ -8153,7 +8154,8 @@ show_arch (FILE *stream, int ext)
 	  
 	  gas_assert (left >= 0);
 
-	  p = mempcpy (p, name, len);
+	  memcpy (p, name, len);
+	  p += len;
 	}
     }
 
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.80
diff -u -p -r1.80 bfdlink.h
--- include/bfdlink.h	14 Oct 2009 05:54:28 -0000	1.80
+++ include/bfdlink.h	14 Dec 2009 19:59:35 -0000
@@ -540,11 +540,11 @@ struct bfd_link_callbacks
   /* A function which is called when a relocation is attempted against
      an undefined symbol.  NAME is the symbol which is undefined.
      ABFD, SECTION and ADDRESS identify the location from which the
-     reference is made. FATAL indicates whether an undefined symbol is
+     reference is made. IS_FATAL indicates whether an undefined symbol is
      a fatal error or not. In some cases SECTION may be NULL.  */
   bfd_boolean (*undefined_symbol)
     (struct bfd_link_info *, const char *name, bfd *abfd,
-     asection *section, bfd_vma address, bfd_boolean fatal);
+     asection *section, bfd_vma address, bfd_boolean is_fatal);
   /* A function which is called when a reloc overflow occurs. ENTRY is
      the link hash table entry for the symbol the reloc is against.
      NAME is the name of the local symbol or section the reloc is
Index: include/dis-asm.h
===================================================================
RCS file: /cvs/src/src/include/dis-asm.h,v
retrieving revision 1.76
diff -u -p -r1.76 dis-asm.h
--- include/dis-asm.h	29 Sep 2009 14:17:11 -0000	1.76
+++ include/dis-asm.h	14 Dec 2009 19:59:35 -0000
@@ -127,18 +127,18 @@ typedef struct disassemble_info
      Returns an errno value or 0 for success.  */
   int (*read_memory_func)
     (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
-     struct disassemble_info *info);
+     struct disassemble_info *dinfo);
 
   /* Function which should be called if we get an error that we can't
      recover from.  STATUS is the errno value from read_memory_func and
      MEMADDR is the address that we were trying to read.  INFO is a
      pointer to this struct.  */
   void (*memory_error_func)
-    (int status, bfd_vma memaddr, struct disassemble_info *info);
+    (int status, bfd_vma memaddr, struct disassemble_info *dinfo);
 
   /* Function called to print ADDR.  */
   void (*print_address_func)
-    (bfd_vma addr, struct disassemble_info *info);
+    (bfd_vma addr, struct disassemble_info *dinfo);
 
   /* Function called to determine if there is a symbol at the given ADDR.
      If there is, the function returns 1, otherwise it returns 0.
@@ -148,13 +148,13 @@ typedef struct disassemble_info
      address, (normally because there is a symbol associated with
      that address), but sometimes we want to mask out the overlay bits.  */
   int (* symbol_at_address_func)
-    (bfd_vma addr, struct disassemble_info * info);
+    (bfd_vma addr, struct disassemble_info *dinfo);
 
   /* Function called to check if a SYMBOL is can be displayed to the user.
      This is used by some ports that want to hide special symbols when
      displaying debugging outout.  */
   bfd_boolean (* symbol_is_valid)
-    (asymbol *, struct disassemble_info * info);
+    (asymbol *, struct disassemble_info *dinfo);
 
   /* These are for buffer_read_memory.  */
   bfd_byte *buffer;
@@ -317,7 +317,7 @@ extern disassembler_ftype disassembler (
 
 /* Amend the disassemble_info structure as necessary for the target architecture.
    Should only be called after initialising the info->arch field.  */
-extern void disassemble_init_for_target (struct disassemble_info * info);
+extern void disassemble_init_for_target (struct disassemble_info * dinfo);
 
 /* Document any target specific options available from the disassembler.  */
 extern void disassembler_usage (FILE *);
@@ -352,7 +352,7 @@ extern bfd_boolean generic_symbol_is_val
 
 /* Method to initialize a disassemble_info struct.  This should be
    called by all applications creating such a struct.  */
-extern void init_disassemble_info (struct disassemble_info *info, void *stream,
+extern void init_disassemble_info (struct disassemble_info *dinfo, void *stream,
 				   fprintf_ftype fprintf_func);
 
 /* For compatibility with existing code.  */


More information about the Binutils mailing list