[testsuite] prune warnings in compat tests

Janis Johnson janis187@us.ibm.com
Thu Mar 19 22:38:00 GMT 2009


Back in http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00945.html Jakub
had most of the following patch to ignore warnings from older compilers
used in compat tests.  This adds support for dg-prune to compat tests
and, for the struct-layout-1 tests, ignores warnings about unknown
option -Wno-abi.  It also ignores a warning about a 4.4 ABI change for
packed bitfields that shows up for t178 from the struct-layout-1 tests,
which is only generated and run when RUN_ALL_COMPAT_TESTS is defined.
The prune lets the test ignore the warning, but it's still in the log
output to provide information about why the test fails when used with
an older compiler.

Tested on powerpc64-linux with -m32/-m64 for C and C++ with
RUN_ALL_COMPAT_TESTS defined and using GCC 4.3.3 as ALT_CC_UNDER_TEST
and ALT_CXX_UNDER_TEST.  Checked in on trunk.

2009-03-19  Jakub Jelinek  <jakub@redhat.com>
	    Janis Johnson  <janis187@us.ibm.com>

	* lib/compat.exp (compat-get-options-main, compat-get-options):
	Handle dg-prune-output in source file.
	* lib/gcc-defs.exp (${tool}_check_compile): Process prune requests.
	* gcc.dg/compat/struct-layout-1_main.c: Use dg-prune for warning.
	* gcc.dg/compat/struct-layout-1_generate.c: Use -Wno-abi, prune
	two warnings.

Index: gcc/testsuite/lib/compat.exp
===================================================================
--- gcc/testsuite/lib/compat.exp	(revision 144923)
+++ gcc/testsuite/lib/compat.exp	(working copy)
@@ -170,6 +170,7 @@ proc compat-get-options-main { src } {
     foreach op $tmp {
 	set cmd [lindex $op 0]
 	if { ![string compare "dg-options" $cmd] \
+	     || [string match "dg-prune-output" $cmd] \
 	     || [string match "dg-skip-if" $cmd] \
 	     || [string match "dg-require-*" $cmd]  } {
 	    set status [catch "$op" errmsg]
@@ -215,6 +216,7 @@ proc compat-get-options { src } {
     foreach op $tmp {
 	set cmd [lindex $op 0]
 	if { ![string compare "dg-options" $cmd] \
+	     || ![string compare "dg-prune-output" $cmd] \
 	     || ![string compare "dg-xfail-if" $cmd] } {
 	    set status [catch "$op" errmsg]
 	    if { $status != 0 } {
Index: gcc/testsuite/lib/gcc-defs.exp
===================================================================
--- gcc/testsuite/lib/gcc-defs.exp	(revision 144923)
+++ gcc/testsuite/lib/gcc-defs.exp	(working copy)
@@ -49,6 +49,11 @@ proc ${tool}_check_compile {testcase opt
 
     set gcc_output [prune_warnings $gcc_output]
 
+    if { [info proc ${tool}-dg-prune] != "" } {
+	global target_triplet
+	set gcc_output [${tool}-dg-prune $target_triplet $gcc_output]
+    }
+
     set unsupported_message [${tool}_check_unsupported_p $gcc_output]
     if { $unsupported_message != "" } {
 	unsupported "$testcase: $unsupported_message"
Index: gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c
===================================================================
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c	(revision 144923)
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c	(working copy)
@@ -1,3 +1,5 @@
+/* { dg-prune-output ".*-Wno-abi.*" } */
+
 #include "struct-layout-1.h"
 
 #define TX(n, type, attrs, fields, ops) extern void test##n (void);
Index: gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
===================================================================
--- gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c	(revision 144923)
+++ gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c	(working copy)
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3.  
 
 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* } } */\n",
@@ -789,6 +790,8 @@ switchfiles (int fields)
   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-prune-output \".*-Wno-abi.*\" } */\n");
+  fprintf (outfile, "/* { dg-prune-output \".*Offset of packed bit-field.*\" } */\n");
   fprintf (outfile, "\
 #include \"struct-layout-1.h\"\n\
 \n\




More information about the Gcc-patches mailing list