glsl: glcpp: Move handling of #line directives from lexer to parser.
The GLSL specification requires that #line directives be interpreted after macro expansion. Our existing implementation of #line macros in the lexer prevents conformance on this point. Moving the handling of #line from the lexer to the parser gives us the macro expansion we need. An additional benefit is that the preprocessor also now supports comments on the same line as #line directives. Finally, the preprocessor now emits the (fully-macro-expanded) #line directives into the output. This allows the full GLSL compiler to also see and interpret these directives so it can also generate correct line numbers in error messages. Signed-off-by: Carl Worth <cworth@cworth.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#define GLCPP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "../ralloc.h"
|
||||
|
||||
@@ -177,6 +178,10 @@ struct glcpp_parser {
|
||||
size_t output_length;
|
||||
size_t info_log_length;
|
||||
int error;
|
||||
bool has_new_line_number;
|
||||
int new_line_number;
|
||||
bool has_new_source_number;
|
||||
int new_source_number;
|
||||
};
|
||||
|
||||
struct gl_extensions;
|
||||
|
Reference in New Issue
Block a user