From a5183e3460a03df4dc388eb6f7715b25a84a5194 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 21 Feb 2019 18:06:53 -0600 Subject: [PATCH] include/poll.h and include/nuttx/compiler.h: Update some comments; improved a conditional test. --- include/nuttx/compiler.h | 11 +++++++++-- include/poll.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) 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 */