aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-12-01 14:14:18 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-12-01 14:14:18 +0000
commit6aa12274007bccbae2691a9d336c37fe167bb535 (patch)
tree42f6cbab523c6bb2b6df78a69a4c1717e7f96160 /gcc
parent6ea5a23766b8077a503362c4fa6f51de92669c11 (diff)
downloadgcc-6aa12274007bccbae2691a9d336c37fe167bb535.zip
gcc-6aa12274007bccbae2691a9d336c37fe167bb535.tar.gz
gcc-6aa12274007bccbae2691a9d336c37fe167bb535.tar.bz2
libstdc++: Simplify detection of built-in functions
This fixes a regression affecting the Intel compiler. Because that compiler defines __GNUC__ to match whatever version of GCC it finds on the host system, it might claim to be a brand new GCC despite not actually supporting all the built-ins that the latest GCC supports. This means the config checks for __GNUC__ don't work. Most recently this broke when r11-3569-g73ae6eb572515ad627b575a7fbdfdd47a4368e1c switched us from using __is_same_as to __is_same when __GNUC__ >= 11. Because __has_builtin is supported by all of GCC, Clang, and Intel we can use that to reliably detect whether a given built-in is supported, instead of hardcoding anything based on __GNUC__. The big caveat is that for versions of Clang <= 9.0.0 and for (as far as I can tell) all released versions of Intel icc, __has_builtin only evaluates to true for built-ins with a name starting "__builtin_". For __is_aggregate, __is_same, and __has_unique_object_representations it's necessary to use __is_identifier to check if it's a valid identifeir token instead. The solution used in this patch is to define _GLIBCXX_HAS_BUILTIN and use that instead of using __has_builtin directly. For compilers that define __is_identifier as well as __has_builtin we use both, so that if __has_builtin evaluates to false we try again using !__is_identifier. libstdc++-v3/ChangeLog: * include/bits/c++config (_GLIBCXX_HAS_BUILTIN): Define macro to work around different implementations of __has_builtin. (_GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP) (_GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE) (_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED) (_GLIBCXX_HAVE_BUILTIN_IS_SAME, _GLIBCXX_HAVE_BUILTIN_LAUNDER): Define using _GLIBCXX_HAS_BUILTIN.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions