include/poll.h: Remove un-named union from 'struct pollfd'. It is not required by OpenGroup.org and violates the NuttX C coding standard because it is not C89 compatible.

This commit is contained in:
Gregory Nutt 2019-02-21 17:40:30 -06:00
parent 40889daf97
commit 94fe5c8349
2 changed files with 10 additions and 14 deletions

View File

@ -269,6 +269,10 @@
/* ISO C11 supports anonymous (unnamed) structures and unions, added in
* GCC 4.6 (but might be suppressed with -std= option)
*
* 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!
*/
# undef CONFIG_HAVE_ANONYMOUS_STRUCT

View File

@ -114,24 +114,16 @@ typedef uint8_t pollevent_t;
struct pollfd
{
/* REVISIT: Un-named unions are forbidden by the coding standard because
* they are not available in C89.
*/
/* Standard field */
#ifdef CONFIG_HAVE_ANONYMOUS_UNION
union
{
int fd; /* The descriptor being polled */
FAR void *ptr; /* The psock or file being polled */
};
#else
int fd; /* The descriptor being polled */
FAR void *ptr; /* The psock or file being polled */
#endif
FAR sem_t *sem; /* Pointer to semaphore used to post output event */
pollevent_t events; /* The input event flags */
pollevent_t revents; /* The output event flags */
/* Non-standard fields used internally by NuttX */
FAR void *ptr; /* The psock or file being polled */
FAR sem_t *sem; /* Pointer to semaphore used to post output event */
FAR void *priv; /* For use by drivers */
};