struct-layout-1_generate.c (COMPAT_PRLL): Define and use throughout as long long printf format specifier.

* 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.

From-SVN: r126903
This commit is contained in:
Danny Smith 2007-07-25 07:34:52 +00:00 committed by Danny Smith
parent f4f29b5998
commit 1990791dc7
3 changed files with 50 additions and 18 deletions

View File

@ -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

View File

@ -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 ();

View File

@ -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 ();