http://sourceware.org/bugzilla/show_bug.cgi?id=12739

           Summary: [patch] bfd_get warns under -Wcast-qual
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: binutils
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: ande...@ksplice.com


This fixes bfd_get_8 (hence also bfd_get, which uses it) to accept const void *
without emitting a warning under gcc -Wcast-qual:
warning: cast discards ‘__attribute__((const))’ qualifier from pointer target
type [-Wcast-qual]

--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -431,9 +431,9 @@ DESCRIPTION
 .#define bfd_put_signed_8 \
 .  bfd_put_8
 .#define bfd_get_8(abfd, ptr) \
-.  (*(unsigned char *) (ptr) & 0xff)
+.  (*(const unsigned char *) (ptr) & 0xff)
 .#define bfd_get_signed_8(abfd, ptr) \
-.  (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
+.  (((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
 .
 .#define bfd_put_16(abfd, val, ptr) \
 .  BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to