]> sourceware.org Git - glibc.git/commitdiff
conformtest: Unify "constant" and "typed-constant".
authorJoseph Myers <joseph@codesourcery.com>
Tue, 1 May 2012 20:01:48 +0000 (20:01 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 1 May 2012 20:01:48 +0000 (20:01 +0000)
ChangeLog
conform/conformtest.pl
conform/data/signal.h-data

index f1f903d2b9f2a4b07b2e8ea22ead34c30d853f4f..323b45be3e3deb4ae6bb2e7722a8f130424b9a2d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-05-01  Joseph Myers  <joseph@codesourcery.com>
 
+       * conform/conformtest.pl: Handle braced types on "constant" lines
+       instead of handling "typed-constant".
+       * conform/data/signal.h-data: Use "constant" instead of
+       "typed-constant".
+
        * conform/conformtest.pl: Handle "optional-" at start of lines in
        one place rather than duplicating several cases.  Handle each
        format of "macro" line with initial "optional-".
index dc3712ea66fd1bb7bea5aeb6f3550059572d552d..0a1a0939902a609becb89bca028b9e90c9e0f68b 100644 (file)
@@ -385,10 +385,11 @@ while ($#headers >= 0) {
                     "Member \"$member\" does not have the correct type.",
                     $res, 0);
       }
-    } 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;
+      my($type) = $2;
+      my($op) = $3;
+      my($value) = $4;
       my($res) = $missing;
 
       # Remember that this name is allowed.
@@ -407,55 +408,27 @@ while ($#headers >= 0) {
                           : "Constant \"$const\" not available."), $res,
                          $optional);
 
-      if (defined ($op) && ($res == 0 || !$optional)) {
-       # Generate a program to test for the value of this constant.
+      if (defined ($type) && ($res == 0 || !$optional)) {
+       # Test the types of the members.
        open (TESTFILE, ">$fnamebase.c");
        print TESTFILE "$prepend";
        print TESTFILE "#include <$h>\n";
-       # Negate the value since 0 means ok
-       print TESTFILE "int main (void) { return !($const $op $value); }\n";
+       print TESTFILE "__typeof__ (($type) 0) a;\n";
+       print TESTFILE "extern __typeof__ ($const) a;\n";
        close (TESTFILE);
 
-       $res = runtest ($fnamebase, "Testing for value of constant $const",
-                       "Constant \"$const\" has not the right value.", $res);
+       compiletest ($fnamebase, "Testing for type of constant $const",
+                    "Constant \"$const\" does not have the correct type.",
+                    $res, 0);
       }
-    } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_-]*)?/) {
-      my($const) = $1;
-      my($type) = "$3$4";
-      my($value) = $5;
-      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);
-
-      # Test the types of the members.
-      open (TESTFILE, ">$fnamebase.c");
-      print TESTFILE "$prepend";
-      print TESTFILE "#include <$h>\n";
-      print TESTFILE "__typeof__ (($type) 0) a;\n";
-      print TESTFILE "extern __typeof__ ($const) a;\n";
-      close (TESTFILE);
-
-      compiletest ($fnamebase, "Testing for type of constant $const",
-                  "Constant \"$const\" does not have the correct type.",
-                  $res, 0);
-
-      if ($value ne "") {
+      if (defined ($op) && ($res == 0 || !$optional)) {
        # 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";
+       # Negate the value since 0 means ok
+       print TESTFILE "int main (void) { return !($const $op $value); }\n";
        close (TESTFILE);
 
        $res = runtest ($fnamebase, "Testing for value of constant $const",
@@ -833,9 +806,7 @@ while ($#headers >= 0) {
 
       if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
        push @allow, $7;
-      } elsif (/^constant *([a-zA-Z0-9_]*) *(?:([>=<!]+) ([A-Za-z0-9_-]*))?/) {
-       push @allow, $1;
-      } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
+      } elsif (/^constant *([a-zA-Z0-9_]*) *(?:{([^}]*)} *)?(?:([>=<!]+) ([A-Za-z0-9_-]*))?/) {
        push @allow, $1;
       } elsif (/^(type|tag) *({([^}]*)|([a-zA-Z0-9_]*))/) {
        my($type) = "$3$4";
index 18f1b9e0964bbf7d7f2a8113aa6d814cc4133903..99468aecef17a2375afd8cdf22b391117a307557 100644 (file)
@@ -1,9 +1,9 @@
-typed-constant SIG_DFL {void(*)(int)}
-typed-constant SIG_ERR {void(*)(int)}
+constant SIG_DFL {void(*)(int)}
+constant SIG_ERR {void(*)(int)}
 #if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
-typed-constant SIG_HOLD {void(*)(int)}
+constant SIG_HOLD {void(*)(int)}
 #endif
-typed-constant SIG_IGN {void(*)(int)}
+constant SIG_IGN {void(*)(int)}
 
 type sig_atomic_t
 #if !defined ISO && !defined ISO99 && !defined ISO11
This page took 0.111833 seconds and 5 git commands to generate.