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]

[PATCH] Solving compile warnings with clang


Hi,

I'm proposing this small set of patches to solve some warnings, that
clang raises on bfd and opcodes.
This two subdir are compiled with -Werror causing compiling error.
Moreover, I guess solving warnings is a good thing, independently
which compiler generate them...
The ChangeLog entry could be:

2012-12-21 Luca Pizzamiglio <luca.pizzamiglio@gmail.com>

    Solving some warnings generated by clang
    * bfd/coffcode.h, bfd/opncls.c, bfd/peicode.h: return value of a
macro ignored
    * opcodes/i386-dis.c: avoiding pointer arithmetic


Best regards,
Luca
--- bfd/coffcode.h.orig	2012-12-18 14:22:56.000000000 +0100
+++ bfd/coffcode.h	2012-12-18 14:23:11.000000000 +0100
@@ -3442,7 +3442,7 @@
 	 incremented in coff_set_section_contents.  This is right for
 	 SVR3.2.  */
       if (strcmp (current->name, _LIB) == 0)
-	bfd_set_section_vma (abfd, current, 0);
+	(void)bfd_set_section_vma (abfd, current, 0);
 #endif
 
 #ifdef ALIGN_SECTIONS_IN_FILE
--- bfd/opncls.c.orig	2012-12-18 14:18:47.000000000 +0100
+++ bfd/opncls.c	2012-12-18 14:19:18.000000000 +0100
@@ -254,7 +254,7 @@
      then it may have been opened with special flags that make it
      unsafe to close and reopen the file.  */
   if (fd == -1)
-    bfd_set_cacheable (nbfd, TRUE);
+    (void)bfd_set_cacheable (nbfd, TRUE);
 
   return nbfd;
 }
--- bfd/peicode.h.orig	2012-12-18 14:22:02.000000000 +0100
+++ bfd/peicode.h	2012-12-18 14:22:21.000000000 +0100
@@ -602,7 +602,7 @@
 
   bfd_set_section_flags (vars->abfd, sec, flags | extra_flags);
 
-  bfd_set_section_alignment (vars->abfd, sec, 2);
+  (void)bfd_set_section_alignment (vars->abfd, sec, 2);
 
   /* Check that we will not run out of space.  */
   BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);
--- opcodes/i386-dis.c.orig	2012-07-16 14:58:29.000000000 +0200
+++ opcodes/i386-dis.c	2012-12-18 15:22:10.000000000 +0100
@@ -11991,7 +11991,7 @@
 static void
 OP_ST (int bytemode ATTRIBUTE_UNUSED, int sizeflag ATTRIBUTE_UNUSED)
 {
-  oappend ("%st" + intel_syntax);
+  oappend (&"%st"[(short)intel_syntax]);
 }
 
 static void
@@ -12520,32 +12520,32 @@
   if (prefixes & PREFIX_CS)
     {
       used_prefixes |= PREFIX_CS;
-      oappend ("%cs:" + intel_syntax);
+      oappend (&"%cs:"[(short)intel_syntax]);
     }
   if (prefixes & PREFIX_DS)
     {
       used_prefixes |= PREFIX_DS;
-      oappend ("%ds:" + intel_syntax);
+      oappend (&"%ds:"[(short)intel_syntax]);
     }
   if (prefixes & PREFIX_SS)
     {
       used_prefixes |= PREFIX_SS;
-      oappend ("%ss:" + intel_syntax);
+      oappend (&"%ss:"[(short)intel_syntax]);
     }
   if (prefixes & PREFIX_ES)
     {
       used_prefixes |= PREFIX_ES;
-      oappend ("%es:" + intel_syntax);
+      oappend (&"%es:"[(short)intel_syntax]);
     }
   if (prefixes & PREFIX_FS)
     {
       used_prefixes |= PREFIX_FS;
-      oappend ("%fs:" + intel_syntax);
+      oappend (&"%fs:"[(short)intel_syntax]);
     }
   if (prefixes & PREFIX_GS)
     {
       used_prefixes |= PREFIX_GS;
-      oappend ("%gs:" + intel_syntax);
+      oappend (&"%gs:"[(short)intel_syntax]);
     }
 }
 
@@ -13876,7 +13876,7 @@
 	  intel_operand_size (b_mode, sizeflag);
 	}
     }
-  oappend ("%es:" + intel_syntax);
+  oappend (&"%es:"[(short)intel_syntax]);
   ptr_reg (code, sizeflag);
 }
 

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