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]

conformtest: Check namespace within __attribute__


conformtest.pl uses compiler options that define __attribute__ calls
to empty.  This is needed to avoid some errors about types of
functions arising from attributes on those functions (these errors do
not reflect conformance problems, since they can only appear in code
using __typeof__ the way conformtest does to check types, and
__typeof__ is outside the scope of the standards).  But it also means
that any cases where headers (glibc or kernel) use __attribute__
without the leading and trailing __ on the attribute name, which would
be standard conformance violations where the name could be defined by
the user as a macro, go undetected.  And there have certainly been
such bugs with attributes such as "aligned" (should be "__aligned__")
before.  I propose this patch to avoid defining away __attribute__ for
the namespace tests.  Tested x86_64.

2012-04-29  Joseph Myers  <joseph@codesourcery.com>

	* conform/conformtest.pl ($CFLAGS_namespace): Define separately
	from $CFLAGS, without defining away __attribute__ calls.
	(checknamespace): Use $CFLAGS_namespace.

diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 018057f..d3e41be 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -43,7 +43,8 @@ $CFLAGS{"XOPEN2K"} = "-std=c99 -D_XOPEN_SOURCE=600";
 $CFLAGS{"XOPEN2K8"} = "-std=c99 -D_XOPEN_SOURCE=700";
 $CFLAGS{"POSIX2008"} = "-std=c99 -D_POSIX_C_SOURCE=200809L";
 
-$CFLAGS = "$flags -fno-builtin '-D__attribute__(x)=' $CFLAGS{$standard} -D_ISOMAC";
+$CFLAGS_namespace = "$flags -fno-builtin $CFLAGS{$standard} -D_ISOMAC";
+$CFLAGS = "$CFLAGS_namespace '-D__attribute__(x)='";
 
 # Check standard name for validity.
 die "unknown standard \"$standard\"" if ($CFLAGS{$standard} eq "");
@@ -262,7 +263,7 @@ sub checknamespace {
 
   undef %errors;
   $nknown = 0;
-  open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
+  open (CONTENT, "$CC $CFLAGS_namespace -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
   loop: while (<CONTENT>) {
     chop;
     if (/^#define (.*)/) {

-- 
Joseph S. Myers
joseph@codesourcery.com


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