[Piglit] [PATCH 2/4] piglit: Always request GNU C extensions.
Ian Romanick
idr at freedesktop.org
Wed May 29 14:17:19 PDT 2013
On 05/29/2013 10:59 AM, Eric Anholt wrote:
> GNU C has a bunch of useful extensions making C a useful language.
> Most of those extensions are also available on the BSDs, but MSVC
> loses out. The solution for MSVC is to write the same wrapper we'd
> end up writing per test if we were limiting ourselves to non-GNU C.
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> CMakeLists.txt | 4 ++++
> tests/shaders/shader_runner.c | 2 --
> tests/spec/arb_texture_buffer_object/formats.c | 1 -
> tests/spec/arb_texture_buffer_range/ranges.c | 1 -
> .../getactiveuniformblockiv-uniform-block-data-size.c | 1 -
> .../spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c | 1 -
> .../arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c | 1 -
> tests/spec/arb_uniform_buffer_object/link-mismatch-blocks.c | 1 -
> tests/spec/arb_uniform_buffer_object/maxblocks.c | 1 -
> tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c | 1 -
> .../spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c | 1 -
> tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c | 1 -
> tests/spec/ext_transform_feedback/structs.c | 1 -
> tests/spec/gl-2.0/vertex-program-two-side.c | 1 -
> tests/texturing/shaders/common.h | 1 -
> tests/util/minmax-test.c | 2 --
> tests/util/piglit-vbo.cpp | 4 ----
> 17 files changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 9c207f9..13a984c 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -197,6 +197,10 @@ if (${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
> "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
> endif()
>
> +# Always enable GNU C extensions. Non-GNU platforms will need to
> +# define wrappers for them.
> +add_definitions(-D_GNU_SOURCE)
> +
> if (WIN32)
> # MSVC & MinGW only define & use APIENTRY
> add_definitions (-DGLAPIENTRY=__stdcall)
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 2118e19..7fc74aa 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -21,8 +21,6 @@
> * DEALINGS IN THE SOFTWARE.
> */
>
> -#define _GNU_SOURCE
> -
> #include <stdbool.h>
> #include <string.h>
> #include <ctype.h>
> diff --git a/tests/spec/arb_texture_buffer_object/formats.c b/tests/spec/arb_texture_buffer_object/formats.c
> index 4eb395a..0dfec7c 100644
> --- a/tests/spec/arb_texture_buffer_object/formats.c
> +++ b/tests/spec/arb_texture_buffer_object/formats.c
> @@ -25,7 +25,6 @@
> * Test for the minimum maximum value in the GL_ARB_texture_buffer_object spec.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> enum channels {
> diff --git a/tests/spec/arb_texture_buffer_range/ranges.c b/tests/spec/arb_texture_buffer_range/ranges.c
> index ffdad56..8f03f92 100644
> --- a/tests/spec/arb_texture_buffer_range/ranges.c
> +++ b/tests/spec/arb_texture_buffer_range/ranges.c
> @@ -25,7 +25,6 @@
> * Test drawing with various ranges and sizes for glTexBufferRange.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
> index 397f42a..b454fe3 100644
> --- a/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
> +++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformblockiv-uniform-block-data-size.c
> @@ -34,7 +34,6 @@
> * next multiple of the base alignment required for a vec4."
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
> #include "uniform-types.h"
>
> diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
> index 89f25af..e1dbc5a 100644
> --- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
> +++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
> @@ -27,7 +27,6 @@
> * GL_UNIFORM_TYPE for variables in a UBO.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
> #include "uniform-types.h"
>
> diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
> index 15f38b2..86e89cd 100644
> --- a/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
> +++ b/tests/spec/arb_uniform_buffer_object/layout-std140-base-size-and-alignment.c
> @@ -28,7 +28,6 @@
> * that, thus testing the size and base alignment for them.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
> #include "uniform-types.h"
>
> diff --git a/tests/spec/arb_uniform_buffer_object/link-mismatch-blocks.c b/tests/spec/arb_uniform_buffer_object/link-mismatch-blocks.c
> index cd7fdd4..d62eb4d 100644
> --- a/tests/spec/arb_uniform_buffer_object/link-mismatch-blocks.c
> +++ b/tests/spec/arb_uniform_buffer_object/link-mismatch-blocks.c
> @@ -34,7 +34,6 @@
> * (see next section). Any mismatch will generate a link error. "
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/spec/arb_uniform_buffer_object/maxblocks.c b/tests/spec/arb_uniform_buffer_object/maxblocks.c
> index a88548b..d7f57d3 100644
> --- a/tests/spec/arb_uniform_buffer_object/maxblocks.c
> +++ b/tests/spec/arb_uniform_buffer_object/maxblocks.c
> @@ -44,7 +44,6 @@
> * MAX_COMBINED_UNIFORM_BLOCKS."
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
> index cc8d4a5..171894c 100644
> --- a/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
> +++ b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c
> @@ -32,7 +32,6 @@
> * "fsexceed" arguments.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
> index 68f7fdb..6f0a657 100644
> --- a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
> +++ b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformblockiv.c
> @@ -46,7 +46,6 @@
> * values."
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
> #include "uniform-types.h"
>
> diff --git a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
> index 1c4e49f..a2c268e 100644
> --- a/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
> +++ b/tests/spec/arb_uniform_buffer_object/negative-getactiveuniformsiv.c
> @@ -47,7 +47,6 @@
> * values."
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
> #include "uniform-types.h"
>
> diff --git a/tests/spec/ext_transform_feedback/structs.c b/tests/spec/ext_transform_feedback/structs.c
> index 99e1638..3e05978 100644
> --- a/tests/spec/ext_transform_feedback/structs.c
> +++ b/tests/spec/ext_transform_feedback/structs.c
> @@ -100,7 +100,6 @@
> * using interface blocks.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c b/tests/spec/gl-2.0/vertex-program-two-side.c
> index 3075ffd..d600df5 100644
> --- a/tests/spec/gl-2.0/vertex-program-two-side.c
> +++ b/tests/spec/gl-2.0/vertex-program-two-side.c
> @@ -42,7 +42,6 @@
> * implies that two-sided behavior always occurs.
> */
>
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
> diff --git a/tests/texturing/shaders/common.h b/tests/texturing/shaders/common.h
> index 878faec..7b241b9 100644
> --- a/tests/texturing/shaders/common.h
> +++ b/tests/texturing/shaders/common.h
> @@ -27,7 +27,6 @@
> * Common structures and functions used for GLSL 1.30+ texturing tests.
> */
> #pragma once
> -#define _GNU_SOURCE
> #include "piglit-util-gl-common.h"
>
> /**
> diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
> index 7eea917..1cb8ab9 100644
> --- a/tests/util/minmax-test.c
> +++ b/tests/util/minmax-test.c
> @@ -26,8 +26,6 @@
> * of the GL 3.0 spec.
> */
>
> -#define _GNU_SOURCE
> -
> #include <inttypes.h>
> #include <string.h>
>
> diff --git a/tests/util/piglit-vbo.cpp b/tests/util/piglit-vbo.cpp
> index b2e2e63..d3d082d 100644
> --- a/tests/util/piglit-vbo.cpp
> +++ b/tests/util/piglit-vbo.cpp
> @@ -86,10 +86,6 @@
> * \endcode
> */
>
> -#ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> -#endif
> -
> #include <string>
> #include <vector>
> #include <errno.h>
>
More information about the Piglit
mailing list