Add --enable-warn-error
On by default if +dev appears in VERSION and also fixed for MSVC.master
parent
9114ab0545
commit
75c9cd3b38
|
@ -913,6 +913,7 @@ enable_flambda_invariants
|
|||
with_target_bindir
|
||||
enable_reserved_header_bits
|
||||
enable_stdlib_manpages
|
||||
enable_warn_error
|
||||
enable_force_safe_string
|
||||
enable_flat_float_array
|
||||
enable_function_sections
|
||||
|
@ -1593,6 +1594,7 @@ Optional Features:
|
|||
headers for profiling info
|
||||
--disable-stdlib-manpages
|
||||
do not build or install the library man pages
|
||||
--enable-warn-error treat C compiler warnings as errors
|
||||
--disable-force-safe-string
|
||||
do not force strings to be safe
|
||||
--disable-flat-float-array
|
||||
|
@ -3251,6 +3253,12 @@ if test "${enable_stdlib_manpages+set}" = set; then :
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --enable-warn-error was given.
|
||||
if test "${enable_warn_error+set}" = set; then :
|
||||
enableval=$enable_warn_error;
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# There are two configure-time string safety options,
|
||||
|
@ -12610,21 +12618,26 @@ fi
|
|||
|
||||
case $ocaml_cv_cc_vendor in #(
|
||||
xlc-*) :
|
||||
outputobj='-o $(EMPTY)'; gcc_warnings="-qflag=i:i" ;; #(
|
||||
outputobj='-o $(EMPTY)'
|
||||
warn_error_flag=''
|
||||
gcc_warnings='-qflag=i:i' ;; #(
|
||||
# all warnings enabled
|
||||
msvc-*) :
|
||||
outputobj=-Fo; gcc_warnings="" ;; #(
|
||||
outputobj='-Fo'
|
||||
warn_error_flag='-WX'
|
||||
gcc_warnings='' ;; #(
|
||||
*) :
|
||||
outputobj='-o $(EMPTY)'
|
||||
gcc_warnings='-Wall -Wdeclaration-after-statement'
|
||||
case 4.12.0+dev0-2020-04-22 in #(
|
||||
*+dev*) :
|
||||
gcc_warnings="$gcc_warnings -Werror" ;; #(
|
||||
warn_error_flag='-Werror'
|
||||
gcc_warnings='-Wall -Wdeclaration-after-statement' ;;
|
||||
esac
|
||||
|
||||
case $enable_warn_error,4.12.0+dev0-2020-04-22 in #(
|
||||
yes,*|,*+dev*) :
|
||||
gcc_warnings="$gcc_warnings $warn_error_flag" ;; #(
|
||||
*) :
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# We select high optimization levels, provided we can turn off:
|
||||
# - strict type-based aliasing analysis (too risky for the OCaml runtime)
|
||||
|
@ -12689,7 +12702,7 @@ $as_echo "$as_me: WARNING: Consider using GCC version 4.2 or above." >&2;};
|
|||
internal_cflags="$gcc_warnings -fno-common \
|
||||
-fexcess-precision=standard" ;; #(
|
||||
msvc-*) :
|
||||
common_cflags="-nologo -O2 -Gy- -MD"
|
||||
common_cflags="-nologo -O2 -Gy- -MD $gcc_warnings"
|
||||
common_cppflags="-D_CRT_SECURE_NO_DEPRECATE"
|
||||
internal_cppflags='-DUNICODE -D_UNICODE'
|
||||
internal_cppflags="$internal_cppflags -DWINDOWS_UNICODE="
|
||||
|
|
25
configure.ac
25
configure.ac
|
@ -348,6 +348,10 @@ AC_ARG_ENABLE([stdlib-manpages],
|
|||
[AS_HELP_STRING([--disable-stdlib-manpages],
|
||||
[do not build or install the library man pages])])
|
||||
|
||||
AC_ARG_ENABLE([warn-error],
|
||||
[AS_HELP_STRING([--enable-warn-error],
|
||||
[treat C compiler warnings as errors])])
|
||||
|
||||
AC_ARG_VAR([WINDOWS_UNICODE_MODE],
|
||||
[how to handle Unicode under Windows: ansi, compatible])
|
||||
|
||||
|
@ -556,15 +560,20 @@ AS_IF(
|
|||
|
||||
AS_CASE([$ocaml_cv_cc_vendor],
|
||||
[xlc-*],
|
||||
[outputobj='-o $(EMPTY)'; gcc_warnings="-qflag=i:i"], # all warnings enabled
|
||||
[outputobj='-o $(EMPTY)'
|
||||
warn_error_flag=''
|
||||
gcc_warnings='-qflag=i:i'], # all warnings enabled
|
||||
[msvc-*],
|
||||
[outputobj=-Fo; gcc_warnings=""],
|
||||
[outputobj='-Fo'
|
||||
warn_error_flag='-WX'
|
||||
gcc_warnings=''],
|
||||
[outputobj='-o $(EMPTY)'
|
||||
gcc_warnings='-Wall -Wdeclaration-after-statement'
|
||||
AS_CASE([AC_PACKAGE_VERSION],
|
||||
[*+dev*],
|
||||
[gcc_warnings="$gcc_warnings -Werror"])
|
||||
])
|
||||
warn_error_flag='-Werror'
|
||||
gcc_warnings='-Wall -Wdeclaration-after-statement'])
|
||||
|
||||
AS_CASE([$enable_warn_error,AC_PACKAGE_VERSION],
|
||||
[yes,*|,*+dev*],
|
||||
[gcc_warnings="$gcc_warnings $warn_error_flag"])
|
||||
|
||||
# We select high optimization levels, provided we can turn off:
|
||||
# - strict type-based aliasing analysis (too risky for the OCaml runtime)
|
||||
|
@ -627,7 +636,7 @@ AS_CASE([$host],
|
|||
internal_cflags="$gcc_warnings -fno-common \
|
||||
-fexcess-precision=standard"],
|
||||
[msvc-*],
|
||||
[common_cflags="-nologo -O2 -Gy- -MD"
|
||||
[common_cflags="-nologo -O2 -Gy- -MD $gcc_warnings"
|
||||
common_cppflags="-D_CRT_SECURE_NO_DEPRECATE"
|
||||
internal_cppflags='-DUNICODE -D_UNICODE'
|
||||
internal_cppflags="$internal_cppflags -DWINDOWS_UNICODE="
|
||||
|
|
|
@ -49,7 +49,6 @@ function run {
|
|||
# Takes 3 arguments
|
||||
# $1:the Windows port. Recognized values: mingw, msvc and msvc64
|
||||
# $2: the prefix to use to install
|
||||
# $3: C compiler flags to use to turn warnings into errors
|
||||
function set_configuration {
|
||||
case "$1" in
|
||||
mingw)
|
||||
|
@ -77,9 +76,7 @@ function set_configuration {
|
|||
./configure --cache-file="$CACHE_DIRECTORY/config.cache-$1" \
|
||||
$dep $build $host --prefix="$2" --enable-ocamltest )
|
||||
|
||||
FILE=$(pwd | cygpath -f - -m)/Makefile.config
|
||||
echo "Edit $FILE to turn C compiler warnings into errors"
|
||||
sed -i -e '/^ *OC_CFLAGS *=/s/\r\?$/ '"$3"'\0/' "$FILE"
|
||||
# FILE=$(pwd | cygpath -f - -m)/Makefile.config
|
||||
# run "Content of $FILE" cat Makefile.config
|
||||
}
|
||||
|
||||
|
@ -110,7 +107,7 @@ case "$1" in
|
|||
msvc32-only)
|
||||
cd "$APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX-msvc32"
|
||||
|
||||
set_configuration msvc "$OCAMLROOT-msvc32" -WX
|
||||
set_configuration msvc "$OCAMLROOT-msvc32"
|
||||
|
||||
run "$MAKE world" $MAKE world
|
||||
run "$MAKE runtimeopt" $MAKE runtimeopt
|
||||
|
@ -163,9 +160,9 @@ case "$1" in
|
|||
fi
|
||||
|
||||
if [[ $PORT = 'msvc64' ]] ; then
|
||||
set_configuration msvc64 "$OCAMLROOT" -WX
|
||||
set_configuration msvc64 "$OCAMLROOT"
|
||||
else
|
||||
set_configuration mingw "$OCAMLROOT-mingw32" -Werror
|
||||
set_configuration mingw "$OCAMLROOT-mingw32"
|
||||
fi
|
||||
|
||||
cd "$APPVEYOR_BUILD_FOLDER/../$BUILD_PREFIX-$PORT"
|
||||
|
|
Loading…
Reference in New Issue