[Midnightbsd-cvs] src [9771] trunk/contrib/binutils: Fix clang 6 compiler warnings with binutils

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Feb 21 23:49:51 EST 2018


Revision: 9771
          http://svnweb.midnightbsd.org/src/?rev=9771
Author:   laffer1
Date:     2018-02-21 23:49:50 -0500 (Wed, 21 Feb 2018)
Log Message:
-----------
Fix clang 6 compiler warnings with binutils

Modified Paths:
--------------
    trunk/contrib/binutils/bfd/elflink.c
    trunk/contrib/binutils/include/obstack.h

Modified: trunk/contrib/binutils/bfd/elflink.c
===================================================================
--- trunk/contrib/binutils/bfd/elflink.c	2018-01-28 01:24:55 UTC (rev 9770)
+++ trunk/contrib/binutils/bfd/elflink.c	2018-02-22 04:49:50 UTC (rev 9771)
@@ -4815,7 +4815,7 @@
   len = strlen (name);
   copy = bfd_alloc (abfd, len);
   if (copy == NULL)
-    return (struct elf_link_hash_entry *) 0 - 1;
+    return (struct elf_link_hash_entry *)(intptr_t)-1;
 
   first = p - name + 1;
   memcpy (copy, name, first);
@@ -4927,7 +4927,7 @@
 	    }
 
 	  h = archive_symbol_lookup (abfd, info, symdef->name);
-	  if (h == (struct elf_link_hash_entry *) 0 - 1)
+	  if (h == (struct elf_link_hash_entry *)(intptr_t)-1)
 	    goto error_return;
 
 	  if (h == NULL)

Modified: trunk/contrib/binutils/include/obstack.h
===================================================================
--- trunk/contrib/binutils/include/obstack.h	2018-01-28 01:24:55 UTC (rev 9770)
+++ trunk/contrib/binutils/include/obstack.h	2018-02-22 04:49:50 UTC (rev 9771)
@@ -119,11 +119,11 @@
    may ignore the byte-within-word field of the pointer.  */
 
 #ifndef __PTR_TO_INT
-# define __PTR_TO_INT(P) ((P) - (char *) 0)
+# define __PTR_TO_INT(P) ((intptr_t)(P))
 #endif
 
 #ifndef __INT_TO_PTR
-# define __INT_TO_PTR(P) ((P) + (char *) 0)
+# define __INT_TO_PTR(P) ((void*)(intptr_t)(P))
 #endif
 
 /* We need the type of the resulting object.  If __PTRDIFF_TYPE__ is
@@ -427,7 +427,7 @@
      __o1->maybe_empty_object = 1;					\
    __o1->next_free							\
      = __INT_TO_PTR ((__PTR_TO_INT (__o1->next_free)+__o1->alignment_mask)\
-		     & ~ (__o1->alignment_mask));			\
+		     & ~(intptr_t)(__o1->alignment_mask));			\
    if (__o1->next_free - (char *)__o1->chunk				\
        > __o1->chunk_limit - (char *)__o1->chunk)			\
      __o1->next_free = __o1->chunk_limit;				\



More information about the Midnightbsd-cvs mailing list