Skip to content

automatic color diagnostics breaks terminfo configuration #25381

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 25007
Version 3.7
OS Linux
Reporter LLVM Bugzilla Contributor
CC @foutrelis,@jsonn

Extended Description

When there is no -f[no-]color-diagnostics in the command line, the clang driver will try to auto-detect if the terminal supports color text. This auto-detection resets any terminfo configuration that may be currently configured.

In the case of /usr/bin/clang that is not a problem, but when it is used as a library very bad things will happen, for example with Vim and the Clang-Complete plugin 1.

I've traced the problem to the function terminalHasColors(int fd) in lib/Support/Unix/Process.inc: it calls setupterm() and then set_curterm() and del_curterm(), thus disabling any terminal configuration.

My suggestion is to call first set_curterm(): if it returns null then terminfo is not initialized and it can be done as now. But if it returns not-null then terminfo is already initialized and you do not need to call set_curterm() or del_curterm().

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions