struct-layout-1_generate.c (main): Generate a call to fflush(stdout) before abort.

2004-11-05  Danny Smith  <dannysmith@users.sourceforge.net>

	* gcc.dg/compat/struct-layout-1_generate.c (main): Generate a
	call to fflush(stdout) before abort.
	(my_ffsll): New function.
	(generate_fields): Use it.

From-SVN: r90155
This commit is contained in:
Danny Smith 2004-11-06 00:32:18 +00:00 committed by Janis Johnson
parent bc54e9de0c
commit 637022d945
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2004-11-05 Danny Smith <dannysmith@users.sourceforge.net>
* gcc.dg/compat/struct-layout-1_generate.c (main): Generate a
call to fflush(stdout) before abort.
(my_ffsll): New function.
(generate_fields): Use it.
2004-11-05 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/init-undef-1.c: New test.

View File

@ -563,7 +563,10 @@ int main (void)\n\
#include \"t%03d_test.h\"\n\
#undef TX\n\
if (fails)\n\
abort ();\n\
{\n\
fflush (stdout);\n\
abort ();\n\
}\n\
exit (0);\n\
}\n", srcdir, srcdir, filecnt, filecnt);
fclose (outfile);
@ -1198,6 +1201,20 @@ choose_type (enum FEATURE features, struct entry *e, int r)
abort ();
}
/* This is from gcc.c-torture/execute/builtin-bitops-1.c. */
static int
my_ffsll (unsigned long long x)
{
int i;
if (x == 0)
return 0;
/* We've tested LLONG_MAX for 64 bits so this should be safe. */
for (i = 0; i < 64; i++)
if (x & (1ULL << i))
break;
return i + 1;
}
void
generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
int len)
@ -1310,9 +1327,9 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
case 'B': ma = 1; break;
case ' ':
if (e[j].type->type == TYPE_UENUM)
mi = ffsll (e[j].type->maxval + 1) - 1;
mi = my_ffsll (e[j].type->maxval + 1) - 1;
else if (e[j].type->type == TYPE_SENUM)
mi = ffsll (e[j].type->maxval + 1);
mi = my_ffsll (e[j].type->maxval + 1);
else
abort ();
if (!mi)