[RFA:] DejaGNU patch: Change -I to -isystem for testsuite.

Hans-Peter Nilsson <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.sysutils.dejagnu.bugs
Message-ID <[email protected]>
This patch fixes, for uninstalled newlib targets in a unified
tree, the listed spurious GCC testsuite excess-errors.  They
occur because the supposedly-to-be-installed newlib limits.h
uses #include_next.  That directive makes gcc emit a warning
when used in a non-system-header context.  While that can be
"fixed" for non-installed headers by adding "#pragma GCC
system_header", it shouldn't be needed; it'd be better if gcc
treated it as a system header while running the test-suite.
Done by changing -I to -isystem for include directives for the
test-suite.  The -isystem option has been there since at least
gcc-2.7.2 so it should be safe for all uses.  This patch is
against the sources.redhat.com unified-tree repository but the
patch applied fine (with offset) to the savannah.gnu.org DejaGNU
repository.

FAIL: gcc.dg/c90-intconst-1.c (test for excess errors)
FAIL: gcc.dg/c99-intconst-1.c (test for excess errors)
FAIL: g++.dg/abi/bitfield4.C (test for excess errors)
FAIL: g++.benjamin/bool01.C (test for excess errors)
FAIL: g++.benjamin/p12475.C (test for excess errors)
FAIL: g++.jason/rfg10.C (test for excess errors)

BTW, does anybody have an idea why gcc/testsuite/site.exp is
completely ineffective?  Changing s/-I/-isystem/g in the
site.exp in gcc/Makefile.in has no effect; in fact it doesn't
seem to be used at all.

Ok to commit to sources.redhat.com/dejagnu?

dejagnu:
	* lib/libgloss.exp (newlib_include_flags): Use -isystem, not -I.
	(libio_include_flags, g++_include_flags, libstdc++_include_flags,
	winsup_include_flags): Ditto.
	* doc/user.sgml (Local Config File): Use -isystem, not -I, in
	example.

brgds, H-P
is1.txt (text/plain, 4.4 KB)
Index: doc/user.sgml
===================================================================
RCS file: /cvs/src/src/dejagnu/doc/user.sgml,v
retrieving revision 1.2
diff -p -c -u -p -r1.2 user.sgml
--- doc/user.sgml	21 Apr 2002 08:47:03 -0000	1.2
+++ doc/user.sgml	27 Oct 2002 02:35:40 -0000
@@ -879,7 +879,7 @@
       set target_triplet i586-pc-linux-gnulibc1
       set target_alias i586-pc-linux-gnulibc1
       set CFLAGS ""
-      set CXXFLAGS "-I/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libio -I$srcdir/../libg++/src -I$srcdir/../libio -I$srcdir/../libstdc++ -I$srcdir/../libstdc++/stl -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libg++ -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libstdc++"
+      set CXXFLAGS "-isystem /build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libio -isystem $srcdir/../libg++/src -isystem $srcdir/../libio -isystem $srcdir/../libstdc++ -isystem $srcdir/../libstdc++/stl -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libg++ -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libstdc++"
       append LDFLAGS " -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../ld"
       set tmpdir /build/devo-builds/i586-pc-linux-gnulibc1/gcc/testsuite
       set srcdir "${srcdir}/testsuite"
Index: lib/libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.9
diff -p -c -u -p -r1.9 libgloss.exp
--- lib/libgloss.exp	26 Sep 2002 09:50:03 -0000	1.9
+++ lib/libgloss.exp	27 Oct 2002 02:35:40 -0000
@@ -159,7 +159,7 @@ proc newlib_include_flags { args } {
 	if { ${newlib_dir} != "" } {
 	    set newlib_dir [file dirname ${newlib_dir}]
 	}
-	return " -I$gccpath/newlib/targ-include -I${newlib_dir}"
+	return " -isystem $gccpath/newlib/targ-include -isystem ${newlib_dir}"
     } else {
 	verbose "No newlib support for this target"
     }
@@ -191,7 +191,7 @@ proc libio_include_flags { args } {
     if { $libio_bin_dir != "" && $libio_src_dir != "" } {
 	set libio_src_dir [file dirname ${libio_src_dir}]
 	set libio_bin_dir [file dirname ${libio_bin_dir}];
-	return " -I${libio_src_dir} -I${libio_bin_dir}"
+	return " -isystem ${libio_src_dir} -isystem ${libio_bin_dir}"
     } else {
 	return ""
     }
@@ -226,22 +226,23 @@ proc g++_include_flags { args } {
 
     set dir [lookfor_file ${srcdir} libg++]
     if { ${dir} != "" } {
-	append flags " -I${dir} -I${dir}/src"
+	append flags " -isystem ${dir} -isystem ${dir}/src"
     }
 
     set dir [lookfor_file ${srcdir} libstdc++-v3]
     if { ${dir} != "" } {
-	append flags " -I${dir}/include -I${dir}/include/std -I${dir}/include/c_std -I${dir}/libsupc++"
+	append flags " -isystem ${dir}/include -isystem ${dir}/include/std"
+	append flags " -isystem ${dir}/include/c_std -isystem ${dir}/libsupc++"
     }
 
     set dir [lookfor_file ${gccpath} libstdc++-v3]
     if { ${dir} != "" } {
-	append flags " -I${dir}/include -I${dir}/include/${target_alias}"
+	append flags " -isystem ${dir}/include -isystem ${dir}/include/${target_alias}"
     }
 
     set dir [lookfor_file ${srcdir} libstdc++]
     if { ${dir} != "" } {
-	append flags " -I${dir} -I${dir}/stl"
+	append flags " -isystem ${dir} -isystem ${dir}/stl"
     }
 
     return "$flags"
@@ -317,19 +318,20 @@ proc libstdc++_include_flags { args } {
 
     set dir [lookfor_file ${srcdir} libstdc++-v3]
     if { ${dir} != "" } {
-	append flags " -I${dir}/include -I${dir}/include/std -I${dir}/include/c_std -I${dir}/libsupc++"
+	append flags " -isystem ${dir}/include -isystem ${dir}/include/std"
+	append flags " -isystem ${dir}/include/c_std -isystem ${dir}/libsupc++"
     }
 
     set gccpath [get_multilibs]
 
     set dir [lookfor_file ${gccpath} libstdc++-v3]
     if { ${dir} != "" } {
-	append flags " -I${dir}/include -I${dir}/include/${target_alias}"
+	append flags " -isystem ${dir}/include -isystem ${dir}/include/${target_alias}"
     }
 
     set dir [lookfor_file ${srcdir} libstdc++]
     if { ${dir} != "" } {
-	append flags " -I${dir} -I${dir}/stl"
+	append flags " -isystem ${dir} -isystem ${dir}/stl"
     }
 
     return "$flags"
@@ -860,7 +862,7 @@ proc winsup_include_flags { args } {
 	set winsup_dir [lookfor_file ${srcdir} winsup/include/windows.h]
 	if { ${winsup_dir} != "" } {
 	    set winsup_dir [file dirname ${winsup_dir}]
-	    return " -I${winsup_dir}"
+	    return " -isystem ${winsup_dir}"
 	}
     }
     verbose "No winsup support for this target"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.