Commit 5f620f48 by Uros Bizjak Committed by Uros Bizjak

re PR testsuite/36057 (struct-layout-1_generate.c uses non-ISO C '%n$' operand number formats)

	PR testsuite/36057
	* g++.dg/compat/struct-layout-1_generate.c (DG_OPTIONS): Remove.
	(const char *dg_options): New array.
	(switchfiles): Loop through dg_options array to generate dg-options
	directives.  Remove numbered arguments usage from fprintf
	format strings.

From-SVN: r135671
parent 5fb0445d
2008-05-20 Uros Bizjak <ubizjak@gmail.com>
PR testsuite/36057
* g++.dg/compat/struct-layout-1_generate.c (DG_OPTIONS): Remove.
(const char *dg_options): New array.
(switchfiles): Loop through dg_options array to generate dg-options
directives. Remove numbered arguments usage from fprintf
format strings.
2008-05-20 Jan Sjodin <jan.sjodin@amd.com> 2008-05-20 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebastian.pop@amd.com> Sebastian Pop <sebastian.pop@amd.com>
......
...@@ -42,12 +42,13 @@ along with GCC; see the file COPYING3. If not see ...@@ -42,12 +42,13 @@ along with GCC; see the file COPYING3. If not see
#define COMPAT_PRLL "ll" #define COMPAT_PRLL "ll"
#endif #endif
#define DG_OPTIONS "\ const char *dg_options[] = {
/* { dg-options \"%1$s-I%2$s\" } */\n\ "/* { dg-options \"%s-I%s\" } */\n",
/* { dg-options \"%1$s-I%2$s -mno-mmx\" { target i?86-*-* x86_64-*-* } } */\n\ "/* { dg-options \"%s-I%s -mno-mmx\" { target i?86-*-* x86_64-*-* } } */\n",
/* { dg-options \"%1$s-I%2$s -fno-common\" { target hppa*-*-hpux* } } */\n\ "/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* } } */\n",
/* { dg-options \"%1$s-I%2$s -mno-base-addresses\" { target mmix-*-* } } */\n\ "/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\n"
\n" #define NDG_OPTIONS (sizeof (dg_options) / sizeof (dg_options[0]))
};
typedef unsigned int hashval_t; typedef unsigned int hashval_t;
...@@ -501,6 +502,8 @@ switchfiles (int fields) ...@@ -501,6 +502,8 @@ switchfiles (int fields)
{ {
static int filecnt; static int filecnt;
static char *destbuf, *destptr; static char *destbuf, *destptr;
int i;
++filecnt; ++filecnt;
if (outfile) if (outfile)
fclose (outfile); fclose (outfile);
...@@ -528,17 +531,19 @@ switchfiles (int fields) ...@@ -528,17 +531,19 @@ switchfiles (int fields)
fputs ("failed to create test files\n", stderr); fputs ("failed to create test files\n", stderr);
exit (1); exit (1);
} }
fprintf (outfile, DG_OPTIONS "\ for (i = 0; i < NDG_OPTIONS; i++)
fprintf (outfile, dg_options[i], "", srcdir);
fprintf (outfile, "\n\
#include \"struct-layout-1.h\"\n\ #include \"struct-layout-1.h\"\n\
\n\ \n\
#define TX(n, type, attrs, fields, ops) extern void test##n (void);\n\ #define TX(n, type, attrs, fields, ops) extern void test##n (void);\n\
#include \"t%3$03d_test.h\"\n\ #include \"t%03d_test.h\"\n\
#undef TX\n\ #undef TX\n\
\n\ \n\
int main (void)\n\ int main (void)\n\
{\n\ {\n\
#define TX(n, type, attrs, fields, ops) test##n ();\n\ #define TX(n, type, attrs, fields, ops) test##n ();\n\
#include \"t%3$03d_test.h\"\n\ #include \"t%03d_test.h\"\n\
#undef TX\n\ #undef TX\n\
if (fails)\n\ if (fails)\n\
{\n\ {\n\
...@@ -546,27 +551,31 @@ int main (void)\n\ ...@@ -546,27 +551,31 @@ int main (void)\n\
abort ();\n\ abort ();\n\
}\n\ }\n\
exit (0);\n\ exit (0);\n\
}\n", "", srcdir, filecnt); }\n", filecnt, filecnt);
fclose (outfile); fclose (outfile);
sprintf (destptr, "t%03d_x.C", filecnt); sprintf (destptr, "t%03d_x.C", filecnt);
outfile = fopen (destbuf, "w"); outfile = fopen (destbuf, "w");
if (outfile == NULL) if (outfile == NULL)
goto fail; goto fail;
fprintf (outfile, DG_OPTIONS "\ for (i = 0; i < NDG_OPTIONS; i++)
fprintf (outfile, dg_options[i], "-w ", srcdir);
fprintf (outfile, "\n\
#include \"struct-layout-1_x1.h\"\n\ #include \"struct-layout-1_x1.h\"\n\
#include \"t%3$03d_test.h\"\n\ #include \"t%03d_test.h\"\n\
#include \"struct-layout-1_x2.h\"\n\ #include \"struct-layout-1_x2.h\"\n\
#include \"t%3$03d_test.h\"\n", "-w ", srcdir, filecnt); #include \"t%03d_test.h\"\n", filecnt, filecnt);
fclose (outfile); fclose (outfile);
sprintf (destptr, "t%03d_y.C", filecnt); sprintf (destptr, "t%03d_y.C", filecnt);
outfile = fopen (destbuf, "w"); outfile = fopen (destbuf, "w");
if (outfile == NULL) if (outfile == NULL)
goto fail; goto fail;
fprintf (outfile, DG_OPTIONS "\ for (i = 0; i < NDG_OPTIONS; i++)
fprintf (outfile, dg_options[i], "-w ", srcdir);
fprintf (outfile, "\n\
#include \"struct-layout-1_y1.h\"\n\ #include \"struct-layout-1_y1.h\"\n\
#include \"t%3$03d_test.h\"\n\ #include \"t%03d_test.h\"\n\
#include \"struct-layout-1_y2.h\"\n\ #include \"struct-layout-1_y2.h\"\n\
#include \"t%3$03d_test.h\"\n", "-w ", srcdir, filecnt); #include \"t%03d_test.h\"\n", filecnt, filecnt);
fclose (outfile); fclose (outfile);
sprintf (destptr, "t%03d_test.h", filecnt); sprintf (destptr, "t%03d_test.h", filecnt);
outfile = fopen (destbuf, "w"); outfile = fopen (destbuf, "w");
......
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