[Mesa-dev] [PATCH 2/7] linker: Make linker_{error, warning}_printf generally available

Ian Romanick idr at freedesktop.org
Mon Aug 1 10:20:18 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

linker_warning_printf is a new function.  It's identical to
linker_error_printf except that it doesn't set LinkStatus=false and it
prepends "warning: " on messages instead of "error: ".
---
 src/glsl/ir_function_detect_recursion.cpp |    1 +
 src/glsl/linker.cpp                       |   13 +++++++++++++
 src/glsl/linker.h                         |    3 ---
 src/glsl/program.h                        |    8 ++++++++
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ir_function_detect_recursion.cpp b/src/glsl/ir_function_detect_recursion.cpp
index 44a1cd0..e79f029 100644
--- a/src/glsl/ir_function_detect_recursion.cpp
+++ b/src/glsl/ir_function_detect_recursion.cpp
@@ -125,6 +125,7 @@
 #include "glsl_parser_extras.h"
 #include "linker.h"
 #include "program/hash_table.h"
+#include "program.h"
 
 struct call_node : public exec_node {
    class function *func;
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c260f29..994c631 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -178,6 +178,19 @@ linker_error_printf(gl_shader_program *prog, const char *fmt, ...)
 
 
 void
+linker_warning_printf(gl_shader_program *prog, const char *fmt, ...)
+{
+   va_list ap;
+
+   ralloc_strcat(&prog->InfoLog, "error: ");
+   va_start(ap, fmt);
+   ralloc_vasprintf_append(&prog->InfoLog, fmt, ap);
+   va_end(ap);
+
+}
+
+
+void
 invalidate_variable_locations(gl_shader *sh, enum ir_variable_mode mode,
 			      int generic_base)
 {
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index a8ce16a..769cf68 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -25,9 +25,6 @@
 #ifndef GLSL_LINKER_H
 #define GLSL_LINKER_H
 
-extern void
-linker_error_printf(gl_shader_program *prog, const char *fmt, ...);
-
 extern bool
 link_function_calls(gl_shader_program *prog, gl_shader *main,
 		    gl_shader **shader_list, unsigned num_shaders);
diff --git a/src/glsl/program.h b/src/glsl/program.h
index db602fa..2f147bc 100644
--- a/src/glsl/program.h
+++ b/src/glsl/program.h
@@ -25,3 +25,11 @@
 
 extern void
 link_shaders(struct gl_context *ctx, struct gl_shader_program *prog);
+
+extern void
+linker_error_printf(gl_shader_program *prog, const char *fmt, ...)
+   PRINTFLIKE(2, 3);
+
+extern void
+linker_warning_printf(gl_shader_program *prog, const char *fmt, ...)
+   PRINTFLIKE(2, 3);
-- 
1.7.4.4



More information about the mesa-dev mailing list