1
0
Fork 0

Don't use #if with defines that are either defined or not

COGL_HAS_* and COGL_ENABLE_DEBUG are either defined in config.h or not.

So let's test against this, not against their truth value, this allow us
to use -Wundef to catch undefined macros in preprocessor directives.

(cherry picked from commit 73b62832f24711073b0876a6c0f5c61727842c1c)
This commit is contained in:
Damien Lespiau 2012-12-29 02:00:00 +00:00 committed by Robert Bragg
parent 1f0b432a25
commit b8d9bbed1a
3 changed files with 4 additions and 4 deletions

View file

@ -30,7 +30,7 @@
#include "cogl-renderer.h"
#include "cogl-onscreen-template.h"
#include "cogl-internal.h"
#if COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
#ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT
#include <wayland-server.h>
#endif

View file

@ -73,7 +73,7 @@
#include "cogl-winsys-sdl-private.h"
#endif
#if COGL_HAS_XLIB_SUPPORT
#ifdef COGL_HAS_XLIB_SUPPORT
#include "cogl-xlib-renderer.h"
#endif
@ -188,7 +188,7 @@ cogl_renderer_new (void)
return _cogl_renderer_object_new (renderer);
}
#if COGL_HAS_XLIB_SUPPORT
#ifdef COGL_HAS_XLIB_SUPPORT
void
cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
Display *xdisplay)

View file

@ -194,7 +194,7 @@ _cogl_util_popcountl (unsigned long num)
#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
#else
#if COGL_ENABLE_DEBUG
#ifdef COGL_ENABLE_DEBUG
#define _COGL_RETURN_START do {
#define _COGL_RETURN_END } while (0)
#else /* COGL_ENABLE_DEBUG */