summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-18 19:42:56 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-02-18 19:42:56 +0000
commit19426fe11f824ba4a15e79cb09934e173b0296ed (patch)
tree7b02cc9cec1f8f91a89897774e64d87b4e3c7b5b
parent4883d82fb515f4d8ddcebdb85763387f69072761 (diff)
downloadgcc-19426fe11f824ba4a15e79cb09934e173b0296ed.tar.gz
PR pch/54117
* c-opts.c (c_common_post_options): If debug info is enabled and non-dwarf*, refuse to load PCH files and when writing PCH file warn. * lib/dg-pch.exp (pch-init, pch-finish, check_effective_target_pch_supported_debug): New procs. (dg-flags-pch): If $pch_unsupported, make tests UNSUPPORTED. Likewise if $pch_unsupported_debug and $flags include -g. Skip FAILs about missing *.gch file if $pch_unsupported_debug and dg-require-effective-target pch_unsupported_debug. * g++.dg/pch/pch.exp: Call pch-init and pch-finish. * objc.dg/pch/pch.exp: Likewise. * gcc.dg/pch/pch.exp: Likewise. * gcc.dg/pch/valid-1.c: Add dg-require-effective-target pch_unsupported_debug. * gcc.dg/pch/valid-1.hs: Likewise. * gcc.dg/pch/valid-1b.c: Likewise. * gcc.dg/pch/valid-1b.hs: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196124 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-opts.c10
-rw-r--r--gcc/testsuite/ChangeLog18
-rw-r--r--gcc/testsuite/g++.dg/pch/pch.exp2
-rw-r--r--gcc/testsuite/gcc.dg/pch/pch.exp2
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1.hs1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1b.c1
-rw-r--r--gcc/testsuite/gcc.dg/pch/valid-1b.hs1
-rw-r--r--gcc/testsuite/lib/dg-pch.exp51
-rw-r--r--gcc/testsuite/objc.dg/pch/pch.exp3
11 files changed, 96 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 16ef84a3634..40b6e556956 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,11 @@
+2013-02-18 Jakub Jelinek <jakub@redhat.com>
+ Steven Bosscher <steven@gcc.gnu.org>
+
+ PR pch/54117
+ * c-opts.c (c_common_post_options): If debug info is enabled
+ and non-dwarf*, refuse to load PCH files and when writing PCH
+ file warn.
+
2013-02-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/56167
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 1a922a81c35..4b6990a60c1 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -945,6 +945,16 @@ c_common_post_options (const char **pfilename)
because the default address space slot then can't be used
for the output PCH file. */
if (pch_file)
+ {
+ c_common_no_more_pch ();
+ /* Only -g0 and -gdwarf* are supported with PCH, for other
+ debug formats we warn here and refuse to load any PCH files. */
+ if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
+ warning (OPT_Wdeprecated,
+ "the \"%s\" debug format cannot be used with "
+ "pre-compiled headers", debug_type_names[write_symbols]);
+ }
+ else if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
c_common_no_more_pch ();
/* Yuk. WTF is this? I do know ObjC relies on it somewhere. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fe995e8e0ea..8458cce659e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2013-02-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR pch/54117
+ * lib/dg-pch.exp (pch-init, pch-finish,
+ check_effective_target_pch_supported_debug): New procs.
+ (dg-flags-pch): If $pch_unsupported, make tests UNSUPPORTED.
+ Likewise if $pch_unsupported_debug and $flags include -g.
+ Skip FAILs about missing *.gch file if $pch_unsupported_debug
+ and dg-require-effective-target pch_unsupported_debug.
+ * g++.dg/pch/pch.exp: Call pch-init and pch-finish.
+ * objc.dg/pch/pch.exp: Likewise.
+ * gcc.dg/pch/pch.exp: Likewise.
+ * gcc.dg/pch/valid-1.c: Add dg-require-effective-target
+ pch_unsupported_debug.
+ * gcc.dg/pch/valid-1.hs: Likewise.
+ * gcc.dg/pch/valid-1b.c: Likewise.
+ * gcc.dg/pch/valid-1b.hs: Likewise.
+
2013-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/56366
diff --git a/gcc/testsuite/g++.dg/pch/pch.exp b/gcc/testsuite/g++.dg/pch/pch.exp
index 0c5e13319ee..db67c24f5b9 100644
--- a/gcc/testsuite/g++.dg/pch/pch.exp
+++ b/gcc/testsuite/g++.dg/pch/pch.exp
@@ -23,6 +23,7 @@ load_lib dg-pch.exp
# Initialize `dg'.
dg-init
+pch-init
set old_dg_do_what_default "${dg-do-what-default}"
@@ -36,4 +37,5 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] {
set dg-do-what-default "$old_dg_do_what_default"
# All done.
+pch-finish
dg-finish
diff --git a/gcc/testsuite/gcc.dg/pch/pch.exp b/gcc/testsuite/gcc.dg/pch/pch.exp
index 4144243a7a1..7bf64df172c 100644
--- a/gcc/testsuite/gcc.dg/pch/pch.exp
+++ b/gcc/testsuite/gcc.dg/pch/pch.exp
@@ -26,6 +26,7 @@ load_lib torture-options.exp
dg-init
torture-init
set-torture-options $DG_TORTURE_OPTIONS
+pch-init
set old_dg_do_what_default "${dg-do-what-default}"
@@ -59,5 +60,6 @@ file delete $testh
set dg-do-what-default "$old_dg_do_what_default"
# All done.
+pch-finish
torture-finish
dg-finish
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.c b/gcc/testsuite/gcc.dg/pch/valid-1.c
index b7f22d0dc17..d445c47d6f3 100644
--- a/gcc/testsuite/gcc.dg/pch/valid-1.c
+++ b/gcc/testsuite/gcc.dg/pch/valid-1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g" } */
#include "valid-1.h"/* { dg-warning "created with -gnone, but used with -g" } */
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1.hs b/gcc/testsuite/gcc.dg/pch/valid-1.hs
index e1ed11df4cc..20d9f65dd72 100644
--- a/gcc/testsuite/gcc.dg/pch/valid-1.hs
+++ b/gcc/testsuite/gcc.dg/pch/valid-1.hs
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g0" } */
extern int x;
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1b.c b/gcc/testsuite/gcc.dg/pch/valid-1b.c
index a2709967c07..3113d0f744d 100644
--- a/gcc/testsuite/gcc.dg/pch/valid-1b.c
+++ b/gcc/testsuite/gcc.dg/pch/valid-1b.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g0" } */
#include "valid-1b.h"
diff --git a/gcc/testsuite/gcc.dg/pch/valid-1b.hs b/gcc/testsuite/gcc.dg/pch/valid-1b.hs
index 6dc358735a7..93b2256e355 100644
--- a/gcc/testsuite/gcc.dg/pch/valid-1b.hs
+++ b/gcc/testsuite/gcc.dg/pch/valid-1b.hs
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target pch_supported_debug } */
/* { dg-options "-I. -Winvalid-pch -g" } */
extern int x;
diff --git a/gcc/testsuite/lib/dg-pch.exp b/gcc/testsuite/lib/dg-pch.exp
index d6a55d89e12..1b3591a7506 100644
--- a/gcc/testsuite/lib/dg-pch.exp
+++ b/gcc/testsuite/lib/dg-pch.exp
@@ -16,8 +16,49 @@
load_lib copy-file.exp
+proc pch-init { args } {
+ global pch_unsupported_debug pch_unsupported
+
+ if [info exists pch_unsupported_debug] {
+ error "pch-init: pch_unsupported_debug is not empty as expected"
+ }
+ if [info exists pch_unsupported] {
+ error "pch-init: pch_unsupported is not empty as expected"
+ }
+
+ set result [check_compile pchtest object "int i;" "-g -x c-header"]
+ set pch_unsupported_debug \
+ [regexp "debug format cannot be used with pre-compiled headers" \
+ [lindex $result 0]]
+
+ set pch_unsupported 0
+ if { $pch_unsupported_debug } {
+ verbose -log "pch is unsupported with the debug info format"
+
+ set result [check_compile pchtest object "int i;" "-x c-header"]
+ set pch_unsupported \
+ [regexp "debug format cannot be used with pre-compiled headers" \
+ [lindex $result 0]]
+ }
+}
+
+proc pch-finish { args } {
+ global pch_unsupported_debug pch_unsupported
+ unset pch_unsupported_debug
+ unset pch_unsupported
+}
+
+proc check_effective_target_pch_supported_debug { } {
+ global pch_unsupported_debug
+ if { $pch_unsupported_debug } {
+ return 0
+ }
+ return 1
+}
+
proc dg-flags-pch { subdir test otherflags options suffix } {
global runtests dg-do-what-default
+ global pch_unsupported_debug pch_unsupported
# If we're only testing specific files and this isn't one of them, skip it.
if ![runtest_file_p $runtests $test] {
@@ -35,6 +76,13 @@ proc dg-flags-pch { subdir test otherflags options suffix } {
foreach flags $options {
verbose "Testing $nshort, $otherflags $flags" 1
+ if { $pch_unsupported != 0 \
+ || ( $pch_unsupported_debug != 0 && [regexp " -g" " $flags"] ) } {
+ verbose -log "$nshort unsupported because debug format conflicts with PCH"
+ unsupported "$nshort $flags"
+ continue
+ }
+
# For the header files, the default is to precompile.
set dg-do-what-default precompile
catch { file_on_host delete "$bname$suffix" }
@@ -78,7 +126,8 @@ proc dg-flags-pch { subdir test otherflags options suffix } {
fail "$nshort $flags assembly comparison"
}
}
- } else {
+ } elseif { $pch_unsupported_debug == 0 \
+ || [llength [grep $test "{\[ \t\]\+dg-require-effective-target\[ \t\]\+pch_supported_debug\[ \t\]\+.*\[ \t\]\+}"]] > 0 } {
verbose -log "pch file '$bname$suffix.gch' missing"
fail "$nshort $flags"
if { !$have_errs } {
diff --git a/gcc/testsuite/objc.dg/pch/pch.exp b/gcc/testsuite/objc.dg/pch/pch.exp
index 90b5b17d2a9..e380390bba6 100644
--- a/gcc/testsuite/objc.dg/pch/pch.exp
+++ b/gcc/testsuite/objc.dg/pch/pch.exp
@@ -24,8 +24,8 @@ load_lib torture-options.exp
# Initialize `dg'.
dg-init
-
torture-init
+pch-init
set-torture-options $DG_TORTURE_OPTIONS
@@ -59,5 +59,6 @@ if [istarget "*-*-darwin*" ] {
set dg-do-what-default "$old_dg_do_what_default"
# All done.
+pch-finish
torture-finish
dg-finish