Change compile time warning policy

The -Wall flag is now always enabled (when using gcc).  The -Wextra
flag (previously known as -W) and -pedantic flags are, by default,
enabled during development but disabled for releases.

All other flags have been removed.
merge-requests/1/head
Olaf Meeuwissen 2015-12-26 16:51:44 +09:00
rodzic 5136e664b8
commit 0d7882e34b
2 zmienionych plików z 26 dodań i 64 usunięć

Wyświetl plik

@ -20,51 +20,37 @@ dnl AC_PROG_LIBTOOL
dnl
# SANE_SET_CFLAGS(is_release)
# Set CFLAGS. Enable/disable compilation warnings if gcc is used.
# Warnings are enabled by default when in development cycle but disabled
# when a release is made. The argument is_release is either yes or no.
# Set default CFLAGS if gcc is used. Enable or disable additional
# compilation warnings. The extra warnings are enabled by default
# during the development cycle but disabled for official releases.
# The argument is_release is either yes or no.
AC_DEFUN([SANE_SET_CFLAGS],
[
if test "${ac_cv_c_compiler_gnu}" = "yes"; then
NORMAL_CFLAGS="\
DEFAULT_CFLAGS="\
-std=c99 \
-W \
-Wall"
WARN_CFLAGS="\
-std=c99 \
-W \
-Wall \
-Wcast-align \
-Wcast-qual \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wpointer-arith \
-Wreturn-type \
-Wstrict-prototypes \
EXTRA_WARNINGS="\
-Wextra \
-pedantic"
for flag in $DEFAULT_CFLAGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
done
AC_ARG_ENABLE(warnings,
AC_HELP_STRING([--enable-warnings],
[turn on tons of compiler warnings (GCC only)]),
[
if eval "test x$enable_warnings = xyes"; then
for flag in $WARN_CFLAGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
done
else
for flag in $NORMAL_CFLAGS; do
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
done
fi
],
[if test x$1 = xno; then
# Warnings enabled by default (development)
for flag in $WARN_CFLAGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
done
else
# Warnings disabled by default (release)
for flag in $NORMAL_CFLAGS; do
for flag in $EXTRA_WARNINGS; do
JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
done
fi])

50
configure vendored
Wyświetl plik

@ -5182,31 +5182,16 @@ fi
if test "${ac_cv_c_compiler_gnu}" = "yes"; then
NORMAL_CFLAGS="\
DEFAULT_CFLAGS="\
-std=c99 \
-W \
-Wall"
WARN_CFLAGS="\
-std=c99 \
-W \
-Wall \
-Wcast-align \
-Wcast-qual \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wpointer-arith \
-Wreturn-type \
-Wstrict-prototypes \
EXTRA_WARNINGS="\
-Wextra \
-pedantic"
# Check whether --enable-warnings was given.
if test "${enable_warnings+set}" = set; then :
enableval=$enable_warnings;
if eval "test x$enable_warnings = xyes"; then
for flag in $WARN_CFLAGS; do
case "$CFLAGS" in
for flag in $DEFAULT_CFLAGS; do
case "$CFLAGS" in
"$flag" | "$flag "* | *" $flag" | *" $flag "* )
:
;;
@ -5215,9 +5200,13 @@ if test "${enable_warnings+set}" = set; then :
;;
esac
done
else
for flag in $NORMAL_CFLAGS; do
done
# Check whether --enable-warnings was given.
if test "${enable_warnings+set}" = set; then :
enableval=$enable_warnings;
if eval "test x$enable_warnings = xyes"; then
for flag in $EXTRA_WARNINGS; do
case "$CFLAGS" in
"$flag" | "$flag "* | *" $flag" | *" $flag "* )
:
@ -5233,20 +5222,7 @@ esac
else
if test x$is_release = xno; then
# Warnings enabled by default (development)
for flag in $WARN_CFLAGS; do
case "$CFLAGS" in
"$flag" | "$flag "* | *" $flag" | *" $flag "* )
:
;;
*)
CFLAGS="$CFLAGS $flag"
;;
esac
done
else
# Warnings disabled by default (release)
for flag in $NORMAL_CFLAGS; do
for flag in $EXTRA_WARNINGS; do
case "$CFLAGS" in
"$flag" | "$flag "* | *" $flag" | *" $flag "* )
: