mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
include/nuttx/compiler.h: Important fix for C++ users. compiler.h was using the value of __STDC_VERSION__ to determine if inline functions are supported or not. If not then the keyword inline was defined out. Good for C but bad for C++ because C++ does not defined __STDC_VERSION__ at all. C++ applications may draw in compiler.h indirectly via other head files and this can result in C++ compiler problems since 'inline' is defined out. This fix is to ignore the (undefined) __STDC_VERSION__ if __cplusplus is defined.
This commit is contained in:
@@ -260,7 +260,7 @@
|
||||
|
||||
/* GCC supports inlined functions for version C99 and above */
|
||||
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||
# define CONFIG_HAVE_INLINE 1
|
||||
# else
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
@@ -273,7 +273,7 @@
|
||||
|
||||
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
|
||||
# undef CONFIG_HAVE_ANONYMOUS_UNION
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
# if defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
||||
# define CONFIG_HAVE_ANONYMOUS_STRUCT 1
|
||||
# define CONFIG_HAVE_ANONYMOUS_UNION 1
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user