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:
Gregory Nutt
2019-02-19 09:04:04 -06:00
parent 7f11a45895
commit e982488e6c
+2 -2
View File
@@ -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