[PATCH] Add -Wno-abi in c++ struct-layout-1 tests

Jakub Jelinek jakub@redhat.com
Thu Sep 25 07:43:00 GMT 2014


On Thu, Sep 25, 2014 at 09:29:52AM +0200, Uros Bizjak wrote:
> Hello!
> 
> > I've noticed that lots of g++ struct-layout-1.exp tests now fail
> > on ppc*.  The problem is the psABI warning:
> > the layout of aggregates containing vectors with N-byte alignment
> > For various targets we are using -Wno-abi (and, in C
> > struct-layout-1.exp also by default) for this, so the patch just
> > changes the default for C++ testing too.
> 
>  const char *dg_options[] = {
> -"/* { dg-options \"%s-I%s\" } */\n",
> +"/* { dg-options \"%s-I%s -Wno-abi\" } */\n",
>  "/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-*
> x86_64-*-* } } */\n",
>  "/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux*
> powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n",
>  "/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target
> i?86-*-darwin* x86_64-*-darwin* i?86-*-mingw32* x86_64-*-mingw32*
> i?86-*-cygwin* } } */\n",
> 
> IMO, these should be converted to dg-additional-options.

That would be something like following, except that compat framework doesn't
support dg-additional-options:
WARNING: compat.exp does not support dg-additional-options

--- gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c.jj	2012-03-14 09:39:37.000000000 +0100
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c	2014-09-25 09:37:07.430959359 +0200
@@ -43,16 +43,12 @@ along with GCC; see the file COPYING3.
 #define COMPAT_PRLL "ll"
 #endif
 
-const char *dg_options[] = {
-"/* { dg-options \"%s-I%s\" } */\n",
-"/* { dg-options \"%s-I%s -Wno-abi\" } */\n",
-"/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n",
-"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* } } */\n",
-"/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* } } */\n",
-"/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\n",
-"/* { dg-options \"%s-I%s -mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n"
-#define NDG_OPTIONS (sizeof (dg_options) / sizeof (dg_options[0]))
-};
+const char dg_options[] =
+"/* { dg-options \"%s-I%s -Wno-abi\" } */\n"
+"/* { dg-additional-options \"-mno-mmx\" { target i?86-*-* x86_64-*-* } } */\n"
+"/* { dg-additional-options \"-fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n"
+"/* { dg-additional-options \"-mno-base-addresses\" { target mmix-*-* } } */\n"
+"/* { dg-additional-options \"-mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n";
 
 typedef unsigned int hashval_t;
 
@@ -759,7 +755,6 @@ switchfiles (int fields)
 {
   static int filecnt;
   static char *destbuf, *destptr;
-  int i;
 
   ++filecnt;
   if (outfile)
@@ -789,8 +784,7 @@ switchfiles (int fields)
       exit (1);
     }
   fprintf (outfile, "/* { dg-require-effective-target int32plus } */\n");
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "", srcdir_safe);
+  fprintf (outfile, dg_options, "", srcdir_safe);
   fprintf (outfile, "/* { dg-prune-output \".*-Wno-abi.*\" } */\n");
   fprintf (outfile, "/* { dg-prune-output \".*Offset of packed bit-field.*\" } */\n");
   fprintf (outfile, "\
@@ -817,8 +811,7 @@ int main (void)\n\
   outfile = fopen (destbuf, "w");
   if (outfile == NULL)
     goto fail;
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "-w ", srcdir_safe);
+  fprintf (outfile, dg_options, "-w ", srcdir_safe);
   fprintf (outfile, "\
 #include \"struct-layout-1_x1.h\"\n\
 #include \"t%03d_test.h\"\n\
@@ -829,8 +822,7 @@ int main (void)\n\
   outfile = fopen (destbuf, "w");
   if (outfile == NULL)
     goto fail;
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "-w ", srcdir_safe);
+  fprintf (outfile, dg_options, "-w ", srcdir_safe);
   fprintf (outfile, "\
 #include \"struct-layout-1_y1.h\"\n\
 #include \"t%03d_test.h\"\n\
--- gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c.jj	2014-09-24 11:07:50.000000000 +0200
+++ gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c	2014-09-25 09:36:00.371312897 +0200
@@ -43,15 +43,12 @@ along with GCC; see the file COPYING3.
 #define COMPAT_PRLL "ll"
 #endif
 
-const char *dg_options[] = {
-"/* { dg-options \"%s-I%s\" } */\n",
-"/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n",
-"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n",
-"/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* i?86-*-mingw32* x86_64-*-mingw32* i?86-*-cygwin* } } */\n",
-"/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\n",
-"/* { dg-options \"%s-I%s -mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n"
-#define NDG_OPTIONS (sizeof (dg_options) / sizeof (dg_options[0]))
-};
+const char dg_options[] =
+"/* { dg-options \"%s-I%s -Wno-abi\" } */\n"
+"/* { dg-additional-options \"-mno-mmx\" { target i?86-*-* x86_64-*-* } } */\n"
+"/* { dg-additional-options \"-fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n"
+"/* { dg-additional-options \"-mno-base-addresses\" { target mmix-*-* } } */\n"
+"/* { dg-additional-options \"-mlongcalls -mtext-section-literals\" { target xtensa*-*-* } } */\n";
 
 typedef unsigned int hashval_t;
 
@@ -506,7 +503,6 @@ switchfiles (int fields)
 {
   static int filecnt;
   static char *destbuf, *destptr;
-  int i;
 
   ++filecnt;
   if (outfile)
@@ -535,8 +531,7 @@ switchfiles (int fields)
       fputs ("failed to create test files\n", stderr);
       exit (1);
     }
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "", srcdir_safe);
+  fprintf (outfile, dg_options, "", srcdir_safe);
   fprintf (outfile, "\n\
 #include \"struct-layout-1.h\"\n\
 \n\
@@ -561,8 +556,7 @@ int main (void)\n\
   outfile = fopen (destbuf, "w");
   if (outfile == NULL)
     goto fail;
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "-w ", srcdir_safe);
+  fprintf (outfile, dg_options, "-w ", srcdir_safe);
   fprintf (outfile, "\n\
 #include \"struct-layout-1_x1.h\"\n\
 #include \"t%03d_test.h\"\n\
@@ -573,8 +567,7 @@ int main (void)\n\
   outfile = fopen (destbuf, "w");
   if (outfile == NULL)
     goto fail;
-  for (i = 0; i < NDG_OPTIONS; i++)
-    fprintf (outfile, dg_options[i], "-w ", srcdir_safe);
+  fprintf (outfile, dg_options, "-w ", srcdir_safe);
   fprintf (outfile, "\n\
 #include \"struct-layout-1_y1.h\"\n\
 #include \"t%03d_test.h\"\n\


	Jakub



More information about the Gcc-patches mailing list