cpplib.c (do_if): Don't save and restore only_seen_white here.

* cpplib.c (do_if): Don't save and restore only_seen_white here.
	* cppexp.c (_cpp_parse_expr): Save and restore only_seen_white
	and skipping here.

From-SVN: r34260
This commit is contained in:
Zack Weinberg 2000-05-30 02:40:48 +00:00
parent 6a3dbe6543
commit 37dbf7aa9c
4 changed files with 34 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2000-05-29 Zack Weinberg <zack@wolery.cumb.org>
* cpplib.c (do_if): Don't save and restore only_seen_white here.
* cppexp.c (_cpp_parse_expr): Save and restore only_seen_white
and skipping here.
2000-05-29 Richard Earnshaw (rearnsha@arm.com)
* flow.c (mark_used_reg): If a register is unconditionally live,
@ -249,14 +255,14 @@ Sun May 28 23:26:59 2000 Philippe De Muyter <phdm@macqel.be>
2000-05-28 Neil Booth <NeilB@earthling.net>
* cpplex.c (_cpp_init_toklist): No comment space to initialise.
* cpplex.c (_cpp_init_toklist): No comment space to initialise.
(_cpp_free_toklist): No comment space to free.
(expand_comment_space): Remove.
(save_comment_space): Place the comment in the current token and
not in a separate comment space.
(_cpp_lex_line): Save comments during plain code and #define
directives only.
* cpplib.h (struct _cpp_toklist): Remove comment space.
(save_comment_space): Place the comment in the current token and
not in a separate comment space.
(_cpp_lex_line): Save comments during plain code and #define
directives only.
* cpplib.h (struct _cpp_toklist): Remove comment space.
2000-05-28 Neil Booth <NeilB@earthling.net>

View File

@ -843,6 +843,12 @@ _cpp_parse_expr (pfile)
int result;
char buff[5];
/* Save parser state and set it to something sane. */
int save_only_seen_white = pfile->only_seen_white;
int save_skipping = pfile->skipping;
pfile->only_seen_white = 0;
pfile->skipping = 0;
/* We've finished when we try to reduce this. */
top->op = FINISHED;
/* Nifty way to catch missing '('. */
@ -1162,5 +1168,7 @@ _cpp_parse_expr (pfile)
if (stack != init_stack)
free (stack);
CPP_SET_WRITTEN (pfile, old_written);
pfile->only_seen_white = save_only_seen_white;
pfile->skipping = save_skipping;
return result;
}

View File

@ -1186,15 +1186,11 @@ do_if (pfile)
{
const cpp_hashnode *cmacro = 0;
int value = 0;
int save_only_seen_white = pfile->only_seen_white;
if (! pfile->skipping)
{
cmacro = detect_if_not_defined (pfile);
pfile->only_seen_white = 0;
value = _cpp_parse_expr (pfile);
pfile->only_seen_white = save_only_seen_white;
}
push_conditional (pfile, value == 0, T_IF, cmacro);
return 0;

View File

@ -0,0 +1,14 @@
/* Regression test for bug with macro expansion on #if lines -
exposed by glibc. */
/* { dg-do compile } */
# define SHLIB_COMPAT(lib, introduced, obsoleted) \
(!(ABI_##lib##_##obsoleted - 0) \
|| ((ABI_##lib##_##introduced - 0) < (ABI_##lib##_##obsoleted - 0)))
#if 0
bad
#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
int
#endif
x;