about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-05-01 20:00:24 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-05-01 20:00:24 +0000
commit028e2e38795854365b0a9414273fbbc7ea84548a (patch)
treecddcc56be9cbab885f77147fb8ac3fa431756eaf
parent1b8f2850d8c95619598241e91a7249bba5775be1 (diff)
downloadglibc-028e2e38795854365b0a9414273fbbc7ea84548a.tar.gz
glibc-028e2e38795854365b0a9414273fbbc7ea84548a.tar.xz
glibc-028e2e38795854365b0a9414273fbbc7ea84548a.zip
conformtest: Unify variants of "constant" and "optional-constant".
-rw-r--r--ChangeLog10
-rw-r--r--conform/conformtest.pl68
-rw-r--r--conform/data/cpio.h-data40
-rw-r--r--conform/data/fmtmsg.h-data12
-rw-r--r--conform/data/limits.h-data98
-rw-r--r--conform/data/netinet/in.h-data4
-rw-r--r--conform/data/tar.h-data28
7 files changed, 106 insertions, 154 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f8e583ea1..0d4f9dbf7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2012-05-01  Joseph Myers  <joseph@codesourcery.com>
 
+	* conform/conformtest.pl: Only accept expected constant or
+	optional-constant values with "==".  Parse all "constant" lines in
+	one place.  Parse all "optional-constant" lines in one place.
+	* conform/data/cpio.h-data: Use "==" form on "constant" lines.
+	* conform/data/fmtmsg.h-data: Likewise.
+	* conform/data/netinet/in.h-data: Likewise.
+	* conform/data/tar.h-data: Likewise.
+	* conform/data/limits.h-data: Use "==" form on "constant" and
+	"optional-constant" lines.
+
 	* conform/conformtest.pl: Use -ansi for XPG3, XPG4 and UNIX98.
 	Use -std=c99 for XOPEN2K.
 	(@knownproblems): Remove.
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index f7933475d5..e15256bce1 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -415,7 +415,7 @@ while ($#headers >= 0) {
 		     "Member \"$member\" does not have the correct type.",
 		     $res, 0);
       }
