This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Use 1U everywhere in elf/elf.h.


All the bits should be unsigned int in elf/elf.h since
otherwise you can get a warning for using SHF_EXCLUDE
in certain situations.

See:
https://lists.fedorahosted.org/pipermail/elfutils-devel/2015-January/004576.html

I just made them all use 1U for consistency.

No regressions on x86_64.

OK to commit?

Cheers,
Carlos.

2015-03-06  Carlos O'Donell  <carlos@redhat.com>

	* elf.h: Use 1U everywhere.

diff --git a/elf/elf.h b/elf/elf.h
index 496f08d..0540e80 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -356,22 +356,22 @@ typedef struct
 
 /* Legal values for sh_flags (section flags).  */
 
-#define SHF_WRITE	     (1 << 0)	/* Writable */
-#define SHF_ALLOC	     (1 << 1)	/* Occupies memory during execution */
-#define SHF_EXECINSTR	     (1 << 2)	/* Executable */
-#define SHF_MERGE	     (1 << 4)	/* Might be merged */
-#define SHF_STRINGS	     (1 << 5)	/* Contains nul-terminated strings */
-#define SHF_INFO_LINK	     (1 << 6)	/* `sh_info' contains SHT index */
-#define SHF_LINK_ORDER	     (1 << 7)	/* Preserve order after combining */
-#define SHF_OS_NONCONFORMING (1 << 8)	/* Non-standard OS specific handling
+#define SHF_WRITE	     (1U << 0)	/* Writable */
+#define SHF_ALLOC	     (1U << 1)	/* Occupies memory during execution */
+#define SHF_EXECINSTR	     (1U << 2)	/* Executable */
+#define SHF_MERGE	     (1U << 4)	/* Might be merged */
+#define SHF_STRINGS	     (1U << 5)	/* Contains nul-terminated strings */
+#define SHF_INFO_LINK	     (1U << 6)	/* `sh_info' contains SHT index */
+#define SHF_LINK_ORDER	     (1U << 7)	/* Preserve order after combining */
+#define SHF_OS_NONCONFORMING (1U << 8)	/* Non-standard OS specific handling
 					   required */
-#define SHF_GROUP	     (1 << 9)	/* Section is member of a group.  */
-#define SHF_TLS		     (1 << 10)	/* Section hold thread-local data.  */
+#define SHF_GROUP	     (1U << 9)	/* Section is member of a group.  */
+#define SHF_TLS		     (1U << 10)	/* Section hold thread-local data.  */
 #define SHF_MASKOS	     0x0ff00000	/* OS-specific.  */
 #define SHF_MASKPROC	     0xf0000000	/* Processor-specific */
-#define SHF_ORDERED	     (1 << 30)	/* Special ordering requirement
+#define SHF_ORDERED	     (1U << 30)	/* Special ordering requirement
 					   (Solaris).  */
-#define SHF_EXCLUDE	     (1 << 31)	/* Section is excluded unless
+#define SHF_EXCLUDE	     (1U << 31)	/* Section is excluded unless
 					   referenced or allocated (Solaris).*/
 
 /* Section group handling.  */
@@ -594,9 +594,9 @@ typedef struct
 
 /* Legal values for p_flags (segment flags).  */
 
-#define PF_X		(1 << 0)	/* Segment is executable */
-#define PF_W		(1 << 1)	/* Segment is writable */
-#define PF_R		(1 << 2)	/* Segment is readable */
+#define PF_X		(1U << 0)	/* Segment is executable */
+#define PF_W		(1U << 1)	/* Segment is writable */
+#define PF_R		(1U << 2)	/* Segment is readable */
 #define PF_MASKOS	0x0ff00000	/* OS-specific */
 #define PF_MASKPROC	0xf0000000	/* Processor-specific */
 
@@ -1707,21 +1707,21 @@ typedef struct
 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry.  */
 
 #define RHF_NONE		   0		/* No flags */
-#define RHF_QUICKSTART		   (1 << 0)	/* Use quickstart */
-#define RHF_NOTPOT		   (1 << 1)	/* Hash size not power of 2 */
-#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)	/* Ignore LD_LIBRARY_PATH */
-#define RHF_NO_MOVE		   (1 << 3)
-#define RHF_SGI_ONLY		   (1 << 4)
-#define RHF_GUARANTEE_INIT	   (1 << 5)
-#define RHF_DELTA_C_PLUS_PLUS	   (1 << 6)
-#define RHF_GUARANTEE_START_INIT   (1 << 7)
-#define RHF_PIXIE		   (1 << 8)
-#define RHF_DEFAULT_DELAY_LOAD	   (1 << 9)
-#define RHF_REQUICKSTART	   (1 << 10)
-#define RHF_REQUICKSTARTED	   (1 << 11)
-#define RHF_CORD		   (1 << 12)
-#define RHF_NO_UNRES_UNDEF	   (1 << 13)
-#define RHF_RLD_ORDER_SAFE	   (1 << 14)
+#define RHF_QUICKSTART		   (1U << 0)	/* Use quickstart */
+#define RHF_NOTPOT		   (1U << 1)	/* Hash size not power of 2 */
+#define RHF_NO_LIBRARY_REPLACEMENT (1U << 2)	/* Ignore LD_LIBRARY_PATH */
+#define RHF_NO_MOVE		   (1U << 3)
+#define RHF_SGI_ONLY		   (1U << 4)
+#define RHF_GUARANTEE_INIT	   (1U << 5)
+#define RHF_DELTA_C_PLUS_PLUS	   (1U << 6)
+#define RHF_GUARANTEE_START_INIT   (1U << 7)
+#define RHF_PIXIE		   (1U << 8)
+#define RHF_DEFAULT_DELAY_LOAD	   (1U << 9)
+#define RHF_REQUICKSTART	   (1U << 10)
+#define RHF_REQUICKSTARTED	   (1U << 11)
+#define RHF_CORD		   (1U << 12)
+#define RHF_NO_UNRES_UNDEF	   (1U << 13)
+#define RHF_RLD_ORDER_SAFE	   (1U << 14)
 
 /* Entries found in sections of type SHT_MIPS_LIBLIST.  */
 
@@ -1747,12 +1747,12 @@ typedef struct
 /* Legal values for l_flags.  */
 
 #define LL_NONE		  0
-#define LL_EXACT_MATCH	  (1 << 0)	/* Require exact match */
-#define LL_IGNORE_INT_VER (1 << 1)	/* Ignore interface version */
-#define LL_REQUIRE_MINOR  (1 << 2)
-#define LL_EXPORTS	  (1 << 3)
-#define LL_DELAY_LOAD	  (1 << 4)
-#define LL_DELTA	  (1 << 5)
+#define LL_EXACT_MATCH	  (1U << 0)	/* Require exact match */
+#define LL_IGNORE_INT_VER (1U << 1)	/* Ignore interface version */
+#define LL_REQUIRE_MINOR  (1U << 2)
+#define LL_EXPORTS	  (1U << 3)
+#define LL_DELAY_LOAD	  (1U << 4)
+#define LL_DELTA	  (1U << 5)
 
 /* Entries found in sections of type SHT_MIPS_CONFLICT.  */
 
@@ -2391,7 +2391,7 @@ enum
 #define STO_PPC64_LOCAL_BIT	5
 #define STO_PPC64_LOCAL_MASK	(7 << STO_PPC64_LOCAL_BIT)
 #define PPC64_LOCAL_ENTRY_OFFSET(other)				\
- (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
+ (((1U << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
 
 
 /* ARM specific declarations */
---

Cheers,
Carlos.


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