Added -Wdocumentation to CMake clang build

This commit is contained in:
Sam Lantinga 2023-01-03 15:50:11 -08:00
parent 32c077216c
commit 39852241ef
2 changed files with 22 additions and 2 deletions

View File

@ -62,8 +62,6 @@ LOCAL_SRC_FILES := \
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
-Wall -Wextra \
-Wdocumentation \
-Wdocumentation-unknown-command \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \

View File

@ -580,6 +580,28 @@ if(USE_GCC OR USE_CLANG)
list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
endif()
check_c_compiler_flag(-Wdocumentation HAVE_GCC_WDOCUMENTATION)
if(HAVE_GCC_WDOCUMENTATION)
if(SDL_WERROR)
check_c_compiler_flag(-Werror=documentation HAVE_GCC_WERROR_DOCUMENTATION)
if(HAVE_GCC_WERROR_DOCUMENTATION)
list(APPEND EXTRA_CFLAGS "-Werror=documentation")
endif()
endif()
list(APPEND EXTRA_CFLAGS "-Wdocumentation")
endif()
check_c_compiler_flag(-Wdocumentation-unknown-command HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND)
if(HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND)
if(SDL_WERROR)
check_c_compiler_flag(-Werror=documentation-unknown-command HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND)
if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND)
list(APPEND EXTRA_CFLAGS "-Werror=documentation-unknown-command")
endif()
endif()
list(APPEND EXTRA_CFLAGS "-Wdocumentation-unknown-command")
endif()
if(DEPENDENCY_TRACKING)
check_c_source_compiles("
#if !defined(__GNUC__) || __GNUC__ < 3