This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fix struct-layout-1 tests for Xtensa


With the default compile options, Xtensa has some limitations on code size that are exceeded by the struct-layout-1 tests. Someday I hope to fix those limitations, but in the meantime, I'm getting tired of watching these tests fail. For the g++.dg version of the test, it is easy to just add a dg-options line for Xtensa targets. The gcc.dg version is missing Uros Bizjak's change for the g++.dg version (http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00607.html) to avoid replicating the dg-options lines 3 times each, so I've ported that change over to the C version and then added the Xtensa options.

I tested this patch by doing an i686-pc-linux-gnu bootstrap and then running the C and C++ testsuites. I verified that there were no regressions related to this change and that all the struct-layout-1 tests ran as expected.

OK to commit?

testsuite/ChangeLog
2008-10-06  Bob Wilson  <bob.wilson@acm.org>

        * gcc.dg/compat/struct-layout-1_generate.c (dg_options): New.  Moved
        dg-options lines to this array, and added options for xtensa*-*-*.
        (NDG_OPTIONS): Define.
        (switchfiles): Print dg-options lines from new dg_options array.
        * g++.dg/compat/struct-layout-1_generate.c (dg_options): Add options
        for xtensa*-*-* targets.
Index: gcc.dg/compat/struct-layout-1_generate.c
===================================================================
--- gcc.dg/compat/struct-layout-1_generate.c	(revision 140914)
+++ gcc.dg/compat/struct-layout-1_generate.c	(working copy)
@@ -1,5 +1,5 @@
 /* Structure layout test generator.
-   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>.
 
 This file is part of GCC.
@@ -42,6 +42,14 @@
 #define COMPAT_PRLL "ll"
 #endif
 
+const char *dg_options[] = {
+"/* { dg-options \"%s-I%s\" } */\n",
+"/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* *-*-darwin* *-*-mingw32* *-*-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]))
+};
+
 typedef unsigned int hashval_t;
 
 enum TYPE
@@ -747,6 +755,8 @@
 {
   static int filecnt;
   static char *destbuf, *destptr;
+  int i;
+
   ++filecnt;
   if (outfile)
     fclose (outfile);
@@ -774,11 +784,10 @@
       fputs ("failed to create test files\n", stderr);
       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-require-effective-target int32plus } */\n\
-/* { dg-options \"-I%s\" } */\n\
-/* { dg-options \"-I%s -fno-common\" { target hppa*-*-hpux* *-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n\
-/* { dg-options \"-I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
 #include \"struct-layout-1.h\"\n\
 \n\
 #define TX(n, type, attrs, fields, ops) extern void test##n (void);\n\
@@ -796,33 +805,31 @@
       abort ();\n\
     }\n\
   exit (0);\n\
-}\n", srcdir_safe, srcdir_safe, srcdir_safe, filecnt, filecnt);
+}\n", filecnt, filecnt);
   fclose (outfile);
   sprintf (destptr, "t%03d_x.c", filecnt);
   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 -I%s\" } */\n\
-/* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* *-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n\
-/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
 #include \"struct-layout-1_x1.h\"\n\
 #include \"t%03d_test.h\"\n\
 #include \"struct-layout-1_x2.h\"\n\
-#include \"t%03d_test.h\"\n", srcdir_safe, srcdir_safe, srcdir_safe, filecnt, filecnt);
+#include \"t%03d_test.h\"\n", filecnt, filecnt);
   fclose (outfile);
   sprintf (destptr, "t%03d_y.c", filecnt);
   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 -I%s\" } */\n\
-/* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* *-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n\
-/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
 #include \"struct-layout-1_y1.h\"\n\
 #include \"t%03d_test.h\"\n\
 #include \"struct-layout-1_y2.h\"\n\
-#include \"t%03d_test.h\"\n", srcdir_safe, srcdir_safe, srcdir_safe, filecnt, filecnt);
+#include \"t%03d_test.h\"\n", filecnt, filecnt);
   fclose (outfile);
   sprintf (destptr, "t%03d_test.h", filecnt);
   outfile = fopen (destbuf, "w");
Index: g++.dg/compat/struct-layout-1_generate.c
===================================================================
--- g++.dg/compat/struct-layout-1_generate.c	(revision 140914)
+++ g++.dg/compat/struct-layout-1_generate.c	(working copy)
@@ -46,7 +46,8 @@
 "/* { dg-options \"%s-I%s\" } */\n",
 "/* { dg-options \"%s-I%s -mno-mmx\" { target i?86-*-* x86_64-*-* } } */\n",
 "/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* } } */\n",
-"/* { dg-options \"%s-I%s -mno-base-addresses\" { target mmix-*-* } } */\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]))
 };
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]