On Fri, Jun 6, 2014 at 9:42 PM, Ian Romanick <i...@freedesktop.org> wrote: > I thought Matt already fixed this bug. A basic testing shows that below commit fixed the "garbage after #endif" bug but "#garbage after #else" bug still exists. Absence of tests kept it untested.
> > commit 060e69679925f171cfcc2a5f84fab1d833a7e804 > Author: Matt Turner <matts...@gmail.com> > Date: Tue Nov 6 10:59:30 2012 -0800 > > glcpp: Reject garbage after #else and #endif tokens > > Previously we were accepting garbage after #else and #endif tokens when > the previous preprocessor conditional evaluated to false (eg, #if 0). > > When the preprocessor hits a false conditional, it switches the lexer > into the SKIP state, in which it ignores non-control tokens. The parser > pops the SKIP state off the stack when it reaches the associated #elif, > #else, or #endif. Unfortunately, that meant that it only left the SKIP > state after the lexing the entire line containing the #token and thus > would accept garbage after the #token. > > To fix this we use a mid-rule, which is executed immediately after the > #token is parsed. > > NOTE: This is a candidate for the stable branch > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56442 > Fixes: preprocess17_frag.test from oglconform > Reviewed-by: Carl Worth <cwo...@cworth.org> (glcpp-parse.y) > Acked-by: Ian Romanick <ian.d.roman...@intel.com> > Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> > > On 06/06/2014 04:57 PM, Anuj Phogat wrote: >> Fixes gles3 Khronos CTS tests: >> tokens_after_else_vertex >> tokens_after_else_fragment >> >> Cc: <mesa-sta...@lists.freedesktop.org> >> Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com> >> --- >> src/glsl/glcpp/glcpp-lex.l | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l >> index 188e454..393db81 100644 >> --- a/src/glsl/glcpp/glcpp-lex.l >> +++ b/src/glsl/glcpp/glcpp-lex.l >> @@ -221,6 +221,10 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]? >> return HASH_ELSE; >> } >> >> +{HASH}else{HSPACE}*[^ \t\n]+ { >> + glcpp_error(yylloc, yyextra, "illegal tokens after #else"); >> +} >> + >> {HASH}endif { >> yyextra->space_tokens = 0; >> return HASH_ENDIF; >> > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev