Commit 7de9cc38 by Kaveh R. Ghazi Committed by Kaveh Ghazi

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
parent d199cba4
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)
......
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment