compiler.h: Move c++ standard feature out of compiler specific section

and correct the code indent

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-05-05 13:53:13 +08:00 committed by Alan Carvalho de Assis
parent 0c223998c7
commit fb996ebaa9

View File

@ -31,6 +31,36 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* ISO C11 supports anonymous (unnamed) structures and unions, added in
* GCC 4.6 (but might be suppressed with -std= option). ISO C++11 also
* adds un-named unions, but NOT unnamed structures (although compilers
* may support them).
*
* CAREFUL: This can cause issues for shared data structures shared between
* C and C++ if the two versions do not support the same features.
* Structures and unions can lose binary compatibility!
*
* NOTE: The NuttX coding standard forbids the use of unnamed structures and
* unions within the OS.
*/
#undef CONFIG_HAVE_ANONYMOUS_STRUCT
#undef CONFIG_HAVE_ANONYMOUS_UNION
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# define CONFIG_HAVE_ANONYMOUS_STRUCT 1
# define CONFIG_HAVE_ANONYMOUS_UNION 1
#endif
/* C++ support */
#if defined(__cplusplus) && __cplusplus >= 201402L
# define CONFIG_HAVE_CXX14 1
#else
# undef CONFIG_HAVE_CXX14
#endif
/* GCC-specific definitions *************************************************/ /* GCC-specific definitions *************************************************/
#ifdef __GNUC__ #ifdef __GNUC__
@ -77,14 +107,6 @@
# define CONFIG_HAVE_BUILTIN_POPCOUNT 1 # define CONFIG_HAVE_BUILTIN_POPCOUNT 1
# endif # endif
/* C++ support */
#if defined(__cplusplus) && __cplusplus >= 201402L
# define CONFIG_HAVE_CXX14 1
#else
# undef CONFIG_HAVE_CXX14
#endif
/* Attributes /* Attributes
* *
* GCC supports weak symbols which can be used to reduce code size because * GCC supports weak symbols which can be used to reduce code size because
@ -351,28 +373,6 @@
# endif # endif
/* ISO C11 supports anonymous (unnamed) structures and unions, added in
* GCC 4.6 (but might be suppressed with -std= option). ISO C++11 also
* adds un-named unions, but NOT unnamed structures (although compilers
* may support them).
*
* CAREFUL: This can cause issues for shared data structures shared between
* C and C++ if the two versions do not support the same features.
* Structures and unions can lose binary compatibility!
*
* NOTE: The NuttX coding standard forbids the use of unnamed structures and
* unions within the OS.
*/
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION
# if (defined(__cplusplus) && __cplusplus >= 201103L) || \
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
# define CONFIG_HAVE_ANONYMOUS_STRUCT 1
# define CONFIG_HAVE_ANONYMOUS_UNION 1
# endif
/* Indicate that a local variable is not used */ /* Indicate that a local variable is not used */
# define UNUSED(a) ((void)(1 || (a))) # define UNUSED(a) ((void)(1 || (a)))
@ -412,10 +412,6 @@
# pragma disable_warning 85 # pragma disable_warning 85
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* Attributes /* Attributes
* *
* SDCC does not support weak symbols * SDCC does not support weak symbols
@ -477,11 +473,6 @@
# define reentrant_function __reentrant # define reentrant_function __reentrant
/* ISO C11 supports anonymous (unnamed) structures and unions. Does SDCC? */
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION
/* Indicate that a local variable is not used */ /* Indicate that a local variable is not used */
# define UNUSED(a) ((void)(1 || (a))) # define UNUSED(a) ((void)(1 || (a)))
@ -564,10 +555,6 @@
# define IOBJ # define IOBJ
# define IPTR # define IPTR
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* Attributes /* Attributes
* *
* The Zilog compiler does not support weak symbols * The Zilog compiler does not support weak symbols
@ -655,13 +642,6 @@
# endif # endif
# endif # endif
/* ISO C11 supports anonymous (unnamed) structures and unions. Zilog does
* not support C11
*/
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION
/* Indicate that a local variable is not used */ /* Indicate that a local variable is not used */
# define UNUSED(a) ((void)(1 || (a))) # define UNUSED(a) ((void)(1 || (a)))
@ -729,17 +709,6 @@
# pragma section = ".data_init" # pragma section = ".data_init"
# pragma section = ".text" # pragma section = ".text"
/* C++ support */
# undef CONFIG_HAVE_CXX14
/* ISO C11 supports anonymous (unnamed) structures and unions. Does
* ICCARM?
*/
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION
/* Indicate that a local variable is not used */ /* Indicate that a local variable is not used */
# define UNUSED(a) ((void)(1 || (a))) # define UNUSED(a) ((void)(1 || (a)))
@ -761,7 +730,6 @@
# undef CONFIG_HAVE_FUNCTIONNAME # undef CONFIG_HAVE_FUNCTIONNAME
# undef CONFIG_HAVE_FILENAME # undef CONFIG_HAVE_FILENAME
# undef CONFIG_HAVE_WEAKFUNCTIONS # undef CONFIG_HAVE_WEAKFUNCTIONS
# undef CONFIG_HAVE_CXX14
# define weak_alias(name, aliasname) # define weak_alias(name, aliasname)
# define weak_data # define weak_data
# define weak_function # define weak_function
@ -802,8 +770,6 @@
# define CONFIG_HAVE_FLOAT 1 # define CONFIG_HAVE_FLOAT 1
# undef CONFIG_HAVE_DOUBLE # undef CONFIG_HAVE_DOUBLE
# undef CONFIG_HAVE_LONG_DOUBLE # undef CONFIG_HAVE_LONG_DOUBLE
# undef CONFIG_HAVE_ANONYMOUS_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION
# define UNUSED(a) ((void)(1 || (a))) # define UNUSED(a) ((void)(1 || (a)))