Commit 637022d9 by Danny Smith Committed by Janis Johnson

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
parent bc54e9de
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> 2004-11-05 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/init-undef-1.c: New test. * gcc.dg/init-undef-1.c: New test.
......
...@@ -563,7 +563,10 @@ int main (void)\n\ ...@@ -563,7 +563,10 @@ int main (void)\n\
#include \"t%03d_test.h\"\n\ #include \"t%03d_test.h\"\n\
#undef TX\n\ #undef TX\n\
if (fails)\n\ if (fails)\n\
{\n\
fflush (stdout);\n\
abort ();\n\ abort ();\n\
}\n\
exit (0);\n\ exit (0);\n\
}\n", srcdir, srcdir, filecnt, filecnt); }\n", srcdir, srcdir, filecnt, filecnt);
fclose (outfile); fclose (outfile);
...@@ -1198,6 +1201,20 @@ choose_type (enum FEATURE features, struct entry *e, int r) ...@@ -1198,6 +1201,20 @@ choose_type (enum FEATURE features, struct entry *e, int r)
abort (); 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 void
generate_fields (enum FEATURE features, struct entry *e, struct entry *parent, generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
int len) int len)
...@@ -1310,9 +1327,9 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent, ...@@ -1310,9 +1327,9 @@ generate_fields (enum FEATURE features, struct entry *e, struct entry *parent,
case 'B': ma = 1; break; case 'B': ma = 1; break;
case ' ': case ' ':
if (e[j].type->type == TYPE_UENUM) 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) else if (e[j].type->type == TYPE_SENUM)
mi = ffsll (e[j].type->maxval + 1); mi = my_ffsll (e[j].type->maxval + 1);
else else
abort (); abort ();
if (!mi) if (!mi)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment