From 547ac2869b1e1bbdbf8e51cd40d50e6ab0f4f9f1 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 17 Nov 2009 09:06:53 +0100 Subject: [PATCH] glsl/pp: Fix macro formal argument parsing, more descriptive error msgs. --- src/glsl/pp/sl_pp_define.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/glsl/pp/sl_pp_define.c b/src/glsl/pp/sl_pp_define.c index d18a7ee2895..e004c9f95b9 100644 --- a/src/glsl/pp/sl_pp_define.c +++ b/src/glsl/pp/sl_pp_define.c @@ -60,7 +60,7 @@ _parse_formal_args(struct sl_pp_context *context, return 0; } } else { - strcpy(context->error_msg, "expected either an identifier or `)'"); + strcpy(context->error_msg, "expected either macro formal argument or `)'"); return -1; } @@ -68,7 +68,7 @@ _parse_formal_args(struct sl_pp_context *context, for (;;) { if (*first < last && input[*first].token != SL_PP_IDENTIFIER) { - strcpy(context->error_msg, "expected an identifier"); + strcpy(context->error_msg, "expected macro formal argument"); return -1; } @@ -90,6 +90,7 @@ _parse_formal_args(struct sl_pp_context *context, if (*first < last) { if (input[*first].token == SL_PP_COMMA) { (*first)++; + skip_whitespace(input, first, last); } else if (input[*first].token == SL_PP_RPAREN) { (*first)++; return 0; @@ -124,7 +125,7 @@ sl_pp_process_define(struct sl_pp_context *context, first++; } if (macro_name == -1) { - strcpy(context->error_msg, "expected an identifier"); + strcpy(context->error_msg, "expected macro name"); return -1; } -- 2.30.2