Fix invalid extern "C" around header inclusion.
authorMark Janes <mark.a.janes@intel.com>
Thu, 5 Mar 2015 00:37:29 +0000 (16:37 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 5 Mar 2015 18:21:40 +0000 (10:21 -0800)
System headers may contain C++ declarations, which cannot be given C
linkage.  For this reason, include statements should never occur
inside extern "C".

This patch moves the C linkage statements to enclose only the
declarations within a single header.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
26 files changed:
src/gallium/auxiliary/util/u_math.h
src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/sb/sb_bc.h
src/gallium/drivers/r600/sb/sb_bc_parser.cpp
src/gallium/drivers/r600/sb/sb_core.cpp
src/gallium/drivers/r600/sb/sb_public.h
src/glx/indirect_init.h
src/glx/tests/indirect_api.cpp
src/mapi/shared-glapi/tests/check_table.cpp
src/mesa/drivers/common/driverfuncs.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/main/api_exec.h
src/mesa/main/tests/dispatch_sanity.cpp
src/mesa/main/tests/program_state_string.cpp
src/mesa/main/vtxfmt.h
src/mesa/vbo/vbo.h
src/mesa/vbo/vbo_context.h
src/util/Makefile.am
src/util/register_allocate.h

index 5400fcead59e5a4b7eb0ac31390c873054b0e661..8f62cac664ed08f5eccc9d1e1417dc4bcd46e110 100644 (file)
 
 #include "pipe/p_compiler.h"
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 #include "c99_math.h"
 #include <float.h>
 #include <stdarg.h>
@@ -56,6 +50,11 @@ extern "C" {
 #endif
 
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 #ifndef M_SQRT2
 #define M_SQRT2 1.41421356237309504880
 #endif
index b2559e9b661d636709047db275a3742c5a219c60..dd359d7e9596e15b277622304cb7fa5692a32e31 100644 (file)
 
 #include "r600_asm.h"
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct r600_shader_io {
        unsigned                name;
        unsigned                gpr;
@@ -125,4 +131,10 @@ struct r600_pipe_shader {
  TGSI_INTERPOLATE_LOC_CENTER/SAMPLE/COUNT. Other input values return -1. */
 int eg_get_interpolator_index(unsigned interpolate, unsigned location);
 
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+
 #endif
index 072d8f8b4e08c35b08bbcc95088d4a823d765209..ab988f8716d9d5af1bda8bc2a9fbb38d4f8b17ff 100644 (file)
 #ifndef SB_BC_H_
 #define SB_BC_H_
 
-extern "C" {
 #include <stdint.h>
 #include "r600_isa.h"
-}
 
 #include <cstdio>
 #include <string>
index 403f938092e745be484b7416557d1831be3fe48c..08e7f5c36c3f3200f2b9239dbe8e0d4dc84e74ab 100644 (file)
 #define BCP_DUMP(q)
 #endif
 
-extern "C" {
 #include "r600_pipe.h"
 #include "r600_shader.h"
-}
 
 #include <stack>
 
index 9fd9d9ad25a2ec5e1312f00484f56d7900435be3..7db80082b607d03970e687c8ffcc6590f0cc8d4e 100644 (file)
 
 #define SB_RA_SCHED_CHECK DEBUG
 
-extern "C" {
 #include "os/os_time.h"
 #include "r600_pipe.h"
 #include "r600_shader.h"
 
 #include "sb_public.h"
-}
 
 #include <stack>
 #include <map>
index c9f5f97f9c8b851c397dca2db7de75b326a7aa39..a90771f06d1ef95a9e13d956be36d210b82d90fe 100644 (file)
 #ifndef R600_SB_H_
 #define R600_SB_H_
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct r600_shader;
 
 void r600_sb_context_destroy(void *sctx);
@@ -37,4 +43,10 @@ int r600_sb_bytecode_process(struct r600_context *rctx,
                              int dump_source_bytecode,
                              int optimize);
 
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
 #endif //R600_SB_H_
index 2ba01f56c3f35aacdc0a92d6e2b33908ee2a2e85..7fe9a96495d9ba773295acd9b313deab23433d2e 100644 (file)
@@ -36,6 +36,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "glxclient.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern struct _glapi_table *__glXNewIndirectAPI(void);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif /* _INDIRECT_INIT_H_ */
index 52469a771c2925a2924c240758e3c088c4e0990f..34304a185e48bca9e8d216821e1eb0150c8e98e5 100644 (file)
 
 #include <gtest/gtest.h>
 #include "main/glheader.h"
-extern "C" {
 #include "../indirect_init.h"
 #include "glapi/glapi.h"
 #include "../../mesa/main/dispatch.h"
-}
 
 static const void *nil = 0;
 
index 47c0b2775d9e831ca4c8d91d7f2e9ba96cb55f6f..02d313c22d30a0cef3e50354bd28560f0893d2b8 100644 (file)
 #include <gtest/gtest.h>
 #include "../../../mesa/main/glheader.h"
 
-extern "C" {
 #include "glapi/glapi.h"
 #include "glapi/glapitable.h"
-}
 
 struct name_offset {
    const char *name;
index 6b9a900748d0c8f027428fa2972ee6bf7f888121..385ccb8dd1be25a246436f0f3b59a5e6624023b7 100644 (file)
 #ifndef DRIVERFUNCS_H
 #define DRIVERFUNCS_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void
 _mesa_init_driver_functions(struct dd_function_table *driver);
 
@@ -33,5 +37,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver);
 extern void
 _mesa_init_driver_state(struct gl_context *ctx);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
 
 #endif
index 533feb4c7a6ce8ea14ace793f0b23e96bf94ad76..d6acc238a1a2f03886b247c07c2b0fbb6eddf43d 100644 (file)
@@ -28,8 +28,6 @@
  * from the LIR.
  */
 
-extern "C" {
-
 #include <sys/types.h>
 
 #include "util/hash_table.h"
@@ -43,7 +41,6 @@ extern "C" {
 #include "brw_context.h"
 #include "brw_eu.h"
 #include "brw_wm.h"
-}
 #include "brw_fs.h"
 #include "brw_cfg.h"
 #include "brw_dead_control_flow.h"
index c64742cb6f953ba51b5249dbdac13cb57edeca96..933fdde24f923edf4e9376c224186fb1b9f945ce 100644 (file)
  * we do retain the vector types in that case.
  */
 
-extern "C" {
 #include "main/core.h"
 #include "brw_wm.h"
-}
 #include "glsl/ir.h"
 #include "glsl/ir_expression_flattening.h"
 #include "glsl/glsl_types.h"
index cbe61910b4ec8da72e370b71565c6dd8734a99b5..02ea3b6d7c55b723676ffac984ccc993fa36afdb 100644 (file)
  * native instructions.
  */
 
-extern "C" {
 #include "main/macros.h"
 #include "brw_context.h"
 #include "brw_eu.h"
-} /* extern "C" */
-
 #include "brw_fs.h"
 #include "brw_cfg.h"
 
index 03e5fdbef2cfdf0ada678c287b100a6ca20a6652..01d3a569858b84fc1d8cf90dd538630ca349ccb5 100644 (file)
  * behavior we want for the results of texture lookups, but probably not for
  */
 
-extern "C" {
 #include "main/core.h"
 #include "brw_context.h"
-}
 #include "glsl/ir.h"
 #include "glsl/ir_visitor.h"
 #include "glsl/ir_rvalue_visitor.h"
index 57c4d66b8ad657032472038a2da727c6f9774897..6b48f701fbaf9b49be54d859b1e18a25fb508f5b 100644 (file)
@@ -27,8 +27,6 @@
  * makes it easier to do backend-specific optimizations than doing so
  * in the GLSL IR or in the native code.
  */
-extern "C" {
-
 #include <sys/types.h>
 
 #include "main/macros.h"
@@ -41,7 +39,6 @@ extern "C" {
 #include "brw_context.h"
 #include "brw_eu.h"
 #include "brw_wm.h"
-}
 #include "brw_vec4.h"
 #include "brw_fs.h"
 #include "main/uniforms.h"
index ec3cfcbd255fd867729b650d99f72f84bb11dba7..f2b4d824218d40a56b3a528dc7baae5e32c3b879 100644 (file)
  * IN THE SOFTWARE.
  */
 
-extern "C" {
 #include "main/macros.h"
 #include "brw_context.h"
-}
 #include "brw_vs.h"
 #include "brw_gs.h"
 #include "brw_fs.h"
index a286f8ace77fb73b08a6d0e402ccd1f77568ae3d..31868240a0a29427ab7d2d5ff0e24cc65c05f4da 100644 (file)
  * IN THE SOFTWARE.
  */
 
-extern "C" {
 #include "main/macros.h"
 #include "util/register_allocate.h"
-} /* extern "C" */
-
 #include "brw_vec4.h"
 #include "brw_vs.h"
 #include "brw_cfg.h"
index f54530f370bd07330b1c72892748ba4b0a62ac31..32d1ce369d400cfdff01f4021274c7f8ae8e649e 100644 (file)
 #define AA_SOMETIMES 1
 #define AA_ALWAYS    2
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Compile a fragment shader.
  *
@@ -86,4 +90,8 @@ bool brw_wm_prog_data_compare(const void *a, const void *b);
 void
 brw_upload_wm_prog(struct brw_context *brw);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif
index ff35b78bb9fb578e8e149b704da2f1f5163a4563..1e4a9d61a461b059661d8e0233c65fb26ae80e5c 100644 (file)
@@ -26,6 +26,9 @@
 #ifndef API_EXEC_H
 #define API_EXEC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 struct _glapi_table;
 struct gl_context;
@@ -39,4 +42,8 @@ _mesa_initialize_exec_table(struct gl_context *ctx);
 extern void
 _mesa_initialize_dispatch_tables(struct gl_context *ctx);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif
index c14ad32eb3e7f67503998e73e73526de1273f89b..d25143faa178d16915376104ab7e2a26d09308f6 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <gtest/gtest.h>
 
-extern "C" {
 #include "GL/gl.h"
 #include "GL/glext.h"
 #include "main/compiler.h"
@@ -62,7 +61,6 @@ extern "C" {
 #endif
 
 #include "main/dispatch.h"
-}
 
 struct function {
    const char *name;
index 418c39c8ea91638f7b64123ed404f60932419f64..ddfdb49ee2cf7b28cf96d3eaab7f2926527eeeb6 100644 (file)
 
 #include <gtest/gtest.h>
 
-extern "C" {
 #include "GL/gl.h"
 #include "GL/glext.h"
 #include "main/compiler.h"
-}
 
 #include "program/prog_statevars.h"
 
index efccd901aa6ca2131ee5df9af23cf8ea8f321724..4f8bc9cdf06a4ab8d0149f1364a5803029bc07de 100644 (file)
 
 #include "mtypes.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern void _mesa_install_exec_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
 extern void _mesa_install_save_vtxfmt( struct gl_context *ctx, const GLvertexformat *vfmt );
 extern void _mesa_initialize_vbo_vtxfmt(struct gl_context *ctx);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif /* _VTXFMT_H_ */
index 6e1a4aa1ad6cebccf410e337481f248edb92eb51..54dee6c464ffbbbf3208fdd8226a258e058e9ff4 100644 (file)
 #include <stdbool.h>
 #include "main/glheader.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct gl_client_array;
 struct gl_context;
 struct gl_transform_feedback_object;
@@ -228,4 +232,8 @@ _es_VertexAttrib3fv(GLuint indx, const GLfloat* values);
 void GLAPIENTRY
 _es_VertexAttrib4fv(GLuint indx, const GLfloat* values);
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif
index 3b454be4422ce41e722dddba08da2ddaafde17b2..6099b56e66139fd1434031303f09f5fbf6fef21b 100644 (file)
 
 #include "main/macros.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct vbo_context {
    struct gl_client_array currval[VBO_ATTRIB_MAX];
    
@@ -175,4 +179,8 @@ vbo_get_default_vals_as_union(GLenum format)
    }
 }
 
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
 #endif
index 29b66e70e9d6c1922900c7e6175d88f3fe0268a1..ec49dc6cf1670e37b0f2be91abb1c39604e27cac 100644 (file)
@@ -25,6 +25,9 @@ include Makefile.sources
 
 noinst_LTLIBRARIES = libmesautil.la
 
+AM_CPPFLAGS = \
+       -I$(top_srcdir)/include
+
 libmesautil_la_CPPFLAGS = \
        $(DEFINES) \
        -I$(top_srcdir)/include \
index dc68744953213e5893d2b84981dcfd9f3a06a4b4..61f182eff49a928331792bbc591631c818a7f27c 100644 (file)
 
 #include <stdbool.h>
 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
 struct ra_class;
 struct ra_regs;
 
@@ -77,3 +83,7 @@ void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost);
 int ra_get_best_spill_node(struct ra_graph *g);
 /** @} */
 
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif