glsl: Make _mesa_print_ir() available from anything including ir.h.
authorEric Anholt <eric@anholt.net>
Wed, 12 Jun 2013 23:10:33 +0000 (16:10 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 21 Jun 2013 17:04:29 +0000 (10:04 -0700)
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@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/glsl/ir.h
src/glsl/ir_print_visitor.cpp
src/glsl/ir_print_visitor.h

index 94426812bbd2101739adfffd439b2f9c6126ffd6..1f0dc0906a1fba821c3a87a169ac61f2fba0b4d0 100644 (file)
@@ -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 */
index f01019c9877029fda383cda8bfddfd0593e3f7b2..ca973a5f38ec468a0e7d7751f65a4eb6f87a8dd4 100644 (file)
@@ -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;
index 6c308f31e9563d7dcf3ec3858cf28553a98178e5..a84056d16b0a676a0896fffb182f9e945ca75946 100644 (file)
@@ -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
  */