* [PATCH] driver, toplevel: Avoid emitting the version information twice.
@ 2023-01-29 11:34 Iain Sandoe
2023-01-30 7:48 ` Richard Biener
0 siblings, 1 reply; 4+ messages in thread
From: Iain Sandoe @ 2023-01-29 11:34 UTC (permalink / raw)
To: gcc-patches; +Cc: joseph
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(-)
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver, toplevel: Avoid emitting the version information twice.
2023-01-29 11:34 [PATCH] driver, toplevel: Avoid emitting the version information twice Iain Sandoe
@ 2023-01-30 7:48 ` Richard Biener
2023-02-02 11:41 ` Iain Sandoe
0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2023-01-30 7:48 UTC (permalink / raw)
To: iain; +Cc: gcc-patches, Iain Sandoe, joseph
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)
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver, toplevel: Avoid emitting the version information twice.
2023-01-30 7:48 ` Richard Biener
@ 2023-02-02 11:41 ` Iain Sandoe
2023-02-02 13:31 ` Richard Biener
0 siblings, 1 reply; 4+ messages in thread
From: Iain Sandoe @ 2023-02-02 11:41 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches, Joseph Myers
> 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);
--
2.37.1 (Apple Git-137.1)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] driver, toplevel: Avoid emitting the version information twice.
2023-02-02 11:41 ` Iain Sandoe
@ 2023-02-02 13:31 ` Richard Biener
0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2023-02-02 13:31 UTC (permalink / raw)
To: Iain Sandoe; +Cc: GCC Patches, Joseph Myers
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)
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-02 13:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-29 11:34 [PATCH] driver, toplevel: Avoid emitting the version information twice Iain Sandoe
2023-01-30 7:48 ` Richard Biener
2023-02-02 11:41 ` Iain Sandoe
2023-02-02 13:31 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).