2013-02-15 19:17:57 +00:00
|
|
|
2013-02-15 Jakub Jelinek <jakub@redhat.com>
|
|
|
|
Steven Bosscher <steven@gcc.gnu.org>
|
2013-02-13 22:32:18 +00:00
|
|
|
|
|
|
|
PR pch/54117
|
2013-02-15 19:17:57 +00:00
|
|
|
* 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-13 22:32:18 +00:00
|
|
|
|
2013-02-15 19:17:57 +00:00
|
|
|
* 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-13 22:32:18 +00:00
|
|
|
|
2013-02-15 19:17:57 +00:00
|
|
|
--- gcc/c-family/c-opts.c.jj 2013-02-14 14:45:01.000000000 +0100
|
|
|
|
+++ gcc/c-family/c-opts.c 2013-02-15 12:44:48.936535118 +0100
|
|
|
|
@@ -945,6 +945,16 @@ c_common_post_options (const char **pfil
|
|
|
|
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 ();
|
2013-02-13 22:32:18 +00:00
|
|
|
|
2013-02-15 19:17:57 +00:00
|
|
|
/* Yuk. WTF is this? I do know ObjC relies on it somewhere. */
|
|
|
|
--- gcc/testsuite/lib/dg-pch.exp.jj 2013-01-11 09:02:39.000000000 +0100
|
|
|
|
+++ gcc/testsuite/lib/dg-pch.exp 2013-02-15 15:45:53.747855529 +0100
|
|
|
|
@@ -16,8 +16,49 @@
|
2013-02-13 22:32:18 +00:00
|
|
|
|
2013-02-15 19:17:57 +00:00
|
|
|
load_lib copy-file.exp
|
2013-02-13 22:32:18 +00:00
|
|
|
|
2013-02-15 19:17:57 +00:00
|
|
|
+proc pch-init { args } {
|
|
|
|
+ global pch_unsupported_debug pch_unsupported
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+ 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"
|
2013-02-13 22:32:18 +00:00
|
|
|
+ }
|
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+ 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]]
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+ set pch_unsupported 0
|
|
|
|
+ if { $pch_unsupported_debug } {
|
|
|
|
+ verbose -log "pch is unsupported with the debug info format"
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+ 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]]
|
2013-02-13 22:32:18 +00:00
|
|
|
+ }
|
2013-02-15 19:17:57 +00:00
|
|
|
+}
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+proc pch-finish { args } {
|
|
|
|
+ global pch_unsupported_debug pch_unsupported
|
|
|
|
+ unset pch_unsupported_debug
|
|
|
|
+ unset pch_unsupported
|
|
|
|
+}
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
+proc check_effective_target_pch_supported_debug { } {
|
|
|
|
+ global pch_unsupported_debug
|
|
|
|
+ if { $pch_unsupported_debug } {
|
|
|
|
+ return 0
|
2013-02-13 22:32:18 +00:00
|
|
|
+ }
|
2013-02-15 19:17:57 +00:00
|
|
|
+ return 1
|
|
|
|
+}
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
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 otherfla
|
|
|
|
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
|
|
|
|
+ }
|
2013-02-13 22:32:18 +00:00
|
|
|
+
|
2013-02-15 19:17:57 +00:00
|
|
|
# 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 otherfla
|
|
|
|
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 } {
|
|
|
|
--- gcc/testsuite/g++.dg/pch/pch.exp.jj 2013-01-11 09:02:44.000000000 +0100
|
|
|
|
+++ gcc/testsuite/g++.dg/pch/pch.exp 2013-02-15 14:53:03.517106464 +0100
|
|
|
|
@@ -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 $s
|
|
|
|
set dg-do-what-default "$old_dg_do_what_default"
|
|
|
|
|
|
|
|
# All done.
|
|
|
|
+pch-finish
|
|
|
|
dg-finish
|
|
|
|
--- gcc/testsuite/objc.dg/pch/pch.exp.jj 2013-01-11 09:02:44.000000000 +0100
|
|
|
|
+++ gcc/testsuite/objc.dg/pch/pch.exp 2013-02-15 14:53:30.063951051 +0100
|
|
|
|
@@ -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
|
|
|
|
--- gcc/testsuite/gcc.dg/pch/pch.exp.jj 2013-01-11 09:02:42.000000000 +0100
|
|
|
|
+++ gcc/testsuite/gcc.dg/pch/pch.exp 2013-02-15 14:11:27.053896809 +0100
|
|
|
|
@@ -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
|
|
|
|
--- gcc/testsuite/gcc.dg/pch/valid-1.c.jj 2009-06-08 11:53:48.000000000 +0200
|
|
|
|
+++ gcc/testsuite/gcc.dg/pch/valid-1.c 2013-02-15 15:19:44.124833259 +0100
|
|
|
|
@@ -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" } */
|
|
|
|
--- gcc/testsuite/gcc.dg/pch/valid-1.hs.jj 2008-09-05 12:54:26.000000000 +0200
|
|
|
|
+++ gcc/testsuite/gcc.dg/pch/valid-1.hs 2013-02-15 15:19:50.686794340 +0100
|
|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
+/* { dg-require-effective-target pch_supported_debug } */
|
|
|
|
/* { dg-options "-I. -Winvalid-pch -g0" } */
|
|
|
|
|
|
|
|
extern int x;
|
|
|
|
--- gcc/testsuite/gcc.dg/pch/valid-1b.c.jj 2008-09-05 12:54:26.000000000 +0200
|
|
|
|
+++ gcc/testsuite/gcc.dg/pch/valid-1b.c 2013-02-15 15:19:55.935763631 +0100
|
|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
+/* { dg-require-effective-target pch_supported_debug } */
|
|
|
|
/* { dg-options "-I. -Winvalid-pch -g0" } */
|
|
|
|
|
|
|
|
#include "valid-1b.h"
|
|
|
|
--- gcc/testsuite/gcc.dg/pch/valid-1b.hs.jj 2008-09-05 12:54:26.000000000 +0200
|
|
|
|
+++ gcc/testsuite/gcc.dg/pch/valid-1b.hs 2013-02-15 15:20:02.214727794 +0100
|
|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
+/* { dg-require-effective-target pch_supported_debug } */
|
|
|
|
/* { dg-options "-I. -Winvalid-pch -g" } */
|
|
|
|
|
|
|
|
extern int x;
|