From 74704e80c69f400f7712aed4287a84adc13bfbed Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 21 Jun 2010 11:47:55 -0700 Subject: [PATCH] glcpp: Print to the main compiler's infolog, not stdout. --- glcpp/pp.c | 4 ++-- glsl_parser_extras.h | 2 +- main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glcpp/pp.c b/glcpp/pp.c index e6921db46b5..5455518c7c7 100644 --- a/glcpp/pp.c +++ b/glcpp/pp.c @@ -57,7 +57,7 @@ glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...) } extern int -preprocess(void *talloc_ctx, const char **shader) +preprocess(void *talloc_ctx, const char **shader, char **info_log) { int errors; glcpp_parser_t *parser = glcpp_parser_create (); @@ -65,7 +65,7 @@ preprocess(void *talloc_ctx, const char **shader) glcpp_parser_parse (parser); - printf("%s", parser->info_log); + *info_log = talloc_strdup_append(*info_log, parser->info_log); talloc_steal(talloc_ctx, parser->output); *shader = parser->output; diff --git a/glsl_parser_extras.h b/glsl_parser_extras.h index 1edd86bc6ea..87de9083c06 100644 --- a/glsl_parser_extras.h +++ b/glsl_parser_extras.h @@ -102,7 +102,7 @@ extern void _mesa_glsl_warning(const YYLTYPE *locp, const char *fmt, ...); extern "C" { -extern int preprocess(void *ctx, const char **shader); +extern int preprocess(void *ctx, const char **shader, char **info_log); } extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, diff --git a/main.cpp b/main.cpp index 25904380c95..7f094f8e3e4 100644 --- a/main.cpp +++ b/main.cpp @@ -128,7 +128,7 @@ compile_shader(struct glsl_shader *shader) * should probably be the parser context, but there isn't one yet. */ const char *source = shader->Source; - state.error = preprocess(shader, &source); + state.error = preprocess(shader, &source, &state.info_log); if (!state.error) { _mesa_glsl_lexer_ctor(& state, source); -- 2.30.2