mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-19 03:28:58 +08:00
system.h (UNION_INIT_ZERO): New macro for initializing union members in structs.
* system.h (UNION_INIT_ZERO): New macro for initializing union members in structs. * cpplex.c (placemarker_token, eof_token): Use UNION_INIT_ZERO. From-SVN: r34904
This commit is contained in:
parent
d199cba40a
commit
7de9cc38c3
@ -1,3 +1,10 @@
|
||||
2000-07-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* system.h (UNION_INIT_ZERO): New macro for initializing union
|
||||
members in structs.
|
||||
|
||||
* cpplex.c (placemarker_token, eof_token): Use UNION_INIT_ZERO.
|
||||
|
||||
2000-07-07 Neil Booth <NeilB@earthling.net>
|
||||
|
||||
* cpp.texi: Update.
|
||||
|
@ -1935,8 +1935,8 @@ spell_token (pfile, token, buffer)
|
||||
|
||||
/* Macro expansion algorithm. TODO. */
|
||||
|
||||
static const cpp_token placemarker_token = {0, 0, CPP_PLACEMARKER, 0, {0}};
|
||||
static const cpp_token eof_token = {0, 0, CPP_EOF, 0, {0}};
|
||||
static const cpp_token placemarker_token = {0, 0, CPP_PLACEMARKER, 0 UNION_INIT_ZERO};
|
||||
static const cpp_token eof_token = {0, 0, CPP_EOF, 0 UNION_INIT_ZERO};
|
||||
|
||||
#define IS_ARG_CONTEXT(c) ((c)->flags & CONTEXT_ARG)
|
||||
#define CURRENT_CONTEXT(pfile) ((pfile)->contexts + (pfile)->cur_context)
|
||||
|
10
gcc/system.h
10
gcc/system.h
@ -600,4 +600,14 @@ extern void abort PARAMS ((void));
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
/* Traditional C cannot initialize union members of structs. Provide
|
||||
a macro which expands appropriately to handle it. This only works
|
||||
if you intend to initalize the union member to zero since it relies
|
||||
on default initialization to zero in the traditional C case. */
|
||||
#ifdef __STDC__
|
||||
#define UNION_INIT_ZERO , {0}
|
||||
#else
|
||||
#define UNION_INIT_ZERO
|
||||
#endif
|
||||
|
||||
#endif /* __GCC_SYSTEM_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user