* [PATCH] gcov: rename 2 options.
@ 2020-07-01 7:11 Martin Liška
2020-07-01 7:49 ` Richard Biener
0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2020-07-01 7:11 UTC (permalink / raw)
To: gcc-patches; +Cc: Nathan Sidwell, Jan Hubicka
Hey.
Even thought an option renaming is a problematic change, I still believe
the option names were selected poorly and this patch is attempt to improve it.
Thoughts?
Thanks,
Martin
gcc/ChangeLog:
* doc/gcov.texi: Rename 2 options.
* gcov.c (print_usage): Rename -i,--json-format to
-j,--json-format and -j,--human-readable to -H,--human-readable.
(process_args): Fix up parsing.
gcc/testsuite/ChangeLog:
* g++.dg/gcov/loop.C: Use -H option instead of -j option.
---
gcc/doc/gcov.texi | 8 ++++----
gcc/gcov.c | 14 +++++++-------
gcc/testsuite/g++.dg/gcov/loop.C | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 22e42da2ea6..00f0cdc45f9 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -124,8 +124,8 @@ gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}]
[@option{-c}|@option{--branch-counts}]
[@option{-d}|@option{--display-progress}]
[@option{-f}|@option{--function-summaries}]
- [@option{-i}|@option{--json-format}]
- [@option{-j}|@option{--human-readable}]
+ [@option{-j}|@option{--json-format}]
+ [@option{-H}|@option{--human-readable}]
[@option{-k}|@option{--use-colors}]
[@option{-l}|@option{--long-file-names}]
[@option{-m}|@option{--demangled-names}]
@@ -180,7 +180,7 @@ Output summaries for each function in addition to the file level summary.
Display help about using @command{gcov} (on the standard output), and
exit without doing any further processing.
-@item -i
+@item -j
@itemx --json-format
Output gcov file in an easy-to-parse JSON intermediate format
which does not require source code for generation. The JSON
@@ -339,7 +339,7 @@ Fields of the @var{branch} element have following semantics:
@var{throw}: true when the branch is an exceptional branch
@end itemize
-@item -j
+@item -H
@itemx --human-readable
Write counts in human readable format (like 24.6k).
diff --git a/gcc/gcov.c b/gcc/gcov.c
index ef93758b26f..21c42c72be1 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -898,8 +898,8 @@ print_usage (int error_p)
fnotice (file, " -d, --display-progress Display progress information\n");
fnotice (file, " -f, --function-summaries Output summaries for each function\n");
fnotice (file, " -h, --help Print this help, then exit\n");
- fnotice (file, " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
- fnotice (file, " -j, --human-readable Output human readable numbers\n");
+ fnotice (file, " -j, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
+ fnotice (file, " -H, --human-readable Output human readable numbers\n");
fnotice (file, " -k, --use-colors Emit colored output\n");
fnotice (file, " -l, --long-file-names Use long output file names for included\n\
source files\n");
@@ -942,8 +942,8 @@ static const struct option options[] =
{ "all-blocks", no_argument, NULL, 'a' },
{ "branch-probabilities", no_argument, NULL, 'b' },
{ "branch-counts", no_argument, NULL, 'c' },
- { "json-format", no_argument, NULL, 'i' },
- { "human-readable", no_argument, NULL, 'j' },
+ { "json-format", no_argument, NULL, 'j' },
+ { "human-readable", no_argument, NULL, 'H' },
{ "no-output", no_argument, NULL, 'n' },
{ "long-file-names", no_argument, NULL, 'l' },
{ "function-summaries", no_argument, NULL, 'f' },
@@ -969,7 +969,7 @@ process_args (int argc, char **argv)
{
int opt;
- const char *opts = "abcdfhijklmno:pqrs:tuvwx";
+ const char *opts = "abcdfhHjklmno:pqrs:tuvwx";
while ((opt = getopt_long (argc, argv, opts, options, NULL)) != -1)
{
switch (opt)
@@ -992,7 +992,7 @@ process_args (int argc, char **argv)
case 'l':
flag_long_names = 1;
break;
- case 'j':
+ case 'H':
flag_human_readable_numbers = 1;
break;
case 'k':
@@ -1023,7 +1023,7 @@ process_args (int argc, char **argv)
case 'u':
flag_unconditional = 1;
break;
- case 'i':
+ case 'j':
flag_json_format = 1;
flag_gcov_file = 1;
break;
diff --git a/gcc/testsuite/g++.dg/gcov/loop.C b/gcc/testsuite/g++.dg/gcov/loop.C
index 24f580634d9..e63cb92e6e6 100644
--- a/gcc/testsuite/g++.dg/gcov/loop.C
+++ b/gcc/testsuite/g++.dg/gcov/loop.C
@@ -24,4 +24,4 @@ int main(int argc, char **argv)
return 0; /* count(1) */
}
-/* { dg-final { run-gcov branches { -abj loop.C } } } */
+/* { dg-final { run-gcov branches { -abH loop.C } } } */
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gcov: rename 2 options.
2020-07-01 7:11 [PATCH] gcov: rename 2 options Martin Liška
@ 2020-07-01 7:49 ` Richard Biener
2020-07-01 10:59 ` Martin Liška
0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2020-07-01 7:49 UTC (permalink / raw)
To: Martin Liška; +Cc: GCC Patches, Nathan Sidwell, Jan Hubicka
On Wed, Jul 1, 2020 at 9:12 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hey.
>
> Even thought an option renaming is a problematic change, I still believe
> the option names were selected poorly and this patch is attempt to improve it.
>
> Thoughts?
Please keep the old options as aliases, documented as obsoleted in --help.
Richard.
> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> * doc/gcov.texi: Rename 2 options.
> * gcov.c (print_usage): Rename -i,--json-format to
> -j,--json-format and -j,--human-readable to -H,--human-readable.
> (process_args): Fix up parsing.
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/gcov/loop.C: Use -H option instead of -j option.
> ---
> gcc/doc/gcov.texi | 8 ++++----
> gcc/gcov.c | 14 +++++++-------
> gcc/testsuite/g++.dg/gcov/loop.C | 2 +-
> 3 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
> index 22e42da2ea6..00f0cdc45f9 100644
> --- a/gcc/doc/gcov.texi
> +++ b/gcc/doc/gcov.texi
> @@ -124,8 +124,8 @@ gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}]
> [@option{-c}|@option{--branch-counts}]
> [@option{-d}|@option{--display-progress}]
> [@option{-f}|@option{--function-summaries}]
> - [@option{-i}|@option{--json-format}]
> - [@option{-j}|@option{--human-readable}]
> + [@option{-j}|@option{--json-format}]
> + [@option{-H}|@option{--human-readable}]
> [@option{-k}|@option{--use-colors}]
> [@option{-l}|@option{--long-file-names}]
> [@option{-m}|@option{--demangled-names}]
> @@ -180,7 +180,7 @@ Output summaries for each function in addition to the file level summary.
> Display help about using @command{gcov} (on the standard output), and
> exit without doing any further processing.
>
> -@item -i
> +@item -j
> @itemx --json-format
> Output gcov file in an easy-to-parse JSON intermediate format
> which does not require source code for generation. The JSON
> @@ -339,7 +339,7 @@ Fields of the @var{branch} element have following semantics:
> @var{throw}: true when the branch is an exceptional branch
> @end itemize
>
> -@item -j
> +@item -H
> @itemx --human-readable
> Write counts in human readable format (like 24.6k).
>
> diff --git a/gcc/gcov.c b/gcc/gcov.c
> index ef93758b26f..21c42c72be1 100644
> --- a/gcc/gcov.c
> +++ b/gcc/gcov.c
> @@ -898,8 +898,8 @@ print_usage (int error_p)
> fnotice (file, " -d, --display-progress Display progress information\n");
> fnotice (file, " -f, --function-summaries Output summaries for each function\n");
> fnotice (file, " -h, --help Print this help, then exit\n");
> - fnotice (file, " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
> - fnotice (file, " -j, --human-readable Output human readable numbers\n");
> + fnotice (file, " -j, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
> + fnotice (file, " -H, --human-readable Output human readable numbers\n");
> fnotice (file, " -k, --use-colors Emit colored output\n");
> fnotice (file, " -l, --long-file-names Use long output file names for included\n\
> source files\n");
> @@ -942,8 +942,8 @@ static const struct option options[] =
> { "all-blocks", no_argument, NULL, 'a' },
> { "branch-probabilities", no_argument, NULL, 'b' },
> { "branch-counts", no_argument, NULL, 'c' },
> - { "json-format", no_argument, NULL, 'i' },
> - { "human-readable", no_argument, NULL, 'j' },
> + { "json-format", no_argument, NULL, 'j' },
> + { "human-readable", no_argument, NULL, 'H' },
> { "no-output", no_argument, NULL, 'n' },
> { "long-file-names", no_argument, NULL, 'l' },
> { "function-summaries", no_argument, NULL, 'f' },
> @@ -969,7 +969,7 @@ process_args (int argc, char **argv)
> {
> int opt;
>
> - const char *opts = "abcdfhijklmno:pqrs:tuvwx";
> + const char *opts = "abcdfhHjklmno:pqrs:tuvwx";
> while ((opt = getopt_long (argc, argv, opts, options, NULL)) != -1)
> {
> switch (opt)
> @@ -992,7 +992,7 @@ process_args (int argc, char **argv)
> case 'l':
> flag_long_names = 1;
> break;
> - case 'j':
> + case 'H':
> flag_human_readable_numbers = 1;
> break;
> case 'k':
> @@ -1023,7 +1023,7 @@ process_args (int argc, char **argv)
> case 'u':
> flag_unconditional = 1;
> break;
> - case 'i':
> + case 'j':
> flag_json_format = 1;
> flag_gcov_file = 1;
> break;
> diff --git a/gcc/testsuite/g++.dg/gcov/loop.C b/gcc/testsuite/g++.dg/gcov/loop.C
> index 24f580634d9..e63cb92e6e6 100644
> --- a/gcc/testsuite/g++.dg/gcov/loop.C
> +++ b/gcc/testsuite/g++.dg/gcov/loop.C
> @@ -24,4 +24,4 @@ int main(int argc, char **argv)
> return 0; /* count(1) */
> }
>
> -/* { dg-final { run-gcov branches { -abj loop.C } } } */
> +/* { dg-final { run-gcov branches { -abH loop.C } } } */
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gcov: rename 2 options.
2020-07-01 7:49 ` Richard Biener
@ 2020-07-01 10:59 ` Martin Liška
2020-07-04 19:12 ` Fangrui Song
0 siblings, 1 reply; 6+ messages in thread
From: Martin Liška @ 2020-07-01 10:59 UTC (permalink / raw)
To: Richard Biener; +Cc: GCC Patches, Nathan Sidwell, Jan Hubicka
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
On 7/1/20 9:49 AM, Richard Biener wrote:
> Please keep the old options as aliases, documented as obsoleted in --help.
Good idea! I've done that and made an alias for -i -> -j option.
I'm going to push it to master.
Martin
[-- Attachment #2: 0001-gcov-rename-2-options.patch --]
[-- Type: text/x-patch, Size: 5456 bytes --]
From f0564852b5acbc2fcde604308e61109f22815ac1 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 30 Jun 2020 15:48:03 +0200
Subject: [PATCH] gcov: rename 2 options.
gcc/ChangeLog:
* doc/gcov.texi: Rename 2 options.
* gcov.c (print_usage): Rename -i,--json-format to
-j,--json-format and -j,--human-readable to -H,--human-readable.
(process_args): Fix up parsing. Document obsolete options and
how are they changed.
gcc/testsuite/ChangeLog:
* g++.dg/gcov/loop.C: Use -H option instead of -j option.
---
gcc/doc/gcov.texi | 8 ++++----
gcc/gcov.c | 16 ++++++++++------
gcc/testsuite/g++.dg/gcov/loop.C | 2 +-
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 22e42da2ea6..00f0cdc45f9 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -124,8 +124,8 @@ gcov [@option{-v}|@option{--version}] [@option{-h}|@option{--help}]
[@option{-c}|@option{--branch-counts}]
[@option{-d}|@option{--display-progress}]
[@option{-f}|@option{--function-summaries}]
- [@option{-i}|@option{--json-format}]
- [@option{-j}|@option{--human-readable}]
+ [@option{-j}|@option{--json-format}]
+ [@option{-H}|@option{--human-readable}]
[@option{-k}|@option{--use-colors}]
[@option{-l}|@option{--long-file-names}]
[@option{-m}|@option{--demangled-names}]
@@ -180,7 +180,7 @@ Output summaries for each function in addition to the file level summary.
Display help about using @command{gcov} (on the standard output), and
exit without doing any further processing.
-@item -i
+@item -j
@itemx --json-format
Output gcov file in an easy-to-parse JSON intermediate format
which does not require source code for generation. The JSON
@@ -339,7 +339,7 @@ Fields of the @var{branch} element have following semantics:
@var{throw}: true when the branch is an exceptional branch
@end itemize
-@item -j
+@item -H
@itemx --human-readable
Write counts in human readable format (like 24.6k).
diff --git a/gcc/gcov.c b/gcc/gcov.c
index ef93758b26f..c60f5112d2c 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -898,8 +898,8 @@ print_usage (int error_p)
fnotice (file, " -d, --display-progress Display progress information\n");
fnotice (file, " -f, --function-summaries Output summaries for each function\n");
fnotice (file, " -h, --help Print this help, then exit\n");
- fnotice (file, " -i, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
- fnotice (file, " -j, --human-readable Output human readable numbers\n");
+ fnotice (file, " -j, --json-format Output JSON intermediate format into .gcov.json.gz file\n");
+ fnotice (file, " -H, --human-readable Output human readable numbers\n");
fnotice (file, " -k, --use-colors Emit colored output\n");
fnotice (file, " -l, --long-file-names Use long output file names for included\n\
source files\n");
@@ -915,6 +915,9 @@ print_usage (int error_p)
fnotice (file, " -v, --version Print version number, then exit\n");
fnotice (file, " -w, --verbose Print verbose informations\n");
fnotice (file, " -x, --hash-filenames Hash long pathnames\n");
+ fnotice (file, "\nObsolete options:\n");
+ fnotice (file, " -i, --json-format Replaced with -j, --json-format\n");
+ fnotice (file, " -j, --human-readable Replaced with -H, --human-readable\n");
fnotice (file, "\nFor bug reporting instructions, please see:\n%s.\n",
bug_report_url);
exit (status);
@@ -942,8 +945,8 @@ static const struct option options[] =
{ "all-blocks", no_argument, NULL, 'a' },
{ "branch-probabilities", no_argument, NULL, 'b' },
{ "branch-counts", no_argument, NULL, 'c' },
- { "json-format", no_argument, NULL, 'i' },
- { "human-readable", no_argument, NULL, 'j' },
+ { "json-format", no_argument, NULL, 'j' },
+ { "human-readable", no_argument, NULL, 'H' },
{ "no-output", no_argument, NULL, 'n' },
{ "long-file-names", no_argument, NULL, 'l' },
{ "function-summaries", no_argument, NULL, 'f' },
@@ -969,7 +972,7 @@ process_args (int argc, char **argv)
{
int opt;
- const char *opts = "abcdfhijklmno:pqrs:tuvwx";
+ const char *opts = "abcdfhHijklmno:pqrs:tuvwx";
while ((opt = getopt_long (argc, argv, opts, options, NULL)) != -1)
{
switch (opt)
@@ -992,7 +995,7 @@ process_args (int argc, char **argv)
case 'l':
flag_long_names = 1;
break;
- case 'j':
+ case 'H':
flag_human_readable_numbers = 1;
break;
case 'k':
@@ -1024,6 +1027,7 @@ process_args (int argc, char **argv)
flag_unconditional = 1;
break;
case 'i':
+ case 'j':
flag_json_format = 1;
flag_gcov_file = 1;
break;
diff --git a/gcc/testsuite/g++.dg/gcov/loop.C b/gcc/testsuite/g++.dg/gcov/loop.C
index 24f580634d9..e63cb92e6e6 100644
--- a/gcc/testsuite/g++.dg/gcov/loop.C
+++ b/gcc/testsuite/g++.dg/gcov/loop.C
@@ -24,4 +24,4 @@ int main(int argc, char **argv)
return 0; /* count(1) */
}
-/* { dg-final { run-gcov branches { -abj loop.C } } } */
+/* { dg-final { run-gcov branches { -abH loop.C } } } */
--
2.27.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gcov: rename 2 options.
2020-07-01 10:59 ` Martin Liška
@ 2020-07-04 19:12 ` Fangrui Song
2020-07-04 19:14 ` Fangrui Song
2020-07-07 8:44 ` Martin Liška
0 siblings, 2 replies; 6+ messages in thread
From: Fangrui Song @ 2020-07-04 19:12 UTC (permalink / raw)
To: mliska; +Cc: gcc-patches, RichardBienerrichard.guenther
> Good idea! I've done that and made an alias for -i -> -j option.
> I'm going to push it to master.
>
> Martin
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: 0001-gcov-rename-2-options.patch
> Type: text/x-patch
> Size: 5457 bytes
> Desc: not available
> URL:
> <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200701/2a0ca9c2/attachment.bin>
Note that -i was --intermediate-format in many releases, dropping -i should be fine if
there is no intention bring back --intermediate-format.
(Personally I still find --intermediate-format useful: for template
instantiations, in many cases users only care about aggregated line
execution counts (0 vs 1). They don't want to see 10 instantiations of a
function.)
-j -> --json-format looks good.
I don't think anyone uses --human-readable. The short option can even be
removed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gcov: rename 2 options.
2020-07-04 19:12 ` Fangrui Song
@ 2020-07-04 19:14 ` Fangrui Song
2020-07-07 8:44 ` Martin Liška
1 sibling, 0 replies; 6+ messages in thread
From: Fangrui Song @ 2020-07-04 19:14 UTC (permalink / raw)
To: mliska; +Cc: gcc-patches, richard.guenther
On 2020-07-04, Fangrui Song wrote:
>> Good idea! I've done that and made an alias for -i -> -j option.
>> I'm going to push it to master.
>>
>> Martin
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: 0001-gcov-rename-2-options.patch
>> Type: text/x-patch
>> Size: 5457 bytes
>> Desc: not available
>> URL:
>> <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200701/2a0ca9c2/attachment.bin>
>
>Note that -i was --intermediate-format in many releases, dropping -i should be fine if
>there is no intention bring back --intermediate-format.
>
>(Personally I still find --intermediate-format useful: for template
>instantiations, in many cases users only care about aggregated line
>execution counts (0 vs 1). They don't want to see 10 instantiations of a
>function.)
>
>-j -> --json-format looks good.
>
>I don't think anyone uses --human-readable. The short option can even be
>removed.
Fix Richard's email address.
(I am not subscribed so replying to a thread is difficult.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] gcov: rename 2 options.
2020-07-04 19:12 ` Fangrui Song
2020-07-04 19:14 ` Fangrui Song
@ 2020-07-07 8:44 ` Martin Liška
1 sibling, 0 replies; 6+ messages in thread
From: Martin Liška @ 2020-07-07 8:44 UTC (permalink / raw)
To: Fangrui Song; +Cc: gcc-patches, Richard Biener
On 7/4/20 9:12 PM, Fangrui Song wrote:
>> Good idea! I've done that and made an alias for -i -> -j option.
>> I'm going to push it to master.
>>
>> Martin
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: 0001-gcov-rename-2-options.patch
>> Type: text/x-patch
>> Size: 5457 bytes
>> Desc: not available
>> URL:
>> <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200701/2a0ca9c2/attachment.bin>
>
> Note that -i was --intermediate-format in many releases, dropping -i should be fine if
> there is no intention bring back --intermediate-format.
Hello.
I know, but we have one release out (GCC 10.x) that uses that for the JSON format.
Richi, I quite support drop of the option.
>
> (Personally I still find --intermediate-format useful: for template
> instantiations, in many cases users only care about aggregated line
> execution counts (0 vs 1). They don't want to see 10 instantiations of a
> function.)
You can still find the very same information in the JSON file format. Note that
a JSON format is much easier to parse and one can easily extend it.
>
> -j -> --json-format looks good.
>
> I don't think anyone uses --human-readable. The short option can even be
> removed.
I used it couple of times together with --use-hotness-colors and I see it handy
for a report similar to `perf report`.
Martin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-07 8:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 7:11 [PATCH] gcov: rename 2 options Martin Liška
2020-07-01 7:49 ` Richard Biener
2020-07-01 10:59 ` Martin Liška
2020-07-04 19:12 ` Fangrui Song
2020-07-04 19:14 ` Fangrui Song
2020-07-07 8:44 ` Martin Liška
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).