Mesa (glsl-pp-rework-2): glsl/pp: Fix macro formal argument parsing, more descriptive error msgs.

Michał Król michal at kemper.freedesktop.org
Tue Nov 17 08:19:24 UTC 2009


Module: Mesa
Branch: glsl-pp-rework-2
Commit: 547ac2869b1e1bbdbf8e51cd40d50e6ab0f4f9f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=547ac2869b1e1bbdbf8e51cd40d50e6ab0f4f9f1

Author: Michal Krol <michal at vmware.com>
Date:   Tue Nov 17 09:06:53 2009 +0100

glsl/pp: Fix macro formal argument parsing, more descriptive error msgs.

---

 src/glsl/pp/sl_pp_define.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glsl/pp/sl_pp_define.c b/src/glsl/pp/sl_pp_define.c
index d18a7ee..e004c9f 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;
    }
 




More information about the mesa-commit mailing list