[libcxx-commits] [libcxx] [libc++][test] Enhance `ADDITIONAL_COMPILE_FLAGS` to work with MSVC (PR #74974)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 10 04:33:55 PST 2023
================
@@ -13,7 +13,12 @@
import subprocess
import sys
-_isClang = lambda cfg: "__clang__" in compilerMacros(cfg) and "__apple_build_version__" not in compilerMacros(cfg)
+_isAnyClangOrGCC = lambda cfg: "__clang__" in compilerMacros(
+ cfg
+) or "__GNUC__" in compilerMacros(cfg)
----------------
h-vetinari wrote:
Could be deduplicated (both in terms of code and macro evaluations), e.g.:
```suggestion
_isAnyClangOrGCC = lambda cfg: _isClang(cfg) or _isAppleClang(cfg) or _isGCC(cfg)
```
(Obviously this would have to be added further down, after `_isGCC`.)
The potential for deduplication is now just about this PR though (though it certainly doesn't improve the situation); already the existing options could be deduplicated a bunch (which actually gets more attractive with the frankly horrible formatting that black chooses for the definition of `_isClang`):
```python
_isAnyClang = lambda cfg: "__clang__" in compilerMacros(cfg)
_isAppleClang = lambda cfg: "__apple_build_version__" in compilerMacros(cfg)
_isClang = lambda cfg: _isAnyClang(cfg) and not _isAppleClang(cfg)
_isGCC = lambda cfg: "__GNUC__" in compilerMacros(cfg) and not _isAnyClang(cfg)
_isAnyClangOrGCC = lambda cfg: _isAnyClang(cfg) or _isGCC(cfg)
```
https://github.com/llvm/llvm-project/pull/74974
More information about the libcxx-commits
mailing list