Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111142949
D38215.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
753 B
Referenced Files
None
Subscribers
None
D38215.diff
View Options
diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -312,6 +312,9 @@
* __generic(). Unlike _Generic(), this macro can only distinguish
* between a single type, so it requires nested invocations to
* distinguish multiple cases.
+ *
+ * Note that the comma operator is used to force expr to decay in
+ * order to match _Generic().
*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
@@ -321,7 +324,7 @@
#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)
+ __builtin_types_compatible_p(__typeof((0, (expr))), t), yes, no)
#endif
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 12:21 AM (11 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16894499
Default Alt Text
D38215.diff (753 B)
Attached To
Mode
D38215: <sys/cdefs.h>: Decay expression passed to fallback version of __generic()
Attached
Detach File
Event Timeline
Log In to Comment