Define _GNU_SOURCE when building SDL
authorSam Lantinga <slouken@libsdl.org>
Fri, 11 Nov 2016 13:14:00 -0800
changeset 1060427d0fb08d755
parent 10603 d2c8ae6ceac8
child 10605 8a059b7b01c4
Define _GNU_SOURCE when building SDL
src/SDL_internal.h
src/stdlib/SDL_string.c
src/test/SDL_test_fuzzer.c
src/thread/pthread/SDL_sysmutex.c
src/thread/pthread/SDL_syssem.c
src/video/wayland/SDL_waylanddatamanager.c
src/video/wayland/SDL_waylandmouse.c
src/video/x11/SDL_x11modes.c
     1.1 --- a/src/SDL_internal.h	Fri Nov 11 12:41:06 2016 -0800
     1.2 +++ b/src/SDL_internal.h	Fri Nov 11 13:14:00 2016 -0800
     1.3 @@ -21,6 +21,15 @@
     1.4  #ifndef _SDL_internal_h
     1.5  #define _SDL_internal_h
     1.6  
     1.7 +/* Many of SDL's features require _GNU_SOURCE on various platforms
     1.8 +   You can turn this off if necessary by using -D_GNU_SOURCE=0
     1.9 + */
    1.10 +#ifndef _GNU_SOURCE
    1.11 +#define _GNU_SOURCE
    1.12 +#elif !_GNU_SOURCE
    1.13 +#undef _GNU_SOURCE
    1.14 +#endif
    1.15 +
    1.16  #include "dynapi/SDL_dynapi.h"
    1.17  
    1.18  #if SDL_DYNAMIC_API
    1.19 @@ -33,6 +42,6 @@
    1.20  
    1.21  #include "SDL_config.h"
    1.22  
    1.23 -#endif
    1.24 +#endif /* _SDL_internal_h */
    1.25  
    1.26  /* vi: set ts=4 sw=4 expandtab: */
     2.1 --- a/src/stdlib/SDL_string.c	Fri Nov 11 12:41:06 2016 -0800
     2.2 +++ b/src/stdlib/SDL_string.c	Fri Nov 11 13:14:00 2016 -0800
     2.3 @@ -18,15 +18,10 @@
     2.4       misrepresented as being the original software.
     2.5    3. This notice may not be removed or altered from any source distribution.
     2.6  */
     2.7 -
     2.8 -#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
     2.9 +#if defined(__clang_analyzer__)
    2.10  #define SDL_DISABLE_ANALYZE_MACROS 1
    2.11  #endif
    2.12  
    2.13 -#ifndef _GNU_SOURCE
    2.14 -#define _GNU_SOURCE 1
    2.15 -#endif
    2.16 -
    2.17  #include "../SDL_internal.h"
    2.18  
    2.19  /* This file contains portable string manipulation functions for SDL */
     3.1 --- a/src/test/SDL_test_fuzzer.c	Fri Nov 11 12:41:06 2016 -0800
     3.2 +++ b/src/test/SDL_test_fuzzer.c	Fri Nov 11 13:14:00 2016 -0800
     3.3 @@ -34,7 +34,6 @@
     3.4  #define UINT32_MAX  ~(Uint32)0
     3.5  #define UINT64_MAX  ~(Uint64)0
     3.6  #else
     3.7 -#define _GNU_SOURCE
     3.8  #include <stdint.h>
     3.9  #endif
    3.10  #include <stdio.h>
     4.1 --- a/src/thread/pthread/SDL_sysmutex.c	Fri Nov 11 12:41:06 2016 -0800
     4.2 +++ b/src/thread/pthread/SDL_sysmutex.c	Fri Nov 11 13:14:00 2016 -0800
     4.3 @@ -20,9 +20,6 @@
     4.4  */
     4.5  #include "../../SDL_internal.h"
     4.6  
     4.7 -#ifndef _GNU_SOURCE
     4.8 -#define _GNU_SOURCE
     4.9 -#endif
    4.10  #include <errno.h>
    4.11  #include <pthread.h>
    4.12  
     5.1 --- a/src/thread/pthread/SDL_syssem.c	Fri Nov 11 12:41:06 2016 -0800
     5.2 +++ b/src/thread/pthread/SDL_syssem.c	Fri Nov 11 13:14:00 2016 -0800
     5.3 @@ -20,9 +20,6 @@
     5.4  */
     5.5  #include "../../SDL_internal.h"
     5.6  
     5.7 -#ifndef _GNU_SOURCE
     5.8 -#define _GNU_SOURCE
     5.9 -#endif
    5.10  #include <errno.h>
    5.11  #include <pthread.h>
    5.12  #include <semaphore.h>
     6.1 --- a/src/video/wayland/SDL_waylanddatamanager.c	Fri Nov 11 12:41:06 2016 -0800
     6.2 +++ b/src/video/wayland/SDL_waylanddatamanager.c	Fri Nov 11 13:14:00 2016 -0800
     6.3 @@ -23,8 +23,6 @@
     6.4  
     6.5  #if SDL_VIDEO_DRIVER_WAYLAND
     6.6  
     6.7 -/* _GNU_SOURCE for pipe2 declaration. */
     6.8 -#define _GNU_SOURCE
     6.9  #include <fcntl.h>
    6.10  #include <unistd.h>
    6.11  #include <limits.h>
     7.1 --- a/src/video/wayland/SDL_waylandmouse.c	Fri Nov 11 12:41:06 2016 -0800
     7.2 +++ b/src/video/wayland/SDL_waylandmouse.c	Fri Nov 11 13:14:00 2016 -0800
     7.3 @@ -23,10 +23,6 @@
     7.4  
     7.5  #if SDL_VIDEO_DRIVER_WAYLAND
     7.6  
     7.7 -#ifndef _GNU_SOURCE
     7.8 -#define _GNU_SOURCE
     7.9 -#endif
    7.10 -
    7.11  #include <sys/types.h>
    7.12  #include <sys/mman.h>
    7.13  #include <fcntl.h>
     8.1 --- a/src/video/x11/SDL_x11modes.c	Fri Nov 11 12:41:06 2016 -0800
     8.2 +++ b/src/video/x11/SDL_x11modes.c	Fri Nov 11 13:14:00 2016 -0800
     8.3 @@ -18,10 +18,6 @@
     8.4       misrepresented as being the original software.
     8.5    3. This notice may not be removed or altered from any source distribution.
     8.6  */
     8.7 -#ifndef _GNU_SOURCE
     8.8 -#define _GNU_SOURCE
     8.9 -#endif
    8.10 -
    8.11  #include "../../SDL_internal.h"
    8.12  
    8.13  #if SDL_VIDEO_DRIVER_X11