[Mesa-dev] [PATCH] program: use extern "C" where appropriate in sampler.cpp

Mark Janes mark.a.janes at intel.com
Tue Dec 16 13:08:26 PST 2014


`make check` fails to link test_vec4_copy_propagation after 6dac455e.
---
 src/mesa/program/sampler.cpp | 5 ++---
 src/mesa/program/sampler.h   | 7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index f8584c9..7754a41 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -102,8 +102,7 @@ public:
    ir_dereference *last;
 };
 
-
-int
+extern "C" int
 _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
 				struct gl_shader_program *shader_program,
 				const struct gl_program *prog)
@@ -135,7 +134,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
 }
 
 
-class ir_rvalue *
+extern "C" class ir_rvalue *
 _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler)
 {
    ir_dereference_array *deref_arr = sampler->as_dereference_array();
diff --git a/src/mesa/program/sampler.h b/src/mesa/program/sampler.h
index 61c7f58..d5faa40 100644
--- a/src/mesa/program/sampler.h
+++ b/src/mesa/program/sampler.h
@@ -26,6 +26,9 @@
 #ifndef SAMPLER_H
 #define SAMPLER_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 int
 _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
@@ -35,5 +38,9 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
 class ir_rvalue *
 _mesa_get_sampler_array_nonconst_index(class ir_dereference *sampler);
 
+#ifdef __cplusplus
+}
+#endif
+
 
 #endif /* SAMPLER_H */
-- 
2.1.3



More information about the mesa-dev mailing list