1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Don't expose __generic() when not using C++.

According to the GCC documentation, the constructs used to implement
<tgmath.h> are only available in C mode. They only cause breakage when
used used with g++.

Reported by:	tijl
This commit is contained in:
Ed Schouten 2012-01-17 20:21:31 +00:00
parent 1f32d3b76f
commit 9b6e65b66f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230277

View File

@ -260,7 +260,7 @@
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define __generic(expr, t, yes, no) \
_Generic(expr, t: yes, default: no)
#elif __GNUC_PREREQ__(3, 1)
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
#define __generic(expr, t, yes, no) \
__builtin_choose_expr( \
__builtin_types_compatible_p(__typeof(expr), t), yes, no)