mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
glsl/pp: Check for reserved macro names.
This commit is contained in:
parent
b1e6514a94
commit
32966991c6
1 changed files with 16 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue