Jacek Caban : wpp: Skip parsing #if expression if it's ignored anyway.
Alexandre Julliard
julliard at winehq.org
Mon Nov 12 16:26:54 CST 2018
Module: wine
Branch: master
Commit: bdea31c1772eb480165bcb9e92991a4377bb6cee
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bdea31c1772eb480165bcb9e92991a4377bb6cee
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Nov 9 20:50:15 2018 +0100
wpp: Skip parsing #if expression if it's ignored anyway.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/wpp/ppl.l | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index 243049a..1a04860 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -150,6 +150,7 @@
%x pp_macexp
%x pp_if
%x pp_ifd
+%x pp_ifignored
%x pp_endif
%x pp_line
%x pp_defined
@@ -390,7 +391,7 @@ void pp_writestring(const char *format, ...)
<pp_pp>{ws}*undef{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
<pp_pp>{ws}*ifdef{ws}* yy_pp_state(pp_ifd); return tIFDEF;
<pp_pp>{ws}*ifndef{ws}* pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF;
-<pp_pp>{ws}*if{ws}* yy_pp_state(pp_if); return tIF;
+<pp_pp>{ws}*if{ws}* if(yy_top_state() != pp_ignore) {yy_pp_state(pp_if);} else {yy_pp_state(pp_ifignored);} return tIF;
<pp_pp>{ws}*elif{ws}* yy_pp_state(pp_if); return tELIF;
<pp_pp>{ws}*else{ws}* yy_pp_state(pp_endif); return tELSE;
<pp_pp>{ws}*endif{ws}* yy_pp_state(pp_endif); return tENDIF;
@@ -450,6 +451,9 @@ void pp_writestring(const char *format, ...)
<pp_if>\" ppy_error("String constants not allowed in conditionals");
<pp_if>. return *ppy_text;
+<pp_ifignored>[^\n]+ ppy_lval.sint = 0; return tSINT;
+<pp_ifignored>\n newline(1); yy_pop_state(); return tNL;
+
/*
* Handle #ifdef, #ifndef and #undef
* to get only an untranslated/unexpanded identifier
More information about the wine-cvs
mailing list