Message ID | 20230129113451.24516-1-iain@sandoe.co.uk |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D21853858D35 for <patchwork@sourceware.org>; Sun, 29 Jan 2023 11:35:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D21853858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674992122; bh=JTlB4l4ZHHzxzIYJOJrJhPs1tKWEi2Eir3BdxSRHlGo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=bWmWw0akzgoe8FoHrVrHpqbUZYWsmzfABdnHBGHJN8L387nbN2krQCAgkpfKIWh2/ /gepwR4NAL1RqKC9P2L2bQKOdbWzMJ+Hly9hfzW9N64VY9RdWv+gx+sqpNF3vTy+GW 5CqYLVvYg/Iyl6C5ykQFUcQV+dXG7Ld+747+BB4I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 9E1F33858D32 for <gcc-patches@gcc.gnu.org>; Sun, 29 Jan 2023 11:34:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E1F33858D32 Received: by mail-wm1-x32c.google.com with SMTP id bg26so424744wmb.0 for <gcc-patches@gcc.gnu.org>; Sun, 29 Jan 2023 03:34:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JTlB4l4ZHHzxzIYJOJrJhPs1tKWEi2Eir3BdxSRHlGo=; b=fa4DuO8PIYdZjMRqwez8kxEGhLhO06e1wH2sC3rlozsS1xrTDL44DQjN6VkB2dmj79 tEuKZkd4nvEa7xVlkFoCA5qumsRH9AMyoXYQMd+UNHaZ22UYI8d5pMnsIUf1VZ2lIntd vdlaR7eooXQzO04Ay2Kpd3ZtOVWgToiO7uwe+n0zEHBAHljfz0cVt1j26zW8QSiwSpPU pD5mw1NQjtekDUaYKQdKFON6Ho82uNCC/xKLuLVrbd2S/a1So/J7v5kGuQfWyXezULxD sMymYp06fHZ2951t1uNeEvvhphQW8RYEG/htwBI1qFHYn+yTguyeEfURIEkqxL5mM8tM W15g== X-Gm-Message-State: AFqh2konM174SNwNMeNC9Y5jDBBJD8Yrif2EKioG9RDTPO6N+hE7rdHW h0VwSroLIdmogywa4fPqiNnwBV4rNe4= X-Google-Smtp-Source: AMrXdXuqUKzTwRev8msJSL4rpTXMqWKXYQ2gSTAdsoRo6EoPCeaGDSjOiIEttCv7lmv4xymt1jO9jA== X-Received: by 2002:a05:600c:3d16:b0:3cf:8b22:76b3 with SMTP id bh22-20020a05600c3d1600b003cf8b2276b3mr43848225wmb.0.1674992092349; Sun, 29 Jan 2023 03:34:52 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id n5-20020a5d6b85000000b002be2279f100sm778752wrx.96.2023.01.29.03.34.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 29 Jan 2023 03:34:51 -0800 (PST) X-Google-Original-From: Iain Sandoe <iain@sandoe.co.uk> To: gcc-patches@gcc.gnu.org Subject: [PATCH] driver, toplevel: Avoid emitting the version information twice. Date: Sun, 29 Jan 2023 11:34:51 +0000 Message-Id: <20230129113451.24516-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Iain Sandoe via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe <iains.gcc@gmail.com>, joseph@codesourcery.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
driver, toplevel: Avoid emitting the version information twice.
|
|
Commit Message
Iain Sandoe
Jan. 29, 2023, 11:34 a.m. UTC
Technically, this is seems to be a regression somewhere between 4.2 and
4.6 but, it seems, not enough for anyone to care too much. Tested on
various Darwin versions and x86_64, powerpc64 linux,
OK for trunk {now,stage1}?
thanks, Iain
--- 8< ---
For a regular compile job, with -v we emit the GCC version information
twice - once from main() and once from process_options(). We do not need
to emit the former unless the compiler will exit before calling
process_options(), which is controlled by the 'exit_after_options' flag.
Gating the first output on that flag resolves this.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/ChangeLog:
* toplev.cc (toplev::main): Only print the version information from
the toplevel main() if we will exit before processing options.
---
gcc/toplev.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Sun, Jan 29, 2023 at 12:35 PM Iain Sandoe via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Technically, this is seems to be a regression somewhere between 4.2 and > 4.6 but, it seems, not enough for anyone to care too much. Tested on > various Darwin versions and x86_64, powerpc64 linux, > OK for trunk {now,stage1}? This will elide the earlier printing, right? I see > ./cc1 -quiet t.c -version -v GNU C17 (GCC) version 13.0.1 20230130 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.2-p6, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring nonexistent directory "/usr/local/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/include" ignoring nonexistent directory "/usr/local/lib64/gcc/x86_64-pc-linux-gnu/13.0.1/include-fixed" ignoring nonexistent directory "/usr/local/lib64/../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/include End of search list. GNU C17 (GCC) version 13.0.1 20230130 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.5.0, GMP version 6.1.2, MPFR version 4.0.2-p6, MPC version 1.1.0, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 04b9febc760f5d967341e708a5944221 eliding the 2nd would be prefered so the info comes first? > thanks, Iain > > --- 8< --- > > For a regular compile job, with -v we emit the GCC version information > twice - once from main() and once from process_options(). We do not need > to emit the former unless the compiler will exit before calling > process_options(), which is controlled by the 'exit_after_options' flag. > > Gating the first output on that flag resolves this. > > Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> > > gcc/ChangeLog: > > * toplev.cc (toplev::main): Only print the version information from > the toplevel main() if we will exit before processing options. > --- > gcc/toplev.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/toplev.cc b/gcc/toplev.cc > index 42937f0ba00..8beaa2ab64d 100644 > --- a/gcc/toplev.cc > +++ b/gcc/toplev.cc > @@ -2252,7 +2252,7 @@ toplev::main (int argc, char **argv) > > initialize_plugins (); > > - if (version_flag) > + if (version_flag && exit_after_options) > print_version (stderr, "", true); > > if (help_flag) > -- > 2.37.1 (Apple Git-137.1) >
> On 30 Jan 2023, at 07:48, Richard Biener <richard.guenther@gmail.com> wrote: > > On Sun, Jan 29, 2023 at 12:35 PM Iain Sandoe via Gcc-patches > <gcc-patches@gcc.gnu.org> wrote: >> >> Technically, this is seems to be a regression somewhere between 4.2 and >> 4.6 but, it seems, not enough for anyone to care too much. Tested on >> various Darwin versions and x86_64, powerpc64 linux, >> OK for trunk {now,stage1}? > > This will elide the earlier printing, right? Yes. > eliding the 2nd would be prefered so the info comes first? Indeed; that is better .. how about this update then? OK for trunk now/stage1? — 8< --- For a regular compile job, with -v we emit the GCC version information twice - once from main() and once from process_options(). We do not need to output the second header. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/ChangeLog: * toplev.cc (toplev::main): Only print the version information header from toplevel main(). --- gcc/toplev.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 42937f0ba00..4c15d4f542e 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -1358,7 +1358,7 @@ process_options (bool no_backend) option flags in use. */ if (version_flag) { - print_version (stderr, "", true); + /* We already printed the version header in main (). */ if (!quiet_flag) { fputs ("options passed: ", stderr);
On Thu, Feb 2, 2023 at 12:41 PM Iain Sandoe <iain@sandoe.co.uk> wrote: > > > > > On 30 Jan 2023, at 07:48, Richard Biener <richard.guenther@gmail.com> wrote: > > > > On Sun, Jan 29, 2023 at 12:35 PM Iain Sandoe via Gcc-patches > > <gcc-patches@gcc.gnu.org> wrote: > >> > >> Technically, this is seems to be a regression somewhere between 4.2 and > >> 4.6 but, it seems, not enough for anyone to care too much. Tested on > >> various Darwin versions and x86_64, powerpc64 linux, > >> OK for trunk {now,stage1}? > > > > This will elide the earlier printing, right? > > Yes. > > > eliding the 2nd would be prefered so the info comes first? > > Indeed; that is better .. > > how about this update then? > OK for trunk now/stage1? OK now. Richard. > — 8< --- > > For a regular compile job, with -v we emit the GCC version information > twice - once from main() and once from process_options(). > > We do not need to output the second header. > > Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> > > gcc/ChangeLog: > > * toplev.cc (toplev::main): Only print the version information header > from toplevel main(). > --- > gcc/toplev.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/toplev.cc b/gcc/toplev.cc > index 42937f0ba00..4c15d4f542e 100644 > --- a/gcc/toplev.cc > +++ b/gcc/toplev.cc > @@ -1358,7 +1358,7 @@ process_options (bool no_backend) > option flags in use. */ > if (version_flag) > { > - print_version (stderr, "", true); > + /* We already printed the version header in main (). */ > if (!quiet_flag) > { > fputs ("options passed: ", stderr); > -- > 2.37.1 (Apple Git-137.1) > >
diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 42937f0ba00..8beaa2ab64d 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -2252,7 +2252,7 @@ toplev::main (int argc, char **argv) initialize_plugins (); - if (version_flag) + if (version_flag && exit_after_options) print_version (stderr, "", true); if (help_flag)