[Mesa-dev] [PATCH 01/15] glsl: Add __FILE__ and __LINE__ as built-in macros

Anuj Phogat anuj.phogat at gmail.com
Fri Jun 6 16:56:57 PDT 2014


A compile error will be generated for redefinition of these macros.

Cc: <mesa-stable at lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/glsl/glcpp/glcpp-parse.y | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9887583..2ddc8b9 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -2053,6 +2053,8 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
 
 	parser->version_resolved = true;
 
+	add_builtin_define (parser, "__FILE__", version);
+	add_builtin_define (parser, "__LINE__", version);
 	add_builtin_define (parser, "__VERSION__", version);
 
 	parser->is_gles = (version == 100) ||
-- 
1.8.3.1



More information about the mesa-dev mailing list