i965: Make brw_{shader,vec4}.h safe to include from C.
authorPaul Berry <stereotype441@gmail.com>
Wed, 21 Aug 2013 14:53:42 +0000 (07:53 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 23 Aug 2013 18:02:40 +0000 (11:02 -0700)
The patch that follows will move the definition of struct
brw_vec4_prog_key from brw_vs.h to brw_vec4.h, making it necessary for
brw_vs.h to include brw_vec4.h (because brw_vs.h defines struct
brw_vs_prog_key, which contains brw_vec4_prog_key as a member).  Since
brw_vs.h is included from C source files, that means that brw_vec4.h
will need to be safe to include from C.  Same for brw_shader.h, since
it is included by brw_vec4.h.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4.h

index e7d3fb6e0199b0351cbfdf337b79aa1e9d401f34..55769ff2e39ebd182cdb896a5ed64c3ebf334343 100644 (file)
@@ -38,6 +38,8 @@ enum register_file {
    UNIFORM, /* prog_data->params[reg] */
 };
 
+#ifdef __cplusplus
+
 class backend_instruction : public exec_node {
 public:
    bool is_tex();
@@ -71,8 +73,11 @@ public:
    void dump_instructions();
 };
 
+uint32_t brw_texture_offset(ir_constant *offset);
+
+#endif /* __cplusplus */
+
 int brw_type_for_base_type(const struct glsl_type *type);
 uint32_t brw_conditional_for_comparison(unsigned int op);
 uint32_t brw_math_function(enum opcode op);
-uint32_t brw_texture_offset(ir_constant *offset);
 const char *brw_instruction_name(enum opcode op);
index b331372d16c2db34c45e451e9d33e3a4c9d60f79..e46d2b170f1ea26649778244024bf59a89bf1a05 100644 (file)
 #include "main/compiler.h"
 #include "program/hash_table.h"
 
+#ifdef __cplusplus
 extern "C" {
+#endif
+
 #include "brw_context.h"
 #include "brw_eu.h"
-};
+
+#ifdef __cplusplus
+}; /* extern "C" */
+#endif
 
 #include "glsl/ir.h"
 
@@ -40,6 +46,7 @@ struct brw_vec4_compile;
 struct brw_vs_compile;
 struct brw_vec4_prog_key;
 
+#ifdef __cplusplus
 namespace brw {
 
 class dst_reg;
@@ -617,5 +624,6 @@ private:
 };
 
 } /* namespace brw */
+#endif /* __cplusplus */
 
 #endif /* BRW_VEC4_H */