DO NOT SUBMIT - sending it out just to collect opinion.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/src/__support/macros/properties/architectures.h | ||
---|---|---|
44 | This allows us to use LIBC_TARGET_ARCH_IS_ARM is all of the following contexts: #ifdef LIBC_TARGET_ARCH_IS_ARM ... #endif #ifndef LIBC_TARGET_ARCH_IS_ARM ... #endif if constexpr (LIBC_TARGET_ARCH_IS_ARM) { ... } |
Comment Actions
The pattern is smart but I can see two issues with it:
- Depending on the context, the literal (i.e. LIBC_TARGET_ARCH_IS_ARM) is a preprocessor definition or a variable, this can be confusing.
- It's easy to mess up when defining (or renaming) the preprocessor definitions.
Also, we can already achieve the same behavior - although I agree it is more verbose.
if constexpr (LLVM_LIBC_IS_DEFINED(LIBC_TARGET_ARCH_IS_ARM)) { ... }
I'm not completely sure it's worth the complexity.
This allows us to use LIBC_TARGET_ARCH_IS_ARM is all of the following contexts: