[Mesa-dev] [PATCH 01/10] intel: Add extern "C" declarations to headers
Paul Berry
stereotype441 at gmail.com
Wed May 2 13:52:08 PDT 2012
These declarations are necessary to allow C++ code to call C code
without causing unresolved symbols (which would make the driver fail
to load).
---
src/mesa/drivers/dri/i965/brw_context.h | 7 +++++++
src/mesa/drivers/dri/i965/brw_eu.h | 8 ++++++++
src/mesa/drivers/dri/i965/brw_state.h | 8 ++++++++
src/mesa/drivers/dri/i965/gen6_hiz.h | 8 ++++++++
src/mesa/drivers/dri/i965/gen7_hiz.h | 8 ++++++++
src/mesa/drivers/dri/intel/intel_batchbuffer.h | 8 ++++++++
src/mesa/drivers/dri/intel/intel_context.h | 5 ++++-
src/mesa/drivers/dri/intel/intel_fbo.h | 8 ++++++++
src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 8 ++++++++
src/mesa/drivers/dri/intel/intel_regions.h | 8 ++++++++
src/mesa/main/teximage.h | 7 +++++++
11 files changed, 82 insertions(+), 1 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 47f56e2..141fb65 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -37,6 +37,9 @@
#include "brw_structs.h"
#include "main/imports.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Glossary:
*
@@ -1188,4 +1191,8 @@ brw_program_reloc(struct brw_context *brw, uint32_t state_offset,
bool brw_do_cubemap_normalize(struct exec_list *instructions);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index c4c62b2..675b50a 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -38,6 +38,10 @@
#include "brw_defines.h"
#include "program/prog_instruction.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6))
#define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3)
@@ -1107,4 +1111,8 @@ void brw_optimize(struct brw_compile *p);
void brw_remove_duplicate_mrf_moves(struct brw_compile *p);
void brw_remove_grf_to_mrf_moves(struct brw_compile *p);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 8a0e92f..659cb0a 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -35,6 +35,10 @@
#include "brw_context.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const struct brw_tracked_state brw_blend_constant_color;
extern const struct brw_tracked_state brw_cc_vp;
extern const struct brw_tracked_state brw_cc_unit;
@@ -208,4 +212,8 @@ uint32_t
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
int fs_attr, bool two_side_color);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/i965/gen6_hiz.h b/src/mesa/drivers/dri/i965/gen6_hiz.h
index 0a13ba0..5d6eefc 100644
--- a/src/mesa/drivers/dri/i965/gen6_hiz.h
+++ b/src/mesa/drivers/dri/i965/gen6_hiz.h
@@ -25,6 +25,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct intel_context;
struct intel_mipmap_tree;
@@ -77,3 +81,7 @@ gen6_resolve_depth_slice(struct intel_context *intel,
struct intel_mipmap_tree *mt,
uint32_t level,
uint32_t layer);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/mesa/drivers/dri/i965/gen7_hiz.h b/src/mesa/drivers/dri/i965/gen7_hiz.h
index b89ffb0..6c0fc84 100644
--- a/src/mesa/drivers/dri/i965/gen7_hiz.h
+++ b/src/mesa/drivers/dri/i965/gen7_hiz.h
@@ -25,6 +25,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct intel_context;
struct intel_mipmap_tree;
@@ -41,3 +45,7 @@ gen7_resolve_depth_slice(struct intel_context *intel,
struct intel_mipmap_tree *mt,
uint32_t level,
uint32_t layer);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
index 751ec99..50d0d28 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h
@@ -7,6 +7,10 @@
#include "intel_bufmgr.h"
#include "intel_reg.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define BATCH_RESERVED 16
void intel_batchbuffer_init(struct intel_context *intel);
@@ -152,4 +156,8 @@ void intel_batchbuffer_cached_advance(struct intel_context *intel);
#define ADVANCE_BATCH() intel_batchbuffer_advance(intel);
#define CACHED_BATCH() intel_batchbuffer_cached_advance(intel);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 8ba7270..63dba89 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -49,7 +49,6 @@ extern "C" {
#ifdef __cplusplus
#undef virtual
-}
#endif
#include "tnl/t_vertex.h"
@@ -607,4 +606,8 @@ is_power_of_two(uint32_t value)
return (value & (value - 1)) == 0;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 503b006..6880621 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -34,6 +34,10 @@
#include "intel_context.h"
#include "intel_screen.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct intel_context;
struct intel_mipmap_tree;
struct intel_texture_image;
@@ -220,4 +224,8 @@ bool
intel_renderbuffer_resolve_depth(struct intel_context *intel,
struct intel_renderbuffer *irb);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* INTEL_FBO_H */
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 9082864..0886c95 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -33,6 +33,10 @@
#include "intel_regions.h"
#include "intel_resolve_map.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A layer on top of the intel_regions code which adds:
*
* - Code to size and layout a region to hold a set of mipmaps.
@@ -413,4 +417,8 @@ intel_miptree_unmap(struct intel_context *intel,
unsigned int level,
unsigned int slice);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h
index 9a5b150..3ce9a22 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.h
+++ b/src/mesa/drivers/dri/intel/intel_regions.h
@@ -41,6 +41,10 @@
#include "main/mtypes.h"
#include "intel_bufmgr.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct intel_context;
struct intel_buffer_object;
@@ -146,4 +150,8 @@ struct __DRIimageRec {
void *data;
};
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index e2bdaca..66a0c88 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -35,6 +35,9 @@
#include "mtypes.h"
#include "formats.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/** Is the given value one of the 6 cube faces? */
static inline GLboolean
@@ -287,4 +290,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
/*@}*/
+#ifdef __cplusplus
+}
+#endif
+
#endif
--
1.7.7.6
More information about the mesa-dev
mailing list