Mesa (glsl-pp-rework-2): glsl/pp: Add more error messages.

Michał Król michal at kemper.freedesktop.org
Wed Sep 16 18:28:27 UTC 2009


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

Author: Michal Krol <michal at vmware.com>
Date:   Wed Sep 16 20:27:59 2009 +0200

glsl/pp: Add more error messages.

---

 src/glsl/pp/sl_pp_process.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/glsl/pp/sl_pp_process.c b/src/glsl/pp/sl_pp_process.c
index c4d6efa..03a3051 100644
--- a/src/glsl/pp/sl_pp_process.c
+++ b/src/glsl/pp/sl_pp_process.c
@@ -81,11 +81,13 @@ sl_pp_process(struct sl_pp_context *context,
       ti.token = SL_PP_LINE;
       ti.data.line = context->line - 1;
       if (sl_pp_process_out(&state, &ti)) {
+         strcpy(context->error_msg, "out of memory");
          return -1;
       }
 
       ti.token = SL_PP_NEWLINE;
       if (sl_pp_process_out(&state, &ti)) {
+         strcpy(context->error_msg, "out of memory");
          return -1;
       }
    }
@@ -189,6 +191,7 @@ sl_pp_process(struct sl_pp_context *context,
                }
 
                if (sl_pp_process_out(&state, &endof)) {
+                  strcpy(context->error_msg, "out of memory");
                   return -1;
                }
                context->line++;
@@ -198,6 +201,7 @@ sl_pp_process(struct sl_pp_context *context,
          case SL_PP_NEWLINE:
             /* Empty directive. */
             if (sl_pp_process_out(&state, &input[i])) {
+               strcpy(context->error_msg, "out of memory");
                return -1;
             }
             context->line++;
@@ -207,6 +211,7 @@ sl_pp_process(struct sl_pp_context *context,
          case SL_PP_EOF:
             /* Empty directive. */
             if (sl_pp_process_out(&state, &input[i])) {
+               strcpy(context->error_msg, "out of memory");
                return -1;
             }
             i++;
@@ -214,6 +219,7 @@ sl_pp_process(struct sl_pp_context *context,
             break;
 
          default:
+            strcpy(context->error_msg, "expected a directive name");
             return -1;
          }
       } else {
@@ -229,6 +235,7 @@ sl_pp_process(struct sl_pp_context *context,
             case SL_PP_NEWLINE:
                /* Preserve newline just for the sake of line numbering. */
                if (sl_pp_process_out(&state, &input[i])) {
+                  strcpy(context->error_msg, "out of memory");
                   return -1;
                }
                context->line++;
@@ -238,6 +245,7 @@ sl_pp_process(struct sl_pp_context *context,
 
             case SL_PP_EOF:
                if (sl_pp_process_out(&state, &input[i])) {
+                  strcpy(context->error_msg, "out of memory");
                   return -1;
                }
                i++;
@@ -254,6 +262,7 @@ sl_pp_process(struct sl_pp_context *context,
             default:
                if (context->if_value) {
                   if (sl_pp_process_out(&state, &input[i])) {
+                     strcpy(context->error_msg, "out of memory");
                      return -1;
                   }
                }
@@ -264,7 +273,7 @@ sl_pp_process(struct sl_pp_context *context,
    }
 
    if (context->if_ptr != SL_PP_MAX_IF_NESTING) {
-      /* #endif expected. */
+      strcpy(context->error_msg, "expected `#endif' directive");
       return -1;
    }
 




More information about the mesa-commit mailing list