include/poll.h and include/nuttx/compiler.h: Update some comments; improved a conditional test.

This commit is contained in:
Gregory Nutt 2019-02-21 18:06:53 -06:00
parent 94fe5c8349
commit a5183e3460
2 changed files with 10 additions and 3 deletions

View File

@ -268,16 +268,23 @@
# endif # endif
/* ISO C11 supports anonymous (unnamed) structures and unions, added in /* 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 * 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 * C and C++ if the two versions do not support the same features. Structures
* and unions can lose binary compatibility! * 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_STRUCT
# undef CONFIG_HAVE_ANONYMOUS_UNION # 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_STRUCT 1
# define CONFIG_HAVE_ANONYMOUS_UNION 1 # define CONFIG_HAVE_ANONYMOUS_UNION 1
# endif # endif

View File

@ -114,7 +114,7 @@ typedef uint8_t pollevent_t;
struct pollfd struct pollfd
{ {
/* Standard field */ /* Standard fields */
int fd; /* The descriptor being polled */ int fd; /* The descriptor being polled */
pollevent_t events; /* The input event flags */ pollevent_t events; /* The input event flags */