diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ca513788d94f037ee6a60ca2ad439f5ba7e0b71..8b2dda7f07f3bfc73b997eeb26b04684880cc8a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-07-25 Danny Smith <dannysmith@users.sourceforge.net> + + * gcc.dg/compat/struct-layout-1_generate.c (COMPAT_PRLL): + Define and use throughout as long long printf format specifier. + * g++.dg/compat/struct-layout-1_generate.c (COMPAT_PRLL): + Likewise. + 2007-07-24 H.J. Lu <hongjiu.lu@intel.com> * gcc.dg/dfp/fe-convert-2.c: Unconditionally enable testing diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c index 4234e9f3dc36dec1b5e8585c7cd4ec5eef36a640..49608f9481c4267f5d5a6a0892095c13a66e8e92 100644 --- a/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c @@ -36,6 +36,12 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA # error Need 64-bit long long #endif +#if defined __MSVCRT__ +#define COMPAT_PRLL "I64" +#else +#define COMPAT_PRLL "ll" +#endif + typedef unsigned int hashval_t; enum TYPE @@ -778,7 +784,7 @@ output_FNB (char mode, struct entry *e) m &= e->len > 1 ? (1ULL << (e->len - 1)) - 1 : 1; l1 &= m; l2 &= m; - fprintf (outfile, "%s%llu%s,%s%llu%s", + fprintf (outfile, "%s%" COMPAT_PRLL "u%s,%s%" COMPAT_PRLL "u%s", (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "", (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : ""); break; @@ -788,7 +794,8 @@ output_FNB (char mode, struct entry *e) m &= (1ULL << e->len) - 1; l1 &= m; l2 &= m; - fprintf (outfile, "%lluU%s,%lluU%s", l1, l1 > 4294967295U ? "LL" : "", + fprintf (outfile,"%" COMPAT_PRLL "uU%s,%" COMPAT_PRLL "uU%s", + l1, l1 > 4294967295U ? "LL" : "", l2, l2 > 4294967295U ? "LL" : ""); break; case TYPE_FLOAT: @@ -802,7 +809,8 @@ output_FNB (char mode, struct entry *e) if (e->type->maxval == 0) fputs ("e0_0,e0_0", outfile); else if (e->type->maxval == 1) - fprintf (outfile, "e1_%lld,e1_%lld", l1 & 1, l2 & 1); + fprintf (outfile, "e1_%" COMPAT_PRLL "d,e1_%" COMPAT_PRLL "d", + l1 & 1, l2 & 1); else { p = strchr (e->type->name, '\0'); @@ -814,7 +822,8 @@ output_FNB (char mode, struct entry *e) l1 += e->type->maxval - 6; if (l2 > 3) l2 += e->type->maxval - 6; - fprintf (outfile, "e%s_%lld,e%s_%lld", p, l1, p, l2); + fprintf (outfile, "e%s_%" COMPAT_PRLL "d,e%s_%" COMPAT_PRLL "d", + p, l1, p, l2); } break; case TYPE_SENUM: @@ -823,7 +832,7 @@ output_FNB (char mode, struct entry *e) p++; l1 %= 7; l2 %= 7; - fprintf (outfile, "e%s_%s%lld,e%s_%s%lld", + fprintf (outfile, "e%s_%s%" COMPAT_PRLL "d,e%s_%s%" COMPAT_PRLL "d", p, l1 < 3 ? "m" : "", l1 == 3 ? 0LL : e->type->maxval - (l1 & 3), p, l2 < 3 ? "m" : "", @@ -832,13 +841,15 @@ output_FNB (char mode, struct entry *e) case TYPE_PTR: l1 %= 256; l2 %= 256; - fprintf (outfile, "(%s)&intarray[%lld],(%s)&intarray[%lld]", + fprintf (outfile, + "(%s)&intarray[%" COMPAT_PRLL "d], (%s)&intarray[%" COMPAT_PRLL "d]", e->type->name, l1, e->type->name, l2); break; case TYPE_FNPTR: l1 %= 10; l2 %= 10; - fprintf (outfile, "fn%lld,fn%lld", l1, l2); + fprintf (outfile, + "fn%" COMPAT_PRLL "d,fn%" COMPAT_PRLL "d", l1, l2); break; default: abort (); diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c index 09cb0a5cd7c56a63b23817955aaeb7b0652c5f23..3e86f6ca66111dc6452039883c1ddcd65307c3d1 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c @@ -36,6 +36,12 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA # error Need 64-bit long long #endif +#if defined __MSVCRT__ +#define COMPAT_PRLL "I64" +#else +#define COMPAT_PRLL "ll" +#endif + typedef unsigned int hashval_t; enum TYPE @@ -1038,7 +1044,7 @@ output_FNB (char mode, struct entry *e) m &= e->len > 1 ? (1ULL << (e->len - 1)) - 1 : 1; l1 &= m; l2 &= m; - fprintf (outfile, "%s%llu%s,%s%llu%s", + fprintf (outfile, "%s%" COMPAT_PRLL "u%s,%s%" COMPAT_PRLL "u%s", (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "", (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : ""); break; @@ -1048,7 +1054,8 @@ output_FNB (char mode, struct entry *e) m &= (1ULL << e->len) - 1; l1 &= m; l2 &= m; - fprintf (outfile, "%lluU%s,%lluU%s", l1, l1 > 4294967295U ? "LL" : "", + fprintf (outfile, "%" COMPAT_PRLL "uU%s,%" COMPAT_PRLL "uU%s", + l1, l1 > 4294967295U ? "LL" : "", l2, l2 > 4294967295U ? "LL" : ""); break; case TYPE_FLOAT: @@ -1085,7 +1092,8 @@ output_FNB (char mode, struct entry *e) signs = generate_random () & 3; l1 &= e->type->maxval; l2 &= e->type->maxval; - fprintf (outfile, "CINT(%s%llu%s,%s%llu%s),", + fprintf (outfile, + "CINT(%s%" COMPAT_PRLL "u%s,%s%" COMPAT_PRLL "u%s),", (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "", (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : ""); signs = generate_random () & 3; @@ -1093,21 +1101,24 @@ output_FNB (char mode, struct entry *e) l2 = getrandll (); l1 &= e->type->maxval; l2 &= e->type->maxval; - fprintf (outfile, "CINT(%s%llu%s,%s%llu%s)", + fprintf (outfile, + "CINT(%s%" COMPAT_PRLL "u%s,%s%" COMPAT_PRLL "u%s)", (signs & 1) ? "-" : "", l1, l1 > 2147483647 ? "LL" : "", (signs & 2) ? "-" : "", l2, l2 > 2147483647 ? "LL" : ""); break; case TYPE_CUINT: l1 &= e->type->maxval; l2 &= e->type->maxval; - fprintf (outfile, "CINT(%lluU%s,%lluU%s),", + fprintf (outfile, + "CINT(%" COMPAT_PRLL "uU%s,%" COMPAT_PRLL "uU%s),", l1, l1 > 4294967295U ? "LL" : "", l2, l2 > 4294967295U ? "LL" : ""); l1 = getrandll (); l2 = getrandll (); l1 &= e->type->maxval; l2 &= e->type->maxval; - fprintf (outfile, "CINT(%lluU%s,%lluU%s)", + fprintf (outfile, + "CINT(%" COMPAT_PRLL "uU%s,%" COMPAT_PRLL "uU%s)", l1, l1 > 4294967295U ? "LL" : "", l2, l2 > 4294967295U ? "LL" : ""); break; @@ -1131,7 +1142,8 @@ output_FNB (char mode, struct entry *e) if (e->type->maxval == 0) fputs ("e0_0,e0_0", outfile); else if (e->type->maxval == 1) - fprintf (outfile, "e1_%lld,e1_%lld", l1 & 1, l2 & 1); + fprintf (outfile, "e1_%" COMPAT_PRLL "d,e1_%" COMPAT_PRLL "d", + l1 & 1, l2 & 1); else { p = strchr (e->type->name, '\0'); @@ -1143,7 +1155,8 @@ output_FNB (char mode, struct entry *e) l1 += e->type->maxval - 6; if (l2 > 3) l2 += e->type->maxval - 6; - fprintf (outfile, "e%s_%lld,e%s_%lld", p, l1, p, l2); + fprintf (outfile, "e%s_%" COMPAT_PRLL "d,e%s_%" COMPAT_PRLL "d", + p, l1, p, l2); } break; case TYPE_SENUM: @@ -1152,7 +1165,7 @@ output_FNB (char mode, struct entry *e) p++; l1 %= 7; l2 %= 7; - fprintf (outfile, "e%s_%s%lld,e%s_%s%lld", + fprintf (outfile, "e%s_%s%" COMPAT_PRLL "d,e%s_%s%" COMPAT_PRLL "d", p, l1 < 3 ? "m" : "", l1 == 3 ? 0LL : e->type->maxval - (l1 & 3), p, l2 < 3 ? "m" : "", @@ -1161,13 +1174,14 @@ output_FNB (char mode, struct entry *e) case TYPE_PTR: l1 %= 256; l2 %= 256; - fprintf (outfile, "(%s)&intarray[%lld],(%s)&intarray[%lld]", + fprintf (outfile, + "(%s)&intarray[%" COMPAT_PRLL "d], (%s)&intarray[%" COMPAT_PRLL "d]", e->type->name, l1, e->type->name, l2); break; case TYPE_FNPTR: l1 %= 10; l2 %= 10; - fprintf (outfile, "fn%lld,fn%lld", l1, l2); + fprintf (outfile, "fn%" COMPAT_PRLL "d,fn%" COMPAT_PRLL "d", l1, l2); break; default: abort ();