From 62b4b7785a01f11e7fcd9bf76dae6b3c0a16d537 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 21 Jun 2010 12:39:49 -0700 Subject: [PATCH] glcpp: Add boolean 'error' flag. We used to check if the info log is non-empty, but when we print warnings, this will no longer be valid. --- glcpp/glcpp.h | 1 + glcpp/pp.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/glcpp/glcpp.h b/glcpp/glcpp.h index e67469be2eb..8167a481d5e 100644 --- a/glcpp/glcpp.h +++ b/glcpp/glcpp.h @@ -155,6 +155,7 @@ struct glcpp_parser { token_node_t *lex_from_node; char *output; char *info_log; + int error; }; glcpp_parser_t * diff --git a/glcpp/pp.c b/glcpp/pp.c index f8a7c2ea4d5..846d35506fb 100644 --- a/glcpp/pp.c +++ b/glcpp/pp.c @@ -26,6 +26,7 @@ void glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) { + parser->error = 1; parser->info_log = talloc_asprintf_append(parser->info_log, "%u:%u(%u): " "preprocessor error: ", @@ -48,13 +49,13 @@ preprocess(void *talloc_ctx, const char **shader, size_t *shader_len) glcpp_parser_parse (parser); - errors = parser->info_log[0] != '\0'; printf("%s", parser->info_log); talloc_steal(talloc_ctx, parser->output); *shader = parser->output; *shader_len = strlen(parser->output); + errors = parser->error; glcpp_parser_destroy (parser); return errors; } -- 2.30.2