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] Fix -Wundef for FEATURE_INDEX_1.


While reviewing some code for Siddhesh and waiting for a build I had
time to do another -Wundef fix.

This is the simplest patch I can come up with to fix FEATURE_INDEX_1
-Wundef warnings. The constant definition is duplicated because we
can't use the enum constant in assembly nor in the other macros.

The bright side is that we end up with:
#ifdef __ASSEMBLER__
... Everything we need for assembly.
#endif
... Everything we need for non-assembly.
#endif

The down side is the slight duplication. I considered adding another
macro e.g.
#define __FEATURE_INDEX_1 0
...
# define FEATURE_INDEX_1 __FEATURE_INDEX_1
...
However, that just seemed ugly, so I left the duplication.

Any objections?

2014-04-29  Carlos O'Donell  <carlos@redhat.com>

	* sysdeps/x86_64/multiarch/init-arch.h [__ASSEMBLER__]:
	Define FEATURE_INDEX_1 to 0.
	[!__ASSEMBLER__]: Likewise.

diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 813b6de..6449109 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -49,6 +49,11 @@
 
 #ifdef __ASSEMBLER__
 
+/* The feature index constants must match those used in the non-assembly
+   below.  We can't use a unified definition because the assembly won't
+   accept enum constants, nor will other macros.  */
+# define FEATURE_INDEX_1 0
+
 # include <ifunc-defines.h>
 
 # define index_SSE2    COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
@@ -85,6 +90,7 @@ enum
 enum
   {
     FEATURE_INDEX_1 = 0,
+# define FEATURE_INDEX_1 0
     /* Keep the following line at the end.  */
     FEATURE_INDEX_MAX
   };
---

Cheers,
Carlos.


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