-    } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<!]+) ([A-Za-z0-9_-]*)/) {
+    } elsif (/^optional-constant *([a-zA-Z0-9_]*) *(?:([>=<!]+) ([A-Za-z0-9_-]*))?/) {
       my($const) = $1;
       my($op) = $2;
       my($value) = $3;
@@ -434,7 +434,7 @@ while ($#headers >= 0) {
       $res = compiletest ($fnamebase, "Testing for constant $const",
 			  "NOT PRESENT", $res, 1);
 
-      if ($value ne "" && $res == 0) {
+      if (defined ($op) && $res == 0) {
 	# Generate a program to test for the value of this constant.
 	open (TESTFILE, ">$fnamebase.c");
 	print TESTFILE "$prepend";
@@ -446,7 +446,7 @@ while ($#headers >= 0) {
 	$res = runtest ($fnamebase, "Testing for value of constant $const",
 			"Constant \"$const\" has not the right value.", $res);
       }
-    } elsif (/^constant *([a-zA-Z0-9_]*) *([>=<!]+) ([A-Za-z0-9_-]*)/) {
+    } elsif (/^constant *([a-zA-Z0-9_]*) *(?:([>=<!]+) ([A-Za-z0-9_-]*))?/) {
       my($const) = $1;
       my($op) = $2;
       my($value) = $3;
@@ -465,7 +465,7 @@ while ($#headers >= 0) {
       $res = compiletest ($fnamebase, "Testing for constant $const",
 			  "Constant \"$const\" not available.", $res, 0);
 
-      if ($value ne "") {
+      if (defined ($op)) {
 	# Generate a program to test for the value of this constant.
 	open (TESTFILE, ">$fnamebase.c");
 	print TESTFILE "$prepend";
@@ -519,64 +519,6 @@ while ($#headers >= 0) {
 	$res = runtest ($fnamebase, "Testing for value of constant $const",
 			"Constant \"$const\" has not the right value.", $res);
       }
-    } elsif (/^optional-constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
-      my($const) = $1;
-      my($value) = $2;
-      my($res) = $missing;
-
-      # Remember that this name is allowed.
-      push @allow, $const;
-
-      # Generate a program to test for the availability of this constant.
-      open (TESTFILE, ">$fnamebase.c");
-      print TESTFILE "$prepend";
-      print TESTFILE "#include <$h>\n";
-      print TESTFILE "__typeof__ ($const) a = $const;\n";
-      close (TESTFILE);
-
-      $res = compiletest ($fnamebase, "Testing for constant $const",
-			  "NOT PRESENT", $res, 1);
-
-      if ($value ne "" && $res == 0) {
-	# Generate a program to test for the value of this constant.
-	open (TESTFILE, ">$fnamebase.c");
-	print TESTFILE "$prepend";
-	print TESTFILE "#include <$h>\n";
-	print TESTFILE "int main (void) { return $const != $value; }\n";
-	close (TESTFILE);
-
-	$res = runtest ($fnamebase, "Testing for value of constant $const",
-			"Constant \"$const\" has not the right value.", $res);
-      }
-    } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
-      my($const) = $1;
-      my($value) = $2;
-      my($res) = $missing;
-
-      # Remember that this name is allowed.
-      push @allow, $const;
-
-      # Generate a program to test for the availability of this constant.
-      open (TESTFILE, ">$fnamebase.c");
-      print TESTFILE "$prepend";
-      print TESTFILE "#include <$h>\n";
-      print TESTFILE "__typeof__ ($const) a = $const;\n";
-      close (TESTFILE);
-
-      $res = compiletest ($fnamebase, "Testing for constant $const",
-			  "Constant \"$const\" not available.", $res, 0);
-
-      if ($value ne "") {
-	# Generate a program to test for the value of this constant.
-	open (TESTFILE, ">$fnamebase.c");
-	print TESTFILE "$prepend";
-	print TESTFILE "#include <$h>\n";
-	print TESTFILE "int main (void) { return $const != $value; }\n";
-	close (TESTFILE);
-
-	$res = runtest ($fnamebase, "Testing for value of constant $const",
-			"Constant \"$const\" has not the right value.", $res);
-      }
     } elsif (/^symbol *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
       my($symbol) = $1;
       my($value) = $2;
@@ -1038,7 +980,7 @@ while ($#headers >= 0) {
 
       if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
 	push @allow, $7;
-      } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
+      } elsif (/^constant *([a-zA-Z0-9_]*) *(?:([>=<!]+) ([A-Za-z0-9_-]*))?/) {
 	push @allow, $1;
       } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
 	push @allow, $1;
diff --git a/conform/data/cpio.h-data b/conform/data/cpio.h-data
index 6e71319274..472777069d 100644
--- a/conform/data/cpio.h-data
+++ b/conform/data/cpio.h-data
@@ -1,24 +1,24 @@
 #if !defined ISO && !defined ISO99 && !defined ISO11
-constant C_IRUSR 0000400
-constant C_IWUSR 0000200
-constant C_IXUSR 0000100
-constant C_IRGRP 0000040
-constant C_IWGRP 0000020
-constant C_IXGRP 0000010
-constant C_IROTH 0000004
-constant C_IWOTH 0000002
-constant C_IXOTH 0000001
-constant C_ISUID 0004000
-constant C_ISGID 0002000
-constant C_ISVTX 0001000
-constant C_ISDIR 0040000
-constant C_ISFIFO 0010000
-constant C_ISREG 0100000
-constant C_ISBLK 0060000
-constant C_ISCHR 0020000
-constant C_ISCTG 0110000
-constant C_ISLNK 0120000
-constant C_ISSOCK 0140000
+constant C_IRUSR == 0000400
+constant C_IWUSR == 0000200
+constant C_IXUSR == 0000100
+constant C_IRGRP == 0000040
+constant C_IWGRP == 0000020
+constant C_IXGRP == 0000010
+constant C_IROTH == 0000004
+constant C_IWOTH == 0000002
+constant C_IXOTH == 0000001
+constant C_ISUID == 0004000
+constant C_ISGID == 0002000
+constant C_ISVTX == 0001000
+constant C_ISDIR == 0040000
+constant C_ISFIFO == 0010000
+constant C_ISREG == 0100000
+constant C_ISBLK == 0060000
+constant C_ISCHR == 0020000
+constant C_ISCTG == 0110000
+constant C_ISLNK == 0120000
+constant C_ISSOCK == 0140000
 
 macro-str MAGIC "070707"
 
diff --git a/conform/data/fmtmsg.h-data b/conform/data/fmtmsg.h-data
index d6d0ff1e2d..b6ddf27721 100644
--- a/conform/data/fmtmsg.h-data
+++ b/conform/data/fmtmsg.h-data
@@ -44,12 +44,12 @@ constant MM_PRINT
 macro MM_CONSOLE
 constant MM_CONSOLE
 
-constant MM_NULLLBL 0
-constant MM_NULLSEV 0
-constant MM_NULLMC 0
-constant MM_NULLTXT 0
-constant MM_NULLACT 0
-constant MM_NULLTAG 0
+constant MM_NULLLBL == 0
+constant MM_NULLSEV == 0
+constant MM_NULLMC == 0
+constant MM_NULLTXT == 0
+constant MM_NULLACT == 0
+constant MM_NULLTAG == 0
 
 macro MM_OK
 macro MM_NOTOK
diff --git a/conform/data/limits.h-data b/conform/data/limits.h-data
index d7c97969e5..8f7a0010c2 100644
--- a/conform/data/limits.h-data
+++ b/conform/data/limits.h-data
@@ -3,11 +3,11 @@ constant SCHAR_MIN <= -127
 constant SCHAR_MAX >= 127
 constant UCHAR_MAX >= 255
 #ifdef __CHAR_UNSIGNED__
-constant CHAR_MIN 0
-constant CHAR_MAX UCHAR_MAX
+constant CHAR_MIN == 0
+constant CHAR_MAX == UCHAR_MAX
 #else
-constant CHAR_MIN SCHAR_MIN
-constant CHAR_MAX SCHAR_MAX
+constant CHAR_MIN == SCHAR_MIN
+constant CHAR_MAX == SCHAR_MAX
 #endif
 constant MB_LEN_MAX >= 1
 constant SHRT_MIN <= -32767
@@ -84,60 +84,60 @@ macro RE_DUP_MAX
 
 constant _POSIX_CLOCKRES_MIN <= 20000000
 
-optional-constant _POSIX_AIO_LISTIO_MAX	2
-optional-constant _POSIX_AIO_MAX 1
-optional-constant _POSIX_ARG_MAX 4096
+optional-constant _POSIX_AIO_LISTIO_MAX == 2
+optional-constant _POSIX_AIO_MAX == 1
+optional-constant _POSIX_ARG_MAX == 4096
 #if !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
-optional-constant _POSIX_CHILD_MAX 25
+optional-constant _POSIX_CHILD_MAX == 25
 #else
-optional-constant _POSIX_CHILD_MAX 6
+optional-constant _POSIX_CHILD_MAX == 6
 #endif
-optional-constant _POSIX_DELAYTIMER_MAX 32
-optional-constant _POSIX_LINK_MAX 8
-optional-constant _POSIX_LOGIN_NAME_MAX 9
-optional-constant _POSIX_MAX_CANON 255
-optional-constant _POSIX_MAX_INPUT 255
-optional-constant _POSIX_MQ_OPEN_MAX 8
-optional-constant _POSIX_MQ_PRIO_MAX 32
-optional-constant _POSIX_NAME_MAX 14
+optional-constant _POSIX_DELAYTIMER_MAX == 32
+optional-constant _POSIX_LINK_MAX == 8
+optional-constant _POSIX_LOGIN_NAME_MAX == 9
+optional-constant _POSIX_MAX_CANON == 255
+optional-constant _POSIX_MAX_INPUT == 255
+optional-constant _POSIX_MQ_OPEN_MAX == 8
+optional-constant _POSIX_MQ_PRIO_MAX == 32
+optional-constant _POSIX_NAME_MAX == 14
 #if !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
-optional-constant _POSIX_NGROUPS_MAX 8
+optional-constant _POSIX_NGROUPS_MAX == 8
 #else
-optional-constant _POSIX_NGROUPS_MAX 0
+optional-constant _POSIX_NGROUPS_MAX == 0
 #endif
 #if !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
-optional-constant _POSIX_OPEN_MAX 20
+optional-constant _POSIX_OPEN_MAX == 20
 #else
-optional-constant _POSIX_OPEN_MAX 16
+optional-constant _POSIX_OPEN_MAX == 16
 #endif
-optional-constant _POSIX_PATH_MAX 256
-optional-constant _POSIX_PIPE_BUF 512
-optional-constant _POSIX2_RE_DUP_MAX 255
-optional-constant _POSIX_RTSIG_MAX 8
-optional-constant _POSIX_SEM_NSEMS_MAX 256
-optional-constant _POSIX_SEM_VALUE_MAX 32767
-optional-constant _POSIX_SIGQUEUE_MAX 32
-optional-constant _POSIX_SSIZE_MAX 32767
-optional-constant _POSIX_STREAM_MAX 8
-optional-constant _POSIX_SS_REPL_MAX 4
-optional-constant _POSIX_SYMLINK_MAX 255
-optional-constant _POSIX_SYMLOOP_MAX 8
-optional-constant _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
-optional-constant _POSIX_THREAD_KEYS_MAX 128
-optional-constant _POSIX_THREAD_THREADS_MAX 64
-optional-constant _POSIX_TIMER_MAX 32
-optional-constant _POSIX_TTY_NAME_MAX 9
-optional-constant _POSIX_TZNAME_MAX 6
-optional-constant _POSIX2_BC_BASE_MAX 99
-optional-constant _POSIX2_BC_DIM_MAX 2048
-optional-constant _POSIX2_BC_SCALE_MAX 99
-optional-constant _POSIX2_BC_STRING_MAX 1000
-optional-constant _POSIX2_CHARCLASS_NAME_MAX 14
-optional-constant _POSIX2_COLL_WEIGHTS_MAX 2
-optional-constant _POSIX2_EXPR_NEST_MAX 32
-optional-constant _POSIX2_LINE_MAX 2048
-optional-constant _POSIX2_RE_DUP_MAX 255
-optional-constant _XOPEN_IOV_MAX 16
+optional-constant _POSIX_PATH_MAX == 256
+optional-constant _POSIX_PIPE_BUF == 512
+optional-constant _POSIX2_RE_DUP_MAX == 255
+optional-constant _POSIX_RTSIG_MAX == 8
+optional-constant _POSIX_SEM_NSEMS_MAX == 256
+optional-constant _POSIX_SEM_VALUE_MAX == 32767
+optional-constant _POSIX_SIGQUEUE_MAX == 32
+optional-constant _POSIX_SSIZE_MAX == 32767
+optional-constant _POSIX_STREAM_MAX == 8
+optional-constant _POSIX_SS_REPL_MAX == 4
+optional-constant _POSIX_SYMLINK_MAX == 255
+optional-constant _POSIX_SYMLOOP_MAX == 8
+optional-constant _POSIX_THREAD_DESTRUCTOR_ITERATIONS == 4
+optional-constant _POSIX_THREAD_KEYS_MAX == 128
+optional-constant _POSIX_THREAD_THREADS_MAX == 64
+optional-constant _POSIX_TIMER_MAX == 32
+optional-constant _POSIX_TTY_NAME_MAX == 9
+optional-constant _POSIX_TZNAME_MAX == 6
+optional-constant _POSIX2_BC_BASE_MAX == 99
+optional-constant _POSIX2_BC_DIM_MAX == 2048
+optional-constant _POSIX2_BC_SCALE_MAX == 99
+optional-constant _POSIX2_BC_STRING_MAX == 1000
+optional-constant _POSIX2_CHARCLASS_NAME_MAX == 14
+optional-constant _POSIX2_COLL_WEIGHTS_MAX == 2
+optional-constant _POSIX2_EXPR_NEST_MAX == 32
+optional-constant _POSIX2_LINE_MAX == 2048
+optional-constant _POSIX2_RE_DUP_MAX == 255
+optional-constant _XOPEN_IOV_MAX == 16
 
 #if !defined POSIX && !defined POSIX2008
 constant WORD_BIT >= 16
diff --git a/conform/data/netinet/in.h-data b/conform/data/netinet/in.h-data
index 020a97eeae..be0236b490 100644
--- a/conform/data/netinet/in.h-data
+++ b/conform/data/netinet/in.h-data
@@ -51,7 +51,7 @@ macro IPPROTO_UDP
 macro INADDR_ANY
 macro INADDR_BROADCAST
 
-constant INET_ADDRSTRLEN 16
+constant INET_ADDRSTRLEN == 16
 
 function uint32_t htonl (uint32_t)
 function uint16_t htons (uint16_t)
@@ -61,7 +61,7 @@ function uint16_t ntohs (uint16_t)
 allow-header inttypes.h
 allow-header sys/socket.h
 
-constant INET6_ADDRSTRLEN 46
+constant INET6_ADDRSTRLEN == 46
 
 macro IPV6_JOIN_GROUP
 macro IPV6_LEAVE_GROUP
diff --git a/conform/data/tar.h-data b/conform/data/tar.h-data
index aa0cebc3f1..591850c144 100644
--- a/conform/data/tar.h-data
+++ b/conform/data/tar.h-data
@@ -1,8 +1,8 @@
 #if !defined ISO && !defined ISO99 && !defined ISO11
 macro-str TMAGIC "ustar"
-constant TMAGLEN 6
+constant TMAGLEN == 6
 macro-str TVERSION "00"
-constant TVERSLEN 2
+constant TVERSLEN == 2
 
 constant REGTYPE
 constant AREGTYPE
@@ -14,20 +14,20 @@ constant DIRTYPE
 constant FIFOTYPE
 constant CONTTYPE
 
-constant TSUID 04000
-constant TSGID 02000
+constant TSUID == 04000
+constant TSGID == 02000
 # if !defined POSIX && !defined POSIX2008
-constant TSVTX 01000
+constant TSVTX == 01000
 # endif
-constant TUREAD 00400
-constant TUWRITE 00200
-constant TUEXEC 00100
-constant TGREAD 00040
-constant TGWRITE 00020
-constant TGEXEC 00010
-constant TOREAD 00004
-constant TOWRITE 00002
-constant TOEXEC 00001
+constant TUREAD == 00400
+constant TUWRITE == 00200
+constant TUEXEC == 00100
+constant TGREAD == 00040
+constant TGWRITE == 00020
+constant TGEXEC == 00010
+constant TOREAD == 00004
+constant TOWRITE == 00002
+constant TOEXEC == 00001
 
 allow *_t
 #endif