about summary refs log tree commit diff
path: root/scripts/gen-as-const.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-12-22 05:18:34 +0000
committerRoland McGrath <roland@gnu.org>2005-12-22 05:18:34 +0000
commit0c7c6d531f8514aaee236ab1388ed88c1c31a630 (patch)
treea049c3500bba177e7567307645d3eb0442fc4bd7 /scripts/gen-as-const.awk
parentc72565e5f1124c2dc72573e83406fe999e56091f (diff)
downloadglibc-0c7c6d531f8514aaee236ab1388ed88c1c31a630.tar.gz
glibc-0c7c6d531f8514aaee236ab1388ed88c1c31a630.tar.xz
glibc-0c7c6d531f8514aaee236ab1388ed88c1c31a630.zip
* sysdeps/unix/sysv/linux/i386/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/i386/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/s390/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/x86_64/ucontext_i.h: File removed.
	* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: New file.
	* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = stdlib]:
	(gen-as-const-headers): Add it.
	* sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/s390/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
	* stdlib/tst-ucontext-off.c: File removed.
	* stdlib/Makefile (tests): Remove it.

	* scripts/gen-as-const.awk: Support generating a test program.
	* Makerules [gen-as-const-headers] (tests): Add test-as-const.
	[gen-as-const-headers] ($(objpfx)test-as-const.c): New target.
Diffstat (limited to 'scripts/gen-as-const.awk')
-rw-r--r--scripts/gen-as-const.awk28
1 files changed, 24 insertions, 4 deletions
diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk
index a315066422..c529fa42c8 100644
--- a/scripts/gen-as-const.awk
+++ b/scripts/gen-as-const.awk
@@ -13,7 +13,17 @@ BEGIN { started = 0 }
 /^#/ { print; next }
 
 NF >= 1 && !started {
-  print "void dummy(void) {";
+  if (test) {
+    print "\n#include <stdio.h>";
+    print "\nstatic int do_test (void)\n{\n  int bad = 0, good = 0;\n";
+    print "#define TEST(name, source, expr) \\\n" \
+      "  if (asconst_##name != (expr)) { ++bad;" \
+      " fprintf (stderr, \"%s: %s is %ld but %s is %ld\\n\"," \
+      " source, #name, (long int) asconst_##name, #expr, (long int) (expr));" \
+      " } else ++good;\n";
+  }
+  else
+    print "void dummy(void) {";
   started = 1;
 }
 
@@ -25,8 +35,18 @@ NF == 1 { sub(/^.*$/, "& &"); }
 NF > 1 {
   name = $1;
   sub(/^[^ 	]+[ 	]+/, "");
-  printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
-    name, $0;
+  if (test)
+    print "  TEST (" name ", \"" FILENAME ":" FNR "\", " $0 ")";
+  else
+    printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
+      name, $0;
 }
 
-END { if (started) print "}" }
+END {
+  if (test) {
+    print "  printf (\"%d errors in %d tests\\n\", bad, good + bad);"
+    print "  return bad != 0 || good == 0;\n}\n";
+    print "#define TEST_FUNCTION do_test ()";
+  }
+  else if (started) print "}";
+}