diff options
author | Michal Krol <[email protected]> | 2009-09-23 09:33:12 +0200 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-09-23 09:33:12 +0200 |
commit | 32966991c629fa43818f42912deb9deca913ef60 (patch) | |
tree | 7a11eeeaf3e97aa9d6abb9593af371eb6b5b6ad9 /src/glsl | |
parent | b1e6514a94effb1a5ea03c31f5a50e9e60638e51 (diff) |
glsl/pp: Check for reserved macro names.
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/pp/sl_pp_define.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/glsl/pp/sl_pp_define.c b/src/glsl/pp/sl_pp_define.c index 391178aa696..d18a7ee2895 100644 --- a/src/glsl/pp/sl_pp_define.c +++ b/src/glsl/pp/sl_pp_define.c @@ -26,7 +26,9 @@ **************************************************************************/ #include <stdlib.h> +#include <string.h> #include "sl_pp_process.h" +#include "sl_pp_public.h" static void @@ -126,6 +128,20 @@ sl_pp_process_define(struct sl_pp_context *context, return -1; } + /* Check for reserved macro names */ + { + const char *name = sl_pp_context_cstr(context, macro_name); + + if (strstr(name, "__")) { + strcpy(context->error_msg, "macro names containing `__' are reserved"); + return 1; + } + if (name[0] == 'G' && name[1] == 'L' && name[2] == '_') { + strcpy(context->error_msg, "macro names prefixed with `GL_' are reserved"); + return 1; + } + } + for (macro = context->macro; macro; macro = macro->next) { if (macro->name == macro_name) { break; |