diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index c40e3b5cfe..49f9fdbeca 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -268,16 +268,23 @@ # endif /* ISO C11 supports anonymous (unnamed) structures and unions, added in - * GCC 4.6 (but might be suppressed with -std= option) + * 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) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) + +# if (defined(__cplusplus) && __cplusplus >= 201103L) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) # define CONFIG_HAVE_ANONYMOUS_STRUCT 1 # define CONFIG_HAVE_ANONYMOUS_UNION 1 # endif diff --git a/include/poll.h b/include/poll.h index aa23550314..ed97a8f23b 100644 --- a/include/poll.h +++ b/include/poll.h @@ -114,7 +114,7 @@ typedef uint8_t pollevent_t; struct pollfd { - /* Standard field */ + /* Standard fields */ int fd; /* The descriptor being polled */ pollevent_t events; /* The input event flags */