[PATCH 2/7] GCOV: introduce usage of terminal colors.
David Malcolm
dmalcolm@redhat.com
Mon Oct 30 14:53:00 GMT 2017
On Mon, 2017-10-30 at 08:17 -0400, Nathan Sidwell wrote:
> On 10/26/2017 04:11 AM, marxin wrote:
> > I consider using colors in context of gcov as very useful. There's
> > example for tramp3d:
> > https://pste.eu/p/Tl2D.html
>
> nice!
>
> > gcc/ChangeLog:
> >
> > 2017-10-23 Martin Liska <mliska@suse.cz>
> >
> > * color-macros.h: New file.
> > * diagnostic-color.c: Factor out color related to macros to
> > color-macros.h.
> > * doc/gcov.texi: Document -k option.
> > * gcov.c (INCLUDE_STRING): Include string.h.
> > (print_usage): Add -k option.
> > (process_args): Parse it.
> > (pad_count_string): New function.
> > (output_line_beginning): Likewise.
> > (DEFAULT_LINE_START): New macro.
> > (output_lines): Support color output.
>
> The gcov changes are ok. I guess David has the review ball for the
> diagnostic refactoring?
>
> nathan
The comments beginning:
+/* Select Graphic Rendition (SGR, "\33[...m") strings. */
and ending:
It would be impractical for GCC to become a full-fledged
terminal program linked against ncurses or the like, so it will
not detect terminfo(5) capabilities. */
are still in diagnostic-color.c after your patch, but they are
describing the macros, and in particular, if I'm reading them right,
are a rationale for why SGR_END contains a "\33[K".
Hence I think that those comments should also be moved to color-
macros.h.
Other than that the diagnostic changes mostly look good to me, but the
color-macros.h has:
+ Copyright (C) 2017 Free Software Foundation, Inc.
Shouldn't that copyright line express the full range of years for the
existing content that's being moved from diagnostic-color.c?
The macros there were introduced by the creation of diagnostic-color.c
in r197842 in April 2013 (aka dc604d41825b3cbd09045baeef09b1b88fc5a02),
which had the copyright line:
+ Copyright 2011-2013 Free Software Foundation, Inc.
FWIW, the macros seem to come from this patch by Manu:
"RFC: color diagnostics markers"
https://gcc.gnu.org/ml/gcc-patches/2013-03/msg01365.html
where the code in question has:
/* Based on code from: */
+/* grep.c - main driver file for grep.
+ Copyright (C) 1992, 1997-2002, 2004-2013 Free Software Foundation,
Inc.
though as far as I can tell the only material taken directly from
"grep" are the comments I mentioned above beginning i.e. it appears to
me that the actual macros in the new file were written by Manu in 2013.
The comments mentioned above come from GNU grep; looking at the history
in grep's git repo shows it comes from commit
56623b5129d487cb6673fa5a582d094edc1fe983:
2005-06-20 Charles Levert <charles_levert@gna.org>
* src/grep.c: Extensively document the SGR/EL-to-Right issue.
Hence I believe the color-macros.h copyright line should range from
2005-2017 if you move the comments (please do), or from 2013-2017 as-
is.
Diagnostic refactoring is OK otherwise.
Dave
More information about the Gcc-patches
mailing list