summaryrefslogtreecommitdiff
path: root/cogl
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2013-11-28 17:36:08 +0000
committerRobert Bragg <robert@linux.intel.com>2013-11-28 17:36:08 +0000
commitf7536985437dc85c26b33d1bbe1b7f3d4b32476a (patch)
tree0d74c46470b8dd7d344add8311f827e7e4d0a75e /cogl
parent79ad416515b55ece8b9151876456555ff3fede2f (diff)
downloadcogl-f7536985437dc85c26b33d1bbe1b7f3d4b32476a.tar.gz
Make cogl-sdl.h a top-level header
This makes it so that cogl-sdl.h is a top-level header no longer automatically included by cogl.h. This avoids lots of warnings building the conformance tests and examples due to SDL.h warning when __STRICT_ANSI__ isn't defined. Reviewed-by: Neil Roberts <neil@linux.intel.com>
Diffstat (limited to 'cogl')
-rw-r--r--cogl/cogl-sdl.h34
-rw-r--r--cogl/cogl.h3
2 files changed, 30 insertions, 7 deletions
diff --git a/cogl/cogl-sdl.h b/cogl/cogl-sdl.h
index 486732e9..2c3d6031 100644
--- a/cogl/cogl-sdl.h
+++ b/cogl/cogl-sdl.h
@@ -21,13 +21,26 @@
*
*/
-#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
-#error "Only <cogl/cogl.h> can be included directly."
-#endif
-
#ifndef __COGL_SDL_H__
#define __COGL_SDL_H__
+/* NB: this is a top-level header that can be included directly but we
+ * want to be careful not to define __COGL_H_INSIDE__ when this is
+ * included internally while building Cogl itself since
+ * __COGL_H_INSIDE__ is used in headers to guard public vs private api
+ * definitions
+ */
+#ifndef COGL_COMPILATION
+
+/* Note: When building Cogl .gir we explicitly define
+ * __COGL_H_INSIDE__ */
+#ifndef __COGL_H_INSIDE__
+#define __COGL_H_INSIDE__
+#define __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
+#endif /* COGL_COMPILATION */
+
#include <cogl/cogl-context.h>
#include <cogl/cogl-onscreen.h>
#include <SDL.h>
@@ -221,4 +234,17 @@ cogl_sdl_onscreen_get_window (CoglOnscreen *onscreen);
COGL_END_DECLS
+/* The gobject introspection scanner seems to parse public headers in
+ * isolation which means we need to be extra careful about how we
+ * define and undefine __COGL_H_INSIDE__ used to detect when internal
+ * headers are incorrectly included by developers. In the gobject
+ * introspection case we have to manually define __COGL_H_INSIDE__ as
+ * a commandline argument for the scanner which means we must be
+ * careful not to undefine it in a header...
+ */
+#ifdef __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
+#undef __COGL_H_INSIDE__
+#undef __COGL_SDL_H_MUST_UNDEF_COGL_H_INSIDE__
+#endif
+
#endif /* __COGL_SDL_H__ */
diff --git a/cogl/cogl.h b/cogl/cogl.h
index fdb68bfa..5809bf10 100644
--- a/cogl/cogl.h
+++ b/cogl/cogl.h
@@ -100,9 +100,6 @@
/* XXX: This will definitly go away once all the Clutter winsys
* code has been migrated down into Cogl! */
#include <cogl/cogl-clutter.h>
-#ifdef COGL_HAS_SDL_SUPPORT
-#include <cogl/cogl-sdl.h>
-#endif
/* The gobject introspection scanner seems to parse public headers in
* isolation which means we need to be extra careful about how we