summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-11-09 10:20:51 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-11-09 10:24:37 +0000
commit63e7a4c6e5bf51d8090046ebc5adcb4207448565 (patch)
treeb701753960e53fe36889273def9d28e0059445d6
parentf4b42aa5b7a3d11f839d5576b4c42406529131be (diff)
downloadexternal_mesa3d-63e7a4c6e5bf51d8090046ebc5adcb4207448565.zip
external_mesa3d-63e7a4c6e5bf51d8090046ebc5adcb4207448565.tar.gz
external_mesa3d-63e7a4c6e5bf51d8090046ebc5adcb4207448565.tar.bz2
mesa,glsl,mapi: Put extern "C" { ... } where appropriate.
Probably a several places missing, but enough to cover all headers (in)directly included by uniform_query.cpp, and fix the MSVC build.
-rw-r--r--src/glsl/glsl_types.h6
-rw-r--r--src/glsl/ir_uniform.h9
-rw-r--r--src/mapi/glapi/glapi.h7
-rw-r--r--src/mapi/glapi/glthread.h8
-rw-r--r--src/mapi/mapi/u_thread.h22
-rw-r--r--src/mesa/main/context.h9
-rw-r--r--src/mesa/main/core.h8
-rw-r--r--src/mesa/main/formats.h11
-rw-r--r--src/mesa/main/glheader.h10
-rw-r--r--src/mesa/main/mtypes.h9
-rw-r--r--src/mesa/main/shaderapi.h11
-rw-r--r--src/mesa/main/shaderobj.h3
-rw-r--r--src/mesa/main/simple_list.h8
-rw-r--r--src/mesa/main/uniform_query.cpp6
-rw-r--r--src/mesa/main/uniforms.h11
-rw-r--r--src/mesa/math/m_matrix.h9
-rw-r--r--src/mesa/program/hash_table.h9
-rw-r--r--src/mesa/program/ir_to_mesa.h15
-rw-r--r--src/mesa/program/prog_parameter.h9
-rw-r--r--src/mesa/program/prog_statevars.h11
20 files changed, 158 insertions, 33 deletions
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index efbf335..4ac9011 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -29,13 +29,13 @@
#include <string.h>
#include <assert.h>
-struct _mesa_glsl_parse_state;
-struct glsl_symbol_table;
-
#ifdef __cplusplus
extern "C" {
#endif
+struct _mesa_glsl_parse_state;
+struct glsl_symbol_table;
+
extern void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
index be9f6b2..225da3f 100644
--- a/src/glsl/ir_uniform.h
+++ b/src/glsl/ir_uniform.h
@@ -25,15 +25,18 @@
#ifndef IR_UNIFORM_H
#define IR_UNIFORM_H
-#ifdef __cplusplus
-extern "C" {
-#endif
/* stdbool.h is necessary because this file is included in both C and C++ code.
*/
#include <stdbool.h>
+
#include "program/prog_parameter.h" /* For union gl_constant_value. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum gl_uniform_driver_format {
uniform_native = 0, /**< Store data in the native format. */
uniform_int_float, /**< Store integer data as floats. */
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index b9351d1..f685475 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -44,10 +44,14 @@
#ifndef _GLAPI_H
#define _GLAPI_H
+#include "glapi/glthread.h"
+
+
#ifdef __cplusplus
extern "C" {
#endif
+
#ifdef _GLAPI_NO_EXPORTS
# define _GLAPI_EXPORT
#else /* _GLAPI_NO_EXPORTS */
@@ -75,8 +79,6 @@ extern "C" {
#define _glapi_Context _mglapi_Context
#endif
-#include "glapi/glthread.h"
-
typedef void (*_glapi_proc)(void);
struct _glapi_table;
@@ -180,6 +182,7 @@ _glapi_noop_enable_warnings(unsigned char enable);
_GLAPI_EXPORT void
_glapi_set_warning_func(_glapi_proc func);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mapi/glapi/glthread.h b/src/mapi/glapi/glthread.h
index fc4ece7..1c3f4e2 100644
--- a/src/mapi/glapi/glthread.h
+++ b/src/mapi/glapi/glthread.h
@@ -3,6 +3,10 @@
#include "mapi/u_thread.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define _glthread_DECLARE_STATIC_MUTEX(name) u_mutex_declare_static(name)
#define _glthread_INIT_MUTEX(name) u_mutex_init(name)
#define _glthread_DESTROY_MUTEX(name) u_mutex_destroy(name)
@@ -17,4 +21,8 @@
typedef struct u_tsd _glthread_TSD;
typedef u_mutex _glthread_Mutex;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GLTHREAD_H */
diff --git a/src/mapi/mapi/u_thread.h b/src/mapi/mapi/u_thread.h
index 4405ec9..7db22b7 100644
--- a/src/mapi/mapi/u_thread.h
+++ b/src/mapi/mapi/u_thread.h
@@ -44,12 +44,25 @@
#include "u_compiler.h"
-#if defined(PTHREADS) || defined(WIN32)
+#if defined(PTHREADS)
+#include <pthread.h> /* POSIX threads headers */
+#endif
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#if defined(PTHREADS) || defined(_WIN32)
#ifndef THREADS
#define THREADS
#endif
#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/*
* POSIX threads. This should be your choice in the Unix world
* whenever possible. When building with POSIX threads, be sure
@@ -60,7 +73,6 @@
* proper compiling for MT-safe libc etc.
*/
#if defined(PTHREADS)
-#include <pthread.h> /* POSIX threads headers */
struct u_tsd {
pthread_key_t key;
@@ -86,7 +98,6 @@ typedef pthread_mutex_t u_mutex;
* used!
*/
#ifdef WIN32
-#include <windows.h>
struct u_tsd {
DWORD key;
@@ -142,4 +153,9 @@ u_tsd_get(struct u_tsd *tsd);
void
u_tsd_set(struct u_tsd *tsd, void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _U_THREAD_H_ */
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index a9df0a8..a66dd50 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -53,6 +53,11 @@
#include "mtypes.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct _glapi_table;
@@ -285,5 +290,9 @@ do { \
/*@}*/
+#ifdef __cplusplus
+}
+#endif
+
#endif /* CONTEXT_H */
diff --git a/src/mesa/main/core.h b/src/mesa/main/core.h
index 212f085..c28a8af 100644
--- a/src/mesa/main/core.h
+++ b/src/mesa/main/core.h
@@ -48,16 +48,8 @@
#include "main/mtypes.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* for GLSL */
#include "program/prog_parameter.h"
-#ifdef __cplusplus
-}
-#endif
-
#endif /* CORE_H */
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index f24d525..b2cb750 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -35,6 +35,12 @@
#include <GL/gl.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/* OpenGL doesn't have GL_UNSIGNED_BYTE_4_4, so we must define our own type
* for GL_LUMINANCE4_ALPHA4. */
#define MESA_UNSIGNED_BYTE_4_4 (GL_UNSIGNED_BYTE<<1)
@@ -322,4 +328,9 @@ GLboolean
_mesa_format_matches_format_and_type(gl_format gl_format,
GLenum format, GLenum type);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* FORMATS_H */
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index c4fb157..7980111 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -54,6 +54,11 @@
#include "GL/glext.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/**
* GL_FIXED is defined in glext.h version 64 but these typedefs aren't (yet).
*/
@@ -172,4 +177,9 @@ typedef void *GLeglImageOES;
#define GLX_DONT_CARE 0xFFFFFFFF
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GLHEADER_H */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ae6a33e..58dc9af 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -43,6 +43,11 @@
#include "main/formats.h" /* MESA_FORMAT_COUNT */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/**
* Stencil buffer data type.
*/
@@ -3454,4 +3459,8 @@ enum _debug
+#ifdef __cplusplus
+}
+#endif
+
#endif /* MTYPES_H */
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index bec448d..0ffebdb 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -29,6 +29,12 @@
#include "glheader.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct _glapi_table;
struct gl_context;
struct gl_shader_program;
@@ -194,4 +200,9 @@ _mesa_ActiveProgramEXT(GLuint program);
extern GLuint GLAPIENTRY
_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* SHADERAPI_H */
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index 941841d..5470b51 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -32,9 +32,12 @@
#include "main/mtypes.h"
#include "program/ir_to_mesa.h"
+
#ifdef __cplusplus
extern "C" {
#endif
+
+
/**
* Internal functions
*/
diff --git a/src/mesa/main/simple_list.h b/src/mesa/main/simple_list.h
index ff7f888..9417108 100644
--- a/src/mesa/main/simple_list.h
+++ b/src/mesa/main/simple_list.h
@@ -37,6 +37,10 @@
#ifndef _SIMPLE_LIST_H
#define _SIMPLE_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct simple_node {
struct simple_node *next;
struct simple_node *prev;
@@ -199,4 +203,8 @@ do { \
#define foreach_s(ptr, t, list) \
for(ptr=(list)->next,t=(ptr)->next; list != ptr; ptr=t, t=(t)->next)
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 388e81a..39aa557 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -22,7 +22,9 @@
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+
#include <stdlib.h>
+
#include "main/core.h"
#include "main/context.h"
#include "ir.h"
@@ -30,12 +32,10 @@
#include "program/hash_table.h"
#include "../glsl/program.h"
#include "../glsl/ir_uniform.h"
-
-extern "C" {
#include "main/shaderapi.h"
#include "main/shaderobj.h"
#include "uniforms.h"
-}
+
extern "C" void GLAPIENTRY
_mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
diff --git a/src/mesa/main/uniforms.h b/src/mesa/main/uniforms.h
index c73aab3..123d7b9 100644
--- a/src/mesa/main/uniforms.h
+++ b/src/mesa/main/uniforms.h
@@ -30,6 +30,11 @@
#include "../glsl/glsl_types.h"
#include "../glsl/ir_uniform.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct gl_program;
struct _glapi_table;
@@ -281,4 +286,10 @@ _mesa_uniform_split_location_offset(GLint location, unsigned *base_location,
}
/*@}*/
+
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* UNIFORMS_H */
diff --git a/src/mesa/math/m_matrix.h b/src/mesa/math/m_matrix.h
index a69afb8..e8e48aa 100644
--- a/src/mesa/math/m_matrix.h
+++ b/src/mesa/math/m_matrix.h
@@ -35,6 +35,11 @@
#include "main/glheader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/**
* \name Symbolic names to some of the entries in the matrix
*
@@ -209,4 +214,8 @@ _mesa_transform_vector(GLfloat u[4], const GLfloat v[4], const GLfloat m[16]);
/*@}*/
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/src/mesa/program/hash_table.h b/src/mesa/program/hash_table.h
index 47c37ae..bcf65df 100644
--- a/src/mesa/program/hash_table.h
+++ b/src/mesa/program/hash_table.h
@@ -37,16 +37,17 @@
#include <limits.h>
#include <assert.h>
-struct hash_table;
struct string_to_uint_map;
-typedef unsigned (*hash_func_t)(const void *key);
-typedef int (*hash_compare_func_t)(const void *key1, const void *key2);
-
#ifdef __cplusplus
extern "C" {
#endif
+struct hash_table;
+
+typedef unsigned (*hash_func_t)(const void *key);
+typedef int (*hash_compare_func_t)(const void *key1, const void *key2);
+
/**
* Hash table constructor
*
diff --git a/src/mesa/program/ir_to_mesa.h b/src/mesa/program/ir_to_mesa.h
index 2891682..aa053d9 100644
--- a/src/mesa/program/ir_to_mesa.h
+++ b/src/mesa/program/ir_to_mesa.h
@@ -21,24 +21,23 @@
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/glheader.h"
+#pragma once
-struct gl_context;
-struct gl_shader;
-struct gl_shader_program;
+#include "main/glheader.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct gl_context;
+struct gl_shader;
+struct gl_shader_program;
+
void _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *sh);
void _mesa_glsl_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
GLboolean _mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader);
GLboolean _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
-#ifdef __cplusplus
-}
-
void
_mesa_generate_parameters_list_for_uniforms(struct gl_shader_program
*shader_program,
@@ -50,4 +49,6 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
struct gl_shader_program *shader_program,
struct gl_program_parameter_list *params);
+#ifdef __cplusplus
+}
#endif
diff --git a/src/mesa/program/prog_parameter.h b/src/mesa/program/prog_parameter.h
index a6793d0..3c6dc8c 100644
--- a/src/mesa/program/prog_parameter.h
+++ b/src/mesa/program/prog_parameter.h
@@ -35,6 +35,11 @@
#include "prog_statevars.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
/**
* Program parameter flags
*/
@@ -178,4 +183,8 @@ _mesa_num_parameters_of_type(const struct gl_program_parameter_list *list,
gl_register_file type);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* PROG_PARAMETER_H */
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 04af3f4..8b731e1 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -25,8 +25,15 @@
#ifndef PROG_STATEVARS_H
#define PROG_STATEVARS_H
+
#include "main/glheader.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
struct gl_context;
struct gl_program_parameter_list;
@@ -145,4 +152,8 @@ extern void
_mesa_load_tracked_matrices(struct gl_context *ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* PROG_STATEVARS_H */