[Cogl] [PATCH 1/3] Don't use #if with defines that are either defined or not
Robert Bragg
robert at sixbynine.org
Wed Jan 2 03:18:27 PST 2013
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Sat, Dec 29, 2012 at 2:30 PM, Damien Lespiau
<damien.lespiau at gmail.com> wrote:
> From: Damien Lespiau <damien.lespiau at intel.com>
>
> 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.
> ---
> cogl/cogl-display-private.h | 2 +-
> cogl/cogl-renderer.c | 4 ++--
> cogl/cogl-util.h | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/cogl/cogl-display-private.h b/cogl/cogl-display-private.h
> index fe844e1..850cd63 100644
> --- a/cogl/cogl-display-private.h
> +++ b/cogl/cogl-display-private.h
> @@ -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
>
> diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
> index 2e2a3df..f3522ea 100644
> --- a/cogl/cogl-renderer.c
> +++ b/cogl/cogl-renderer.c
> @@ -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)
> diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
> index 6e02ad7..9f6bfff 100644
> --- a/cogl/cogl-util.h
> +++ b/cogl/cogl-util.h
> @@ -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 */
> --
> 1.7.7.5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list