[PATCH ustream-ssl 07/12] cmake: enable extra compiler checks

Rosen Penev rosenp at gmail.com
Thu Dec 10 17:51:16 EST 2020


On Thu, Dec 10, 2020 at 7:44 AM Petr Štetiar <ynezz at true.cz> wrote:
>
> Let's enforce additional automatic checks enforced by the compiler in
> order to catch possible errors during compilation.
>
> Signed-off-by: Petr Štetiar <ynezz at true.cz>
> ---
>  CMakeLists.txt | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index bb2abe5af596..b883751f6e3e 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -3,7 +3,13 @@ cmake_minimum_required(VERSION 2.6)
>  INCLUDE(CheckSymbolExists)
>
>  PROJECT(ustream-ssl C)
> -ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
> +
> +ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3)
> +IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
> +        ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration)
> +        ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral)
> +ENDIF()
> +ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
I recommend adding a clang section that includes
-Wgnu-empty-initializer . You mentioned before that it doesn't work
properly on GCC4.

>
>  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list