+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,
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>
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 '('. */
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;
}
{
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;
--- /dev/null
+/* 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;