What predefined macro can I use to detect the target architecture in Clang?
arm, clang, macros
Solution
`clang --target=... -mcpu=... -E - -dM </dev/null` will output all the pre-defined preprocessor macros (similar works for gcc, too)
I don't see single macro that provides the answer, but you can probably use some combination of `__ARM_ARCH` and `defined(__ARM_ARCH_*)`.
Problem
I would like to write code depending on whether the target architecture is e.g. armv7, armv7s, or arm64. The reason that I can't use sysctlbyname is that this would give me the underlying architecture at runtime, but when arm64 e.g. simulates armv7, sysctl (seemingly) still reports arm64.