build: sync warning options between autotools, cmake & compilers
- cmake: enable Apple-specific `-Werror=partial-availability` to match autotools. - autotools: enable `-pedantic-errors` with llvm/clang to match gcc and CMake. - autotools: enable `-Werror-implicit-function-declaration` for llvm/clang to match gcc. - cmake: enable `-Werror-implicit-function-declaration` to match autotools. - move `-Wpointer-bool-conversion` from autotools to the local file (`sectransp.c`) it was meant to apply. This way it applies to all build methods. - autotoos: show `CURL_CFLAG_EXTRAS` in the `./configure` summary. (it may contain `-Werror` and/or `-pedentic-errors`.) Cherry-picked from #14097 Closes #14128
This commit is contained in:
parent
e0fad6e86f
commit
59cadacfcc
@ -33,6 +33,16 @@ if(CURL_WERROR AND
|
|||||||
set(WPICKY "${WPICKY} -pedantic-errors")
|
set(WPICKY "${WPICKY} -pedantic-errors")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(APPLE AND
|
||||||
|
(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) OR
|
||||||
|
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.3))
|
||||||
|
set(WPICKY "${WPICKY} -Werror=partial-availability") # clang 3.6 appleclang 6.3
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
set(WPICKY "${WPICKY} -Werror-implicit-function-declaration") # clang 1.0 gcc 2.95
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PICKY_COMPILER)
|
if(PICKY_COMPILER)
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
|
||||||
|
|||||||
@ -540,6 +540,8 @@ if test X"$want_werror" = Xyes; then
|
|||||||
if test "$compiler_num" -ge "500"; then
|
if test "$compiler_num" -ge "500"; then
|
||||||
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
||||||
fi
|
fi
|
||||||
|
elif test "$compiler_id" = "CLANG"; then
|
||||||
|
CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_SUBST(CURL_CFLAG_EXTRAS)
|
AC_SUBST(CURL_CFLAG_EXTRAS)
|
||||||
@ -5023,6 +5025,7 @@ AC_MSG_NOTICE([Configured to build curl/libcurl:
|
|||||||
Install prefix: ${prefix}
|
Install prefix: ${prefix}
|
||||||
Compiler: ${CC}
|
Compiler: ${CC}
|
||||||
CFLAGS: ${CFLAGS}
|
CFLAGS: ${CFLAGS}
|
||||||
|
CFLAGS extras: ${CURL_CFLAG_EXTRAS}
|
||||||
CPPFLAGS: ${CPPFLAGS}
|
CPPFLAGS: ${CPPFLAGS}
|
||||||
LDFLAGS: ${LDFLAGS}
|
LDFLAGS: ${LDFLAGS}
|
||||||
LIBS: ${LIBS}
|
LIBS: ${LIBS}
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wpointer-bool-conversion"
|
||||||
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
#pragma clang diagnostic ignored "-Wtautological-pointer-compare"
|
||||||
#endif /* __clang__ */
|
#endif /* __clang__ */
|
||||||
|
|
||||||
|
|||||||
@ -519,6 +519,7 @@ AC_DEFUN([CURL_SET_COMPILER_BASIC_OPTS], [
|
|||||||
dnl warn about compile-time arguments used during link-time, like
|
dnl warn about compile-time arguments used during link-time, like
|
||||||
dnl -O and -g and -pedantic.
|
dnl -O and -g and -pedantic.
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
|
tmp_CFLAGS="$tmp_CFLAGS -Qunused-arguments"
|
||||||
|
tmp_CFLAGS="$tmp_CFLAGS -Werror-implicit-function-declaration"
|
||||||
;;
|
;;
|
||||||
#
|
#
|
||||||
DEC_C)
|
DEC_C)
|
||||||
@ -897,10 +898,6 @@ AC_DEFUN([CURL_SET_COMPILER_WARNING_OPTS], [
|
|||||||
tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough" # we have silencing markup for clang 10.0 and above only
|
tmp_CFLAGS="$tmp_CFLAGS -Wimplicit-fallthrough" # we have silencing markup for clang 10.0 and above only
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
dnl Disable pointer to bool conversion warnings since they cause
|
|
||||||
dnl lib/securetransp.c cause several warnings for checks we want.
|
|
||||||
dnl This option should be placed after -Wconversion.
|
|
||||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-pointer-bool-conversion"
|
|
||||||
;;
|
;;
|
||||||
#
|
#
|
||||||
DEC_C)
|
DEC_C)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user