Disable color errors globally?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Disable color errors globally?

Gavin Cui via cfe-dev
Is there some way to pass options to clang "globally" and
without  having to get down and manually edit an entire
set of Makefiles?

I'm particularly eager to do this, if possible, for the
following option: -fno-color-diagnostics

My rationale, is that when/if I am sending some developer a
typescript log of an entire (failed) build process, whatever
he/she happens to end up viewing that "plain text" file with
may or may not display the color-changing escape sequences
as actual color changes, rather than unreadable gibberish.

Has anyone ever actually experienced such a problem/issue?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
Haven't investigated at all, but why not just set your terminal to not display colors?, e.g., TERM=xterm, or something like that?

On Tue, Jun 18, 2019 at 2:08 AM Ronald F. Guilmette via cfe-dev <[hidden email]> wrote:
Is there some way to pass options to clang "globally" and
without  having to get down and manually edit an entire
set of Makefiles?

I'm particularly eager to do this, if possible, for the
following option: -fno-color-diagnostics

My rationale, is that when/if I am sending some developer a
typescript log of an entire (failed) build process, whatever
he/she happens to end up viewing that "plain text" file with
may or may not display the color-changing escape sequences
as actual color changes, rather than unreadable gibberish.

Has anyone ever actually experienced such a problem/issue?
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
In message <[hidden email]>
Don Hinton <[hidden email]> wrote:

>Haven't investigated at all, but why not just set your terminal to not
>display colors?, e.g., TERM=xterm, or something like that?

Ummm... my TERM environment variable is already set to xterm.

I see the pretty colors anyway.

Maybe I should try setting TERM to "bogus".  I guess I'll gve it a try.

(I guess I should also try also unsetting TERMCAP.)

It's an interesting question anyway.  If you inherited a bunch of code
from somebody else, and didn't want to go groveling through all of the
Makefiles in the whole tree, just to (universally) set some particular
clang command line option for all complies, it might be be handy if
clang were to support passing it options via some environment variable.

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
What about using a bash alias to add it?  Something like:

alias clang++="/usr/bin/clang++ -fno-diagnostic-color" (or whatever it ends up being)?

-----Original Message-----
From: cfe-dev [mailto:[hidden email]] On Behalf Of Ronald F. Guilmette via cfe-dev
Sent: Tuesday, June 18, 2019 2:08 PM
To: clang developer list <[hidden email]>
Subject: Re: [cfe-dev] Disable color errors globally?

In message <[hidden email]>
Don Hinton <[hidden email]> wrote:

>Haven't investigated at all, but why not just set your terminal to not
>display colors?, e.g., TERM=xterm, or something like that?

Ummm... my TERM environment variable is already set to xterm.

I see the pretty colors anyway.

Maybe I should try setting TERM to "bogus".  I guess I'll gve it a try.

(I guess I should also try also unsetting TERMCAP.)

It's an interesting question anyway.  If you inherited a bunch of code from somebody else, and didn't want to go groveling through all of the Makefiles in the whole tree, just to (universally) set some particular clang command line option for all complies, it might be be handy if clang were to support passing it options via some environment variable.

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
In message <[hidden email]
om>, "Keane, Erich" <[hidden email]> wrote:

>What about using a bash alias to add it?

I guess that will be the solution, yes.

I just wanted to know if clang already had some in-built mechanism, like
for example, accepting options thru some particular envar.

If it doesn't, I can still think of half a dozen other ways to get what
I need, aliases being one of those.
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
if you set TERM=dumb, clang (nor most any other tool) will emit vt escape codes.

On Tue, Jun 18, 2019 at 6:05 PM Ronald F. Guilmette via cfe-dev <[hidden email]> wrote:
In message <[hidden email]
om>, "Keane, Erich" <[hidden email]> wrote:

>What about using a bash alias to add it?

I guess that will be the solution, yes.

I just wanted to know if clang already had some in-built mechanism, like
for example, accepting options thru some particular envar.

If it doesn't, I can still think of half a dozen other ways to get what
I need, aliases being one of those.
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
>if you set TERM=dumb, clang (nor most any other tool) will emit vt escape
>codes.

Thank you.  That's my solution them.

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
Cool, wish i’d Been smart enough to suggest dumb in the first place...  ;-)

On Tue, Jun 18, 2019 at 5:08 PM Ronald F. Guilmette via cfe-dev <[hidden email]> wrote:
>if you set TERM=dumb, clang (nor most any other tool) will emit vt escape
>codes.

Thank you.  That's my solution them.

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
In reply to this post by Gavin Cui via cfe-dev
On Wed, Jun 19, 2019 at 12:05 AM Ronald F. Guilmette via cfe-dev
<[hidden email]> wrote:

>
> In message <[hidden email]
> om>, "Keane, Erich" <[hidden email]> wrote:
>
> >What about using a bash alias to add it?
>
> I guess that will be the solution, yes.
>
> I just wanted to know if clang already had some in-built mechanism, like
> for example, accepting options thru some particular envar.

CCC_OVERRIDE_OPTIONS="+-fno-color-diagnostics" clang /tmp/f.cc

You can find the implementation in clang/tools/driver/driver.cpp.

Dmitri

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[hidden email]>*/
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
In message <[hidden email]>
Dmitri Gribenko <[hidden email]> wrote:

>CCC_OVERRIDE_OPTIONS="+-fno-color-diagnostics" clang /tmp/f.cc

Thanks much.  That's exactly the kind of thing I was hoping to find.


Regards,
rfg
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
I still think `TERM=dumb ninja` is easier in this case, but good to know you can override anything.

On Wed, Jun 19, 2019 at 2:20 PM Ronald F. Guilmette via cfe-dev <[hidden email]> wrote:
In message <[hidden email]>
Dmitri Gribenko <[hidden email]> wrote:

>CCC_OVERRIDE_OPTIONS="+-fno-color-diagnostics" clang /tmp/f.cc

Thanks much.  That's exactly the kind of thing I was hoping to find.


Regards,
rfg
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Disable color errors globally?

Gavin Cui via cfe-dev
In message <[hidden email]>
Don Hinton <[hidden email]> wrote:

>I still think `TERM=dumb ninja` is easier in this case, but good to know
>you can override anything.

Yes!

I'm planning on adding the following to all of my ~/.whatever shell startup
scripts:

    CCC_OVERRIDE_OPTIONS="-debug-my-code-for-me"


Regards,
rfg
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev