summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/glcpp.h
diff options
context:
space:
mode:
authorCarl Worth <[email protected]>2012-06-09 16:31:06 -0700
committerCarl Worth <[email protected]>2012-06-26 15:23:49 -0700
commitaac78ce8234d96932c38b3f48b1d828077bc0027 (patch)
treea4e067870c6e57d69aeb68f8ea6717adf4cdee78 /src/glsl/glcpp/glcpp.h
parent39f8c46eaa4d1c3b072cd97d256fe973c1791b14 (diff)
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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/glcpp/glcpp.h')
-rw-r--r--src/glsl/glcpp/glcpp.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h
index 2d7cad2e601..a13ade69ee4 100644
--- a/src/glsl/glcpp/glcpp.h
+++ b/src/glsl/glcpp/glcpp.h
@@ -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;