From 39852241efd3f15f58a5d9fb83212bc75f9342d9 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 3 Jan 2023 15:50:11 -0800 Subject: [PATCH] Added -Wdocumentation to CMake clang build --- Android.mk | 2 -- CMakeLists.txt | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Android.mk b/Android.mk index 8df91c198..e781fc02f 100644 --- a/Android.mk +++ b/Android.mk @@ -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 \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4452c73..49f1bfbff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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