summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/glcpp-parse.y
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2014-06-25 13:28:38 -0700
committerCarl Worth <cworth@cworth.org>2014-07-29 15:11:50 -0700
commitfe1e0ac8524677c40c84f238650e0e198f0e8d36 (patch)
tree5bec0908f05960faced72ef28e5c95435ec17e48 /src/glsl/glcpp/glcpp-parse.y
parent18c589d20ea684f6415b28d563fd2edaae0d7b2c (diff)
downloadexternal_mesa3d-fe1e0ac8524677c40c84f238650e0e198f0e8d36.zip
external_mesa3d-fe1e0ac8524677c40c84f238650e0e198f0e8d36.tar.gz
external_mesa3d-fe1e0ac8524677c40c84f238650e0e198f0e8d36.tar.bz2
glsl/glcpp: Add an explanatory comment for "loc != NULL" check
Just reading the code, it looked like a bug that _define_object_macro had this check, but _define_function_macro did not. Upon further reading, that's because the check is to allow for our builtins to be defined, (and there are no builtin function-like macros). Add my new understanding as a comment to help the next reader. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src/glsl/glcpp/glcpp-parse.y')
-rw-r--r--src/glsl/glcpp/glcpp-parse.y4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 9b753dd..f758345 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1944,6 +1944,10 @@ _define_object_macro (glcpp_parser_t *parser,
{
macro_t *macro, *previous;
+ /* We define pre-defined macros before we've started parsing the
+ * actual file. So if there's no location defined yet, that's what
+ * were doing and we don't want to generate an error for using the
+ * reserved names. */
if (loc != NULL)
_check_for_reserved_macro_name(parser, loc, identifier);