Mesa (master): glsl2: restructure header file for C++ and C inclusion

Brian Paul brianp at kemper.freedesktop.org
Fri Aug 27 20:32:30 UTC 2010


Module: Mesa
Branch: master
Commit: b820bf979a1c308d8d6fe6ad89e8ae7c77226603
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b820bf979a1c308d8d6fe6ad89e8ae7c77226603

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Aug 27 11:53:19 2010 -0600

glsl2: restructure header file for C++ and C inclusion

As it was, the header could not be cleanly #included by a C source.

---

 src/glsl/glsl_parser_extras.h |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index b0b1bc3..3ccdab4 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -25,6 +25,12 @@
 #ifndef GLSL_PARSER_EXTRAS_H
 #define GLSL_PARSER_EXTRAS_H
 
+/*
+ * Most of the definitions here only apply to C++
+ */
+#ifdef __cplusplus
+
+
 #include <cstdlib>
 #include "glsl_symbol_table.h"
 
@@ -175,14 +181,6 @@ extern void _mesa_glsl_warning(const YYLTYPE *locp,
 			       _mesa_glsl_parse_state *state,
 			       const char *fmt, ...);
 
-extern "C" {
-extern int preprocess(void *ctx, const char **shader, char **info_log,
-		      const struct gl_extensions *extensions);
-
-extern void _mesa_destroy_shader_compiler();
-extern void _mesa_destroy_shader_compiler_caches();
-}
-
 extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
 				  const char *string);
 
@@ -212,4 +210,26 @@ extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
 extern const char *
 _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target);
 
+
+#endif /* __cplusplus */
+
+
+/*
+ * These definitions apply to C and C++
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int preprocess(void *ctx, const char **shader, char **info_log,
+                      const struct gl_extensions *extensions);
+
+extern void _mesa_destroy_shader_compiler();
+extern void _mesa_destroy_shader_compiler_caches();
+
+#ifdef __cplusplus
+}
+#endif
+
+
 #endif /* GLSL_PARSER_EXTRAS_H */




More information about the mesa-commit mailing list