Skip to content

Commit

Permalink
cmake: fix uses of undefined macro identifiers (-Wundef)
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr authored Nov 17, 2023
1 parent cc7c0a2 commit d81d986
Show file tree
Hide file tree
Showing 430 changed files with 1,289 additions and 1,260 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
endif()
endif()

check_c_compiler_flag(-Wundef HAVE_GCC_WUNDEF)
if(HAVE_GCC_WUNDEF)
list(APPEND EXTRA_CFLAGS "-Wundef")
endif()

check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING)
if(HAVE_GCC_NO_STRICT_ALIASING)
list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")
Expand Down
2 changes: 1 addition & 1 deletion docs/README-ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ e.g.
{
... initialize game ...

#if __IPHONEOS__
#ifdef __IPHONEOS__
// Initialize the Game Center for scoring and matchmaking
InitGameCenter();

Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/* Comment this if you want to build without any C library requirements */
#cmakedefine HAVE_LIBC 1
#if HAVE_LIBC
#ifdef HAVE_LIBC

/* Useful headers */
#cmakedefine STDC_HEADERS 1
Expand Down
2 changes: 1 addition & 1 deletion include/SDL_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

/* Comment this if you want to build without any C library requirements */
#undef HAVE_LIBC
#if HAVE_LIBC
#ifdef HAVE_LIBC

/* Useful headers */
#undef STDC_HEADERS
Expand Down
8 changes: 4 additions & 4 deletions include/SDL_config_winrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

/* Useful headers */
#define HAVE_DXGI_H 1
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
#if !SDL_WINAPI_FAMILY_PHONE
#define HAVE_XINPUT_H 1
#endif

Expand Down Expand Up @@ -161,7 +161,7 @@
#define SDL_AUDIO_DRIVER_DUMMY 1

/* Enable various input drivers */
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#if SDL_WINAPI_FAMILY_PHONE
#define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
#else
Expand Down Expand Up @@ -208,9 +208,9 @@
#define SDL_VIDEO_RENDER_D3D11 1

/* Disable D3D12 as it's not implemented for WinRT */
#define SDL_VIDEO_RENDER_D3D12 0
/* #undef SDL_VIDEO_RENDER_D3D12 */

#if SDL_VIDEO_OPENGL_ES2
#ifdef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif

Expand Down
6 changes: 6 additions & 0 deletions include/SDL_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@
#define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */

#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif

#if WINAPI_FAMILY_WINRT
#undef __WINRT__
#define __WINRT__ 1
Expand Down
Loading

0 comments on commit d81d986

Please sign in to comment.