about summary refs log tree commit diff
path: root/scripts/gen-as-const.awk
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-07-26 16:35:21 +0000
committerUlrich Drepper <drepper@redhat.com>2008-07-26 16:35:21 +0000
commit619cc2f69d1670f8b81196e31f60092334bf562b (patch)
tree0736c6eaebf408626f32c1f880793fd8886c66f8 /scripts/gen-as-const.awk
parent1311b164df26ee49740b805d4f32fffde163b1e6 (diff)
downloadglibc-619cc2f69d1670f8b81196e31f60092334bf562b.tar.gz
glibc-619cc2f69d1670f8b81196e31f60092334bf562b.tar.xz
glibc-619cc2f69d1670f8b81196e31f60092334bf562b.zip
* scripts/gen-as-const.awk: Generate more widely usable code by
	using 64-bit arithmetic.
Diffstat (limited to 'scripts/gen-as-const.awk')
-rw-r--r--scripts/gen-as-const.awk8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk
index bc3c47fb73..23f2f2bc9b 100644
--- a/scripts/gen-as-const.awk
+++ b/scripts/gen-as-const.awk
@@ -14,12 +14,14 @@ BEGIN { started = 0 }
 
 NF >= 1 && !started {
   if (test) {
+    print "\n#include <inttypes.h>";
     print "\n#include <stdio.h>";
+    print "\n#define U(n) UINT64_C (n)";
     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));" \
+      "  if (U (asconst_##name) != (uint64_t) (expr)) { ++bad;" \
+      " fprintf (stderr, \"%s: %s is %\" PRId64 \" but %s is %\"PRId64 \"\\n\"," \
+      " source, #name, U (asconst_##name), #expr, (uint64_t) (expr));" \
       " } else ++good;\n";
   }
   else