Mesa (master): glsl: Make _mesa_print_ir() available from anything including ir.h.
Eric Anholt
anholt at kemper.freedesktop.org
Fri Jun 21 17:33:06 UTC 2013
Module: Mesa
Branch: master
Commit: 2b049aa53e12accf2c5be88d1d9b66dbcab47bfb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b049aa53e12accf2c5be88d1d9b66dbcab47bfb
Author: Eric Anholt <eric at anholt.net>
Date: Wed Jun 12 16:10:33 2013 -0700
glsl: Make _mesa_print_ir() available from anything including ir.h.
No more forgetting to #include "ir_print_visitor.h" when doing temporary
debug code, or forgetting and leaving it in after removing your temporary
debug code. Also, available from C code so you don't need to move the
caller to C++ just to call it (see also: ir_to_mesa.cpp).
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
---
src/glsl/ir.h | 8 ++++++++
src/glsl/ir_print_visitor.cpp | 3 +++
src/glsl/ir_print_visitor.h | 3 ---
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 9442681..1f0dc09 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -2052,6 +2052,14 @@ extern char *
prototype_string(const glsl_type *return_type, const char *name,
exec_list *parameters);
+extern "C" {
#endif /* __cplusplus */
+extern void _mesa_print_ir(struct exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
#endif /* IR_H */
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index f01019c..ca973a5 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -38,6 +38,7 @@ ir_instruction::print(void) const
deconsted->accept(&v);
}
+extern "C" {
void
_mesa_print_ir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -69,6 +70,8 @@ _mesa_print_ir(exec_list *instructions,
printf("\n)");
}
+} /* extern "C" */
+
ir_print_visitor::ir_print_visitor()
{
indentation = 0;
diff --git a/src/glsl/ir_print_visitor.h b/src/glsl/ir_print_visitor.h
index 6c308f3..a84056d 100644
--- a/src/glsl/ir_print_visitor.h
+++ b/src/glsl/ir_print_visitor.h
@@ -33,9 +33,6 @@ extern "C" {
#include "program/symbol_table.h"
}
-extern void _mesa_print_ir(exec_list *instructions,
- struct _mesa_glsl_parse_state *state);
-
/**
* Abstract base class of visitors of IR instruction trees
*/
More information about the mesa-commit
mailing list