[cfe-users] Why doesn't clang use colors for diagnostics by default?

Victor via cfe-users cfe-users at lists.llvm.org
Fri Sep 11 02:33:41 PDT 2015


Yes, HAVE_TERMINFO was undefined. I installed 
ncurses-devel package (before rebuilding) and now it works 
as expected.
Thank you very much!

On Thu, 10 Sep 2015 12:35:42 -0400
  don hinton <hintonda at gmail.com> wrote:
> Actually, I just looked at the cmake code and it checks 
>a list of
> libraries, i.e., tinfo, terminfo, curses, ncurses, and 
>ncursesw.  If any of
> them have setupterm, it will define HAVE_TERMINFO 1.
> 
> So, at least that give you something to check.
> 
> hth...
> don
> 
> On Thu, Sep 10, 2015 at 12:06 PM, don hinton 
><hintonda at gmail.com> wrote:
> 
>> I meant the headers.  If you use cmake, take a look at
>> cmake/config-ix.cmake.  Configure does something 
>>similar.
>>
>> Basically, if it finds the right headers, it will 
>>#define HAS_TERMINFO,
>> and the code that checks it is terminalHasColors() in
>> lib/Support/Unix/Process.inc.
>>
>> Not sure how gcc checks.
>>
>>
>> On Thu, Sep 10, 2015 at 11:58 AM, Victor <d.v.a at ngs.ru> 
>>wrote:
>>
>>> Did you build clang?
>>>>
>>> Yes
>>>
>>> Do you have terminfo installed?
>>>>
>>> $ find /usr/share/terminfo -type f
>>> /usr/share/terminfo/k/kon2
>>> /usr/share/terminfo/k/kon
>>> /usr/share/terminfo/k/konsole-256color
>>> /usr/share/terminfo/k/konsole
>>> /usr/share/terminfo/v/vs100
>>> /usr/share/terminfo/c/cygwin
>>> /usr/share/terminfo/c/cons25
>>> /usr/share/terminfo/t/teraterm2.3
>>> /usr/share/terminfo/t/teraterm
>>> /usr/share/terminfo/g/gnome
>>> /usr/share/terminfo/g/gnome-256color
>>> /usr/share/terminfo/w/wsvt25
>>> /usr/share/terminfo/w/wsvt25m
>>> /usr/share/terminfo/n/nxterm
>>> /usr/share/terminfo/n/nsterm
>>> /usr/share/terminfo/m/mrxvt
>>> /usr/share/terminfo/m/mach
>>> /usr/share/terminfo/m/mach-bold
>>> /usr/share/terminfo/m/mach-color
>>> /usr/share/terminfo/m/mlterm
>>> /usr/share/terminfo/E/Eterm-88color
>>> /usr/share/terminfo/E/Eterm-256color
>>> /usr/share/terminfo/E/Eterm
>>> /usr/share/terminfo/E/Eterm-color
>>> /usr/share/terminfo/a/aterm
>>> /usr/share/terminfo/a/ansis
>>> /usr/share/terminfo/a/ansi80x25
>>> /usr/share/terminfo/p/putty-vt100
>>> /usr/share/terminfo/p/pcansi
>>> /usr/share/terminfo/p/putty-256color
>>> /usr/share/terminfo/p/putty
>>> /usr/share/terminfo/s/screen.xterm-new
>>> /usr/share/terminfo/s/sun
>>> /usr/share/terminfo/s/screen-16color-bce
>>> /usr/share/terminfo/s/screen-16color-s
>>> /usr/share/terminfo/s/screen-16color-bce-s
>>> /usr/share/terminfo/s/sun1
>>> /usr/share/terminfo/s/screen
>>> /usr/share/terminfo/s/screen.rxvt
>>> /usr/share/terminfo/s/sun2
>>> /usr/share/terminfo/s/screen.linux
>>> /usr/share/terminfo/s/screen-256color-bce
>>> /usr/share/terminfo/s/screen-16color
>>> /usr/share/terminfo/s/screen-256color-s
>>> /usr/share/terminfo/s/screen.xterm-xfree86
>>> /usr/share/terminfo/s/screen-256color-bce-s
>>> /usr/share/terminfo/s/screen.teraterm
>>> /usr/share/terminfo/s/screen-bce
>>> /usr/share/terminfo/s/screen-s
>>> /usr/share/terminfo/s/screen.mlterm
>>> /usr/share/terminfo/s/screen-w
>>> /usr/share/terminfo/s/screen.xterm-r6
>>> /usr/share/terminfo/s/screen-256color
>>> /usr/share/terminfo/s/screen.Eterm
>>> /usr/share/terminfo/j/jfbterm
>>> /usr/share/terminfo/h/hurd
>>> /usr/share/terminfo/r/rxvt-color
>>> /usr/share/terminfo/r/rxvt-xpm
>>> /usr/share/terminfo/r/rxvt-unicode
>>> /usr/share/terminfo/r/rxvt-basic
>>> /usr/share/terminfo/r/rxvt
>>> /usr/share/terminfo/r/rxvt-88color
>>> /usr/share/terminfo/r/rxvt-16color
>>> /usr/share/terminfo/r/rxvt-cygwin-native
>>> /usr/share/terminfo/r/rxvt-256color
>>> /usr/share/terminfo/r/rxvt-cygwin
>>> /usr/share/terminfo/x/xterm-xf86-v32
>>> /usr/share/terminfo/x/xterm-xi
>>> /usr/share/terminfo/x/xterm-r5
>>> /usr/share/terminfo/x/xterm-vt220
>>> /usr/share/terminfo/x/xterm-new
>>> /usr/share/terminfo/x/xterm-sun
>>> /usr/share/terminfo/x/xterm-nic
>>> /usr/share/terminfo/x/xterm-8bit
>>> /usr/share/terminfo/x/xterm-old
>>> /usr/share/terminfo/x/xterm-hp
>>> /usr/share/terminfo/x/xterm-color
>>> /usr/share/terminfo/x/xterm-256color
>>> /usr/share/terminfo/x/xterm-pcolor
>>> /usr/share/terminfo/x/xterm-basic
>>> /usr/share/terminfo/x/xterm-noapp
>>> /usr/share/terminfo/x/xterm-24
>>> /usr/share/terminfo/x/xterm-bold
>>> /usr/share/terminfo/x/xterms
>>> /usr/share/terminfo/x/xterm
>>> /usr/share/terminfo/x/xterm-1003
>>> /usr/share/terminfo/x/xterm-sco
>>> /usr/share/terminfo/x/xterm-1002
>>> /usr/share/terminfo/x/xterm-vt52
>>> /usr/share/terminfo/x/xterm-16color
>>> /usr/share/terminfo/x/xterm-r6
>>> /usr/share/terminfo/x/xterm-xf86-v44
>>> /usr/share/terminfo/x/xfce
>>> /usr/share/terminfo/x/xterm-xf86-v333
>>> /usr/share/terminfo/x/xterm-88color
>>> /usr/share/terminfo/x/xterm-xfree86
>>> /usr/share/terminfo/x/xterm-xf86-v43
>>> /usr/share/terminfo/x/xterm-xf86-v40
>>> /usr/share/terminfo/x/xterm-xf86-v33
>>> /usr/share/terminfo/e/eterm
>>> /usr/share/terminfo/e/eterm-color
>>> /usr/share/terminfo/A/Apple_Terminal
>>>
>>> On Thu, 10 Sep 2015 11:53:48 -0400
>>>
>>>  don hinton <hintonda at gmail.com> wrote:
>>>
>>>> Did you build clang?  Do you have terminfo installed?  I 
>>>>think that's
>>>> what
>>>> it checks.
>>>>
>>>> On Thu, Sep 10, 2015 at 11:49 AM, Victor <d.v.a at ngs.ru> 
>>>>wrote:
>>>>
>>>> No. Still no luck. Tried both
>>>>>
>>>>>
>>>>> On Thu, 10 Sep 2015 11:39:24 -0400
>>>>>  don hinton <hintonda at gmail.com> wrote:
>>>>>
>>>>> Hi Victor:
>>>>>>
>>>>>> Try setting TERM to a color terminal, e.g., xterm-color 
>>>>>>or
>>>>>> xterm-256color
>>>>>> and see if that helps.  I use xterm-256color inside tmux 
>>>>>>and it works
>>>>>> fine.
>>>>>>
>>>>>> hth...
>>>>>> don
>>>>>>
>>>>>> On Thu, Sep 10, 2015 at 2:40 AM, Victor via cfe-users <
>>>>>> cfe-users at lists.llvm.org> wrote:
>>>>>>
>>>>>> I'm using command like this:
>>>>>>
>>>>>>>
>>>>>>> $ clang++ prg.cpp
>>>>>>>
>>>>>>> My Clang is built from sources. What libraries it needs 
>>>>>>>to use colors
>>>>>>> automatically? Or may be there is some option that I can 
>>>>>>>specify for
>>>>>>> configure?
>>>>>>>
>>>>>>>
>>>>>>> On Wed, 9 Sep 2015 19:49:21 -0700
>>>>>>>  Richard Trieu <rtrieu at google.com> wrote:
>>>>>>>
>>>>>>> Are you invoking Clang with "clang foo.cc" or "clang 
>>>>>>>-cc1 foo.cc"?
>>>>>>> The
>>>>>>>
>>>>>>>> first should detect if you have a color capable terminal 
>>>>>>>>and
>>>>>>>> automatically
>>>>>>>> turn on color diagnostics while the second needs the 
>>>>>>>>flag explicitly.
>>>>>>>> The
>>>>>>>> other possibility is that the Clang you are using was 
>>>>>>>>compiled with
>>>>>>>> the
>>>>>>>> libraries needed to detect a color terminal, and 
>>>>>>>>defaults to no
>>>>>>>> color.
>>>>>>>>
>>>>>>>> On Mon, Sep 7, 2015 at 5:15 AM, Victor via cfe-users <
>>>>>>>> cfe-users at lists.llvm.org> wrote:
>>>>>>>>
>>>>>>>> Hello, all.
>>>>>>>>
>>>>>>>>
>>>>>>>>> Why doesn't clang use colors for diagnostics by default?
>>>>>>>>> My environment:
>>>>>>>>>
>>>>>>>>> $ cat /etc/*-release
>>>>>>>>> Red Hat Enterprise Linux Server release 6.3 (Santiago)
>>>>>>>>>
>>>>>>>>> $ echo $TERM
>>>>>>>>> xterm
>>>>>>>>>
>>>>>>>>> Doc here
>>>>>>>>>
>>>>>>>>> http://clang.llvm.org/docs/UsersManual.html#formatting-of-diagnostics
>>>>>>>>> says: "This option, which defaults to on when a 
>>>>>>>>>color-capable
>>>>>>>>> terminal
>>>>>>>>> is
>>>>>>>>> detected". Isn't xterm "a color-capable terminal"?
>>>>>>>>>
>>>>>>>>> If I give -fcolor-diagnostics explicitly, all works as 
>>>>>>>>>expected. But
>>>>>>>>> why
>>>>>>>>> must I do that? GCC uses colors by default.
>>>>>>>>> _______________________________________________
>>>>>>>>> cfe-users mailing list
>>>>>>>>> cfe-users at lists.llvm.org
>>>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>>
>>>>>>>> cfe-users mailing list
>>>>>>> cfe-users at lists.llvm.org
>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>
>>




More information about the cfe-users mailing list