This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
conformtest: Use correct keyword set for underlying C standard
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Sun, 29 Apr 2012 10:14:34 +0000 (UTC)
- Subject: conformtest: Use correct keyword set for underlying C standard
conformtest.pl allows all C99 keywords to be used in headers, but
properly it should only allow keywords from the relevant C standard
version. I propose this patch to fix this. Tested x86_64.
2012-04-29 Joseph Myers <joseph@codesourcery.com>
* conform/conformtest.pl (@keywords): Only include C99 keywords
for standards based on C99 or C11.
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 4704deb..018057f 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -64,12 +64,15 @@ die "unknown standard \"$standard\"" if ($CFLAGS{$standard} eq "");
# $mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
# }
-# These are the ISO C99 keywords.
+# These are the ISO C90 keywords.
@keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto',
- 'if', 'inline', 'int', 'long', 'register', 'restrict', 'return',
+ 'if', 'int', 'long', 'register', 'return',
'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
'typedef', 'union', 'unsigned', 'void', 'volatile', 'while');
+if ($CFLAGS{$standard} =~ /-std=(c99|c1x)/) {
+ push (@keywords, 'inline', 'restrict');
+}
# Make a hash table from this information.
while ($#keywords >= 0) {
--
Joseph S. Myers
joseph@codesourcery.com