From 7602a3181e29075936aae8fd02387cc840202c5f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 24 May 2023 14:53:34 -0700
Subject: [PATCH] Allow declarations after statements
The SDL coding standard is C89 plus C++ style comments and mixed code and declarations.
---
CMakeLists.txt | 26 --------------------------
1 file changed, 26 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76211e19bd73..876530890bc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -570,32 +570,6 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
target_compile_options(sdl-global-options INTERFACE "-fno-strict-aliasing")
endif()
- # command-line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++
- check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
- if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
- if(SDL_WERROR)
- check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
- if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
- if(CMAKE_VERSION VERSION_LESS 3.3)
- target_compile_options(sdl-global-options INTERFACE "-Werror=declaration-after-statement")
- else()
- target_compile_options(sdl-global-options INTERFACE "$<$<COMPILE_LANGUAGE:C>:-Werror=declaration-after-statement>")
- if(CMAKE_OBJC_COMPILER)
- target_compile_options(sdl-global-options INTERFACE "$<$<COMPILE_LANGUAGE:OBJC>:-Werror=declaration-after-statement>")
- endif()
- endif()
- endif()
- endif()
- if(CMAKE_VERSION VERSION_LESS 3.3)
- target_compile_options(sdl-global-options INTERFACE "-Wdeclaration-after-statement")
- else()
- target_compile_options(sdl-global-options INTERFACE "$<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>")
- if(CMAKE_OBJC_COMPILER)
- target_compile_options(sdl-global-options INTERFACE "$<$<COMPILE_LANGUAGE:OBJC>:-Wdeclaration-after-statement>")
- endif()
- endif()
- endif()
-
check_c_compiler_flag(-Wdocumentation HAVE_GCC_WDOCUMENTATION)
if(HAVE_GCC_WDOCUMENTATION)
if(SDL_WERROR)