From a801ca76642d87ae20c7c63903c5c24fabe94db0 Mon Sep 17 00:00:00 2001 From: Fabian Bieler Date: Tue, 24 Jul 2012 15:36:46 +0200 Subject: [PATCH] glsl: glcpp: don't push #line directives into next line --- src/glsl/glcpp/glcpp-parse.y | 20 ++++++++++---------- src/glsl/glcpp/tests/091-hash-line.c.expected | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y index c0c1ca1..f16d8e4 100644 --- a/src/glsl/glcpp/glcpp-parse.y +++ b/src/glsl/glcpp/glcpp-parse.y @@ -192,6 +192,14 @@ line: control_line { ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n"); } +| HASH_LINE pp_tokens NEWLINE { + if (parser->skip_stack == NULL || + parser->skip_stack->type == SKIP_NO_SKIP) + { + _glcpp_parser_expand_and_lex_from (parser, + LINE_EXPANDED, $2); + } + } | text_line { _glcpp_parser_print_expanded_token_list (parser, $1); ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, "\n"); @@ -213,7 +221,7 @@ expanded_line: parser->new_line_number = $2; ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, - "#line %" PRIiMAX, + "#line %" PRIiMAX "\n", $2); } | LINE_EXPANDED integer_constant integer_constant NEWLINE { @@ -223,7 +231,7 @@ expanded_line: parser->new_source_number = $3; ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length, - "#line %" PRIiMAX " %" PRIiMAX, + "#line %" PRIiMAX " %" PRIiMAX "\n", $2, $3); } ; @@ -246,14 +254,6 @@ control_line: } ralloc_free ($2); } -| HASH_LINE pp_tokens NEWLINE { - if (parser->skip_stack == NULL || - parser->skip_stack->type == SKIP_NO_SKIP) - { - _glcpp_parser_expand_and_lex_from (parser, - LINE_EXPANDED, $2); - } - } | HASH_IF conditional_tokens NEWLINE { /* Be careful to only evaluate the 'if' expression if * we are not skipping. When we are skipping, we diff --git a/src/glsl/glcpp/tests/091-hash-line.c.expected b/src/glsl/glcpp/tests/091-hash-line.c.expected index 976d178..48af0b2 100644 --- a/src/glsl/glcpp/tests/091-hash-line.c.expected +++ b/src/glsl/glcpp/tests/091-hash-line.c.expected @@ -2,7 +2,6 @@ 0:25(1): preprocessor error: #error line 25 error 1:0(1): preprocessor error: #error source 1, line 0 error 2:30(1): preprocessor error: #error source 2, line 30 error - #line 0 #line 25 @@ -17,3 +16,4 @@ #line 90 2 #line 180 2 + -- 1.7.9.5