From patchwork Fri Jan 15 16:53:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1427154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=YFIwfntZ; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DHS1f5vDJz9sWQ for ; Sat, 16 Jan 2021 03:53:40 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09D8C3986438; Fri, 15 Jan 2021 16:53:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by sourceware.org (Postfix) with ESMTPS id 459C93982438 for ; Fri, 15 Jan 2021 16:53:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 459C93982438 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qk1-x72b.google.com with SMTP id 186so12277142qkj.3 for ; Fri, 15 Jan 2021 08:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=ARCu7sSMP0ytlHO4G1xGK+wmhCGD0H/HGtRXjoNvhGM=; b=YFIwfntZxbVpSFT6E4KNpxpppoQ2xz4r5LptoQgxbt23L8R2K40ygO3QJLyBCSnS8J j9P3+lkUCC+fxOOwck32q654AWq8b7m6q4kEX/7b96U6ESL2t/o+NydGs7jTpjxIEMV8 lfzC8Puc/Oba8E/KBgNIdDt/TKSCSVBMsZAAbmza09FtriAemC+nFXQzbc8lX0OTnxtl PtPAFy3/mAEdAuqlrONTux3x8lOSVyHgVVP+FkBV61Z98JWimudwj/kcYjFAeGunQnFZ FdtxwDsz1PHl/Xc81DYbERWAseBnniHPrZaRtMZ9vuiStME1UwHXd7CwtB00fktJ/ihT iA1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=ARCu7sSMP0ytlHO4G1xGK+wmhCGD0H/HGtRXjoNvhGM=; b=bqSKQiFxVMW8OkfFPG/U+Kw4qU7z618fC10vam8qrDDL+A43NAtPMMOQTf9ILtZWzR IiYOpKwlKrCXvUK0ZA/6G2tQ1epXC5a8f9UVHLXgujsokEL+BWZz3CIFOPsHYQqbxkz+ eBhInxVVcZ45gb319Yml/j/XzkU8NtEOwVv2iOv21kY1TbZ7cvyrBghLQ2xWdypvlanX SpYziCPvTLv9ZbbotU7wWXOXErnRYfr111Dpz/7q9ktoUAvnMqJsCq79BHzwTqvXPhbr xCxB5S0eK1SX4h0jhJvHVGSPg9gPDghFTT7QUf07hAg8wMCKnee52LBWFm7lqPsOIjCN pxuA== X-Gm-Message-State: AOAM532j/EKQhbkGrzFGUaXuvkpFCF6cGoi4vrBxVpKH7Z20U77V6Sob 13IIedoB8aCfJrooY6j70J4= X-Google-Smtp-Source: ABdhPJzxlRdVuchzeUPE11C26+MSRYdOVT/Ye9rWzRxsw3Aj4w75Vjcxbenfs46YnC8vHaiDr7UsYQ== X-Received: by 2002:a37:8e06:: with SMTP id q6mr13587150qkd.402.1610729615728; Fri, 15 Jan 2021 08:53:35 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:94f0:c004:1b13:10bd? ([2620:10d:c091:480::1:b690]) by smtp.googlemail.com with ESMTPSA id c20sm4980638qtj.29.2021.01.15.08.53.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Jan 2021 08:53:34 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: Fix langspecs with -fsyntax-only [PR98591] Message-ID: Date: Fri, 15 Jan 2021 11:53:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" -fsyntax-only is handled specially in the driver and causes it to add '-o /dev/null' (or a suitable OS-specific variant thereof). PCH is handled in the language driver. I'd not sufficiently protected the -fmodule-only action of adding a dummy assembler from the actions of -fsyntax-only, so we ended up with two -o options. PR c++/98591 gcc/cp/ * lang-specs.h: Fix handling of -fmodule-only with -fsyntax-only. diff --git c/gcc/cp/lang-specs.h w/gcc/cp/lang-specs.h index f16279142be..8902ae1d2ed 100644 --- c/gcc/cp/lang-specs.h +++ w/gcc/cp/lang-specs.h @@ -52,9 +52,11 @@ along with GCC; see the file COPYING3. If not see " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" " %{fmodules-ts:-fmodule-header %{fpreprocessed:-fdirectives-only}}" " %(cc1_options) %2" - " %{!S:-o %g.s%V}" - " %{!fsyntax-only:%{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" - " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}}}}", + " %{!fsyntax-only:" + " %{!S:-o %g.s%V}" + " %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" + " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}" + "}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {"@c++-system-header", "%{E|M|MM:cc1plus -E" @@ -68,11 +70,14 @@ along with GCC; see the file COPYING3. If not see " %{fmodules-ts:-fdirectives-only}" " %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}" " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" - " %{fmodules-ts:-fmodule-header=system %{fpreprocessed:-fdirectives-only}}" + " %{fmodules-ts:-fmodule-header=system" + " %{fpreprocessed:-fdirectives-only}}" " %(cc1_options) %2" - " %{!S:-o %g.s%V}" - " %{!fsyntax-only:%{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" - " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}}}}", + " %{!fsyntax-only:" + " %{!S:-o %g.s%V}" + " %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" + " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}" + "}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {"@c++-user-header", "%{E|M|MM:cc1plus -E" @@ -88,9 +93,11 @@ along with GCC; see the file COPYING3. If not see " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" " %{fmodules-ts:-fmodule-header=user %{fpreprocessed:-fdirectives-only}}" " %(cc1_options) %2" - " %{!S:-o %g.s%V}" - " %{!fsyntax-only:%{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" - " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}}}}", + " %{!fsyntax-only:" + " %{!S:-o %g.s%V}" + " %{!fmodule-*:%{!fmodules-*:%{!fdump-ada-spec*:" + " %{!o*:--output-pch=%i.gch}%W{o*:--output-pch=%*}}}}}" + "}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {"@c++", "%{E|M|MM:cc1plus -E %(cpp_options) %2 %(cpp_debug_options)}" @@ -101,13 +108,16 @@ along with GCC; see the file COPYING3. If not see " %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}" " %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}" " %(cc1_options) %2" - " %{fmodule-only:%{!S:-o %g.s%V}}" - " %{!fsyntax-only:%{!fmodule-only:%(invoke_as)}}}}}", + " %{!fsyntax-only:" + " %{fmodule-only:%{!S:-o %g.s%V}}" + " %{!fmodule-only:%(invoke_as)}}" + "}}}", CPLUSPLUS_CPP_SPEC, 0, 0}, {".ii", "@c++-cpp-output", 0, 0, 0}, {"@c++-cpp-output", "%{!E:%{!M:%{!MM:" " cc1plus -fpreprocessed %i %(cc1_options) %2" - " %{fmodule-only:%{!S:-o %g.s%V}}" - " %{!fsyntax-only:%{!fmodule-only:%{!fmodule-header*:" - " %(invoke_as)}}}}}}", 0, 0, 0}, + " %{!fsyntax-only:" + " %{fmodule-only:%{!S:-o %g.s%V}}" + " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}" + "}}}", 0, 0, 0}, diff --git c/gcc/testsuite/g++.dg/modules/pr98591.H w/gcc/testsuite/g++.dg/modules/pr98591.H new file mode 100644 index 00000000000..ad397de2ecb --- /dev/null +++ w/gcc/testsuite/g++.dg/modules/pr98591.H @@ -0,0 +1,3 @@ +// { dg-additional-options {-fmodules-ts -fmodule-header -fsyntax-only} } +// PR 98591 -fsyntax-only -> output filename specified twice +// specs are hard