[flac-dev] about "cpu.h: Fix compiler detection" patch
lvqcl
lvqcl.mail at gmail.com
Wed Feb 15 21:05:37 UTC 2017
After this patch, all FLAC__SSEN_SUPPORTED variables are
undefined for GCC, so intrinsic versions of functions are
not compiled into libFLAC.
Previously, the code was:
#if defined __INTEL_COMPILER
// definitions for ICC
#elif defined _MSC_VER
// definitions for MSVC
#elif defined __GNUC__ || defined __clang__
#if defined __clang__ && __has_attribute(__target__)
// definitions for newer clang
#elif !defined __clang__ && (__GNUC__ > 4 || (__GNUC__ == 4 &&
__GNUC_MINOR__ >= 9))
// definitions for newer GCC
#else
// definitions for older GCC and clang
#endif
#endif
Now, it's basically:
#if defined __INTEL_COMPILER
// definitions for ICC
#elif defined _MSC_VER
// definitions for MSVC
#elif defined __GNUC__ && defined __clang__
// definitions for clang
#endif
By the way, what's the problem with GCC 4.6?
According to <https://gcc.gnu.org/onlinedocs/cpp/If.html>:
"... and logical operations (&& and ||). The latter two obey the usual
short-circuiting rules of standard C."
So I thought that the directive
#if defined __clang__ && __has_attribute(__target__)
is ok for GCC because "defined __clang__" is false and
preprocessor shouldn't try to parse "__has_attribute(...)" part.
More information about the flac-dev
mailing list