From 9daca35b136d5036ea0e7d590f782847786cf83f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 25 Apr 2025 16:39:45 +0200 Subject: [PATCH] build: enable gcc-15 picky warnings Closes #17199 --- CMake/PickyWarnings.cmake | 7 +++++++ m4/curl-compilers.m4 | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/CMake/PickyWarnings.cmake b/CMake/PickyWarnings.cmake index 3531de1c52..be26d05cb8 100644 --- a/CMake/PickyWarnings.cmake +++ b/CMake/PickyWarnings.cmake @@ -249,6 +249,13 @@ if(PICKY_COMPILER) -Wxor-used-as-pow # clang 10.0 gcc 13.0 ) endif() + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0) + list(APPEND _picky_enable + -Wleading-whitespace=spaces # gcc 15.0 + -Wtrailing-whitespace=any # gcc 15.0 + -Wunterminated-string-initialization # gcc 15.0 + ) + endif() endif() # diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index df4b9a266c..dc6d3aa4cf 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -1108,6 +1108,13 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [ CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [xor-used-as-pow]) fi # + dnl Only gcc 15 or later + if test "$compiler_num" -ge "1500"; then + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [leading-whitespace=spaces]) + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [trailing-whitespace=any]) + CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unterminated-string-initialization]) + fi + # fi # dnl Do not issue warnings for code in system include paths. -- 2.47.3