[llvm] [llvm] Do not use Console API if the output isn't a console device (PR #90230)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 11 20:33:35 PDT 2024


farzonl wrote:

> And after that's done, from what I can find the test `llvm/unittests/Support/WithColorTest.cpp` needs to be enabled for Windows (remove `#ifdef LLVM_ON_UNIX`.

@alvinhochun i'm not sure if removing LLVM_ON_UNIX is enough to make this test pass in all enviornments. `ENABLE_VIRTUAL_TERMINAL_PROCESSING` is only valid after 10.0.22621.1992. If there are earlier windows build agents wont they break?

My theory is If `ENABLE_VIRTUAL_TERMINAL_PROCESSING` is not defined or does not equal [`0x0004`](https://learn.microsoft.com/en-us/windows/console/setconsolemode) then windows will behave as it always did and not support ascii color encodings.  So `LLVM_ON_UNIX ||  ENABLE_VIRTUAL_TERMINAL_PROCESSING`?

Also shouldn't the ifdef `#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)` check that `ENABLE_VIRTUAL_TERMINAL_PROCESSING` equals `0x4`?
https://github.com/llvm/llvm-project/blob/efc6b50d2d93fa571572ee3ef1d4565c09ad1610/llvm/lib/Support/Windows/Process.inc#L319C2-L331C7


https://github.com/llvm/llvm-project/pull/90230


More information about the llvm-commits mailing list