Will be used for all the mayhem needed to get waffle building on a non c99 compliant compilers.
Signed-off-by: Emil Velikov <emil.l.veli...@gmail.com> --- include/c99_compat.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/waffle/api/waffle_gl_misc.c | 5 +---- 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 include/c99_compat.h diff --git a/include/c99_compat.h b/include/c99_compat.h new file mode 100644 index 0000000..a3a5117 --- /dev/null +++ b/include/c99_compat.h @@ -0,0 +1,40 @@ +// Copyright 2012 Intel Corporation +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// - Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// - Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#pragma once + +/* + * C99 restrict keyword + */ +#ifndef restrict +# if defined(__GNUC__) +# define restrict __restrict__ +# elif defined(_MSC_VER) + /* leave empty to prevent compiler wows - decl vs. def diff */ +# define restrict +# else +# define restrict +# endif +#endif diff --git a/src/waffle/api/waffle_gl_misc.c b/src/waffle/api/waffle_gl_misc.c index c746f52..138974d 100644 --- a/src/waffle/api/waffle_gl_misc.c +++ b/src/waffle/api/waffle_gl_misc.c @@ -25,6 +25,7 @@ #include <stddef.h> #include <string.h> +#include "c99_compat.h" #include "api_priv.h" @@ -34,10 +35,6 @@ #include "wcore_platform.h" #include "wcore_window.h" -#if __STDC_VERSION__ < 199901L -# define restrict -#endif - WAFFLE_API bool waffle_is_extension_in_string( const char *restrict extension_string, -- 2.0.0 _______________________________________________ waffle mailing list waffle@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/waffle