From patchwork Fri Feb 15 15:08:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 220758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 360DD2C0085 for ; Sat, 16 Feb 2013 02:08:57 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361545738; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=qGlVLnKWUXdS5u2cjfCLinoF8OE=; b=wTMMNtXybEzHdhi GZTERxtB+vS0Kza3epmkq9m35vLs16VZix0ZKG511Iz9HVWfujnz3QXNE9enLap/ ePEv6CGnp8Uz9Sba1nQczL3ehBg7ICs2SF93CJ53oOTJJa4qNQPPME8Lhv/4wF/G vO+LpWs4doPp0JC437xIntUyQrgk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fbQjanDpL5linsHuasdBj9S5ATV/VTaZLfITQQOZRmXnkHLtT152kK4OI06juW rFdhz3kDaCApyFh52blrZDCsoTRxqYVs6lViK3qoUXgMKr7vezHy9mwtKTdtXpcC MRaLhZir/zEMKRue/54Zco+auCY86Wj3PKe37VBM7vEmw=; Received: (qmail 31040 invoked by alias); 15 Feb 2013 15:08:45 -0000 Received: (qmail 31025 invoked by uid 22791); 15 Feb 2013 15:08:44 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Feb 2013 15:08:21 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1FF8IKZ023066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 15 Feb 2013 10:08:18 -0500 Received: from zalov.redhat.com (vpn1-6-103.ams2.redhat.com [10.36.6.103]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1FF8F7s019536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 15 Feb 2013 10:08:16 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id r1FF8Eb9020837; Fri, 15 Feb 2013 16:08:14 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r1FF8Dte020836; Fri, 15 Feb 2013 16:08:13 +0100 Date: Fri, 15 Feb 2013 16:08:13 +0100 From: Jakub Jelinek To: Jeff Law Cc: Steven Bosscher , John David Anglin , David Edelsohn , GCC Patches , John David Anglin , rupp@gnat.com, "Joseph S. Myers" Subject: [PATCH] Disable PCH for -g other than dwarf[234] (PR pch/54117, take 2) Message-ID: <20130215150813.GR1215@tucnak.zalov.cz> Reply-To: Jakub Jelinek References: <20130213155423.GW4385@tucnak.redhat.com> <20130213234849.GB1215@tucnak.zalov.cz> <20130214105212.GE1215@tucnak.zalov.cz> <511CDD39.4050906@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <511CDD39.4050906@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Thu, Feb 14, 2013 at 05:48:57AM -0700, Jeff Law wrote: > I think two tests should be sufficient. First, compile a simple > program with -g and verify it generates dwarf2 debug records. > Second verify that there aren't any -g options, unless is > dwarf2. > > I'm actually on PTO today/tomorrow, so I won't be able to look > further at this until Monday. > > If someone wants to run with it, my recommendation would be Steven's > warning patch, moved to the location Jakub suggests so that users > know stabs+PCH is going away plus a hack to the testsuite suite > similar to what I outlined above plus something to either suppress > creation of the pch or suppress reading the PCH in the presence of > non-dwarf debug output. Here is what seems to work for me. Tested with make check -j4 -k RUNTESTFLAGS='--target_board=unix\{-m32,-m32/-gstabs,-m64,-m64/-gstabs\} pch.exp' on x86_64-linux, both with gcc just with this patch and also this patch + changed PREFERRED_DEBUGGING_TYPE to DBX_DEBUG. No FAILs at all, tests that wouldn't work because either -gstabs is forced in the flags from target board or tests that would be compiled with -g when stabs is the default are UNSUPPORTED. 2013-02-15 Jakub Jelinek Steven Bosscher 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. Jakub --- 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 (); /* 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 @@ 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 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 + } + # 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;