From 9c0cb1504e3883e788da79375e4fd8e3f424cddf Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 6 Aug 2008 02:09:47 +0000 Subject: * scripts/gen-as-const.awk: Use 32-bit values on 32-bit platforms. --- scripts/gen-as-const.awk | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk index 23f2f2bc9b..20d18c12af 100644 --- a/scripts/gen-as-const.awk +++ b/scripts/gen-as-const.awk @@ -16,12 +16,20 @@ NF >= 1 && !started { if (test) { print "\n#include "; print "\n#include "; + print "\n#if __WORDSIZE__ == 64"; + print "\ntypedef uint64_t c_t;"; print "\n#define U(n) UINT64_C (n)"; + print "\n#define PRI PRId64"; + print "\n#else"; + print "\ntypedef uint32_t c_t;"; + print "\n#define U(n) UINT32_C (n)"; + print "\n#define PRI PRId32"; + print "\n#endif"; print "\nstatic int do_test (void)\n{\n int bad = 0, good = 0;\n"; print "#define TEST(name, source, expr) \\\n" \ - " 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));" \ + " if (U (asconst_##name) != (c_t) (expr)) { ++bad;" \ + " fprintf (stderr, \"%s: %s is %\" PRI \" but %s is %\"PRI \"\\n\"," \ + " source, #name, U (asconst_##name), #expr, (c_t) (expr));" \ " } else ++good;\n"; } else -- cgit v1.2.1