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:
Kaveh R. Ghazi 2000-07-07 14:29:03 +00:00 committed by Kaveh Ghazi
parent d199cba40a
commit 7de9cc38c3
3 changed files with 19 additions and 2 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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__ */