Bug 1076698 - Part 0: Clean up configure.in's list of gcc/clang warnings. r=ted
--- a/configure.in
+++ b/configure.in
@@ -1407,25 +1407,27 @@ if test "$GNU_CC"; then
else
DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
fi
;;
esac
fi
fi
- # Turn on GNU-specific warnings:
+ # Turn on gcc/clang warnings:
+ # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
+ #
# -Wall - turn on a lot of warnings
- # -Wpointer-arith - good to have
# -Wdeclaration-after-statement - MSVC doesn't like these
- # -Werror=return-type - catches missing returns, zero false positives
- # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+ # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
+ # -Wreturn-type - catches missing returns, zero false positives
+ # -Wsign-compare - catches comparison of signed and unsigned types
# -Wtype-limits - catches overflow bugs, few false positives
- # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
- # -Wsign-compare - catches comparison of signed and unsigned types
#
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
@@ -1473,25 +1475,27 @@ else
DSO_PIC_CFLAGS='-KPIC'
_DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
fi
if test "$GNU_CXX"; then
# FIXME: Let us build with strict aliasing. bug 414641.
CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
- # Turn on GNU-specific warnings:
+ # Turn on gcc/clang warnings:
+ # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
+ #
# -Wall - turn on a lot of warnings
- # -Wpointer-arith - good to have
- # -Woverloaded-virtual - ???
- # -Werror=return-type - catches missing returns, zero false positives
- # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
- # -Werror=type-limits - catches overflow bugs, few false positives
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+ # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Woverloaded-virtual - function declaration hides virtual function from base class
+ # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
+ # -Wreturn-type - catches missing returns, zero false positives
# -Wsign-compare - catches comparison of signed and unsigned types
+ # -Wtype-limits - catches overflow bugs, few false positives
#
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
MOZ_CXX_SUPPORTS_WARNING(-W, error=type-limits, ac_cxx_has_werror_type_limits)
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1159,25 +1159,27 @@ if test "$GNU_CC"; then
AC_MSG_CHECKING([for --build-id option to ld])
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--build-id"
AC_TRY_LINK(,,AC_MSG_RESULT([yes])
[NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
- # Turn on GNU-specific warnings:
+ # Turn on gcc/clang warnings:
+ # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
+ #
# -Wall - turn on a lot of warnings
- # -Wpointer-arith - good to have
# -Wdeclaration-after-statement - MSVC doesn't like these
- # -Werror=return-type - catches missing returns, zero false positives
- # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+ # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
+ # -Wreturn-type - catches missing returns, zero false positives
+ # -Wsign-compare - catches comparison of signed and unsigned types
# -Wtype-limits - catches overflow bugs, few false positives
- # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
- # -Wsign-compare - catches comparison of signed and unsigned types
#
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
@@ -1221,26 +1223,28 @@ else
fi
DSO_CFLAGS=''
DSO_PIC_CFLAGS='-KPIC'
_DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
fi
if test "$GNU_CXX"; then
- # Turn on GNU-specific warnings:
+ # Turn on gcc/clang warnings:
+ # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
+ #
# -Wall - turn on a lot of warnings
- # -Wpointer-arith - good to have
- # -Woverloaded-virtual - ???
- # -Werror=return-type - catches missing returns, zero false positives
- # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Wconversion-null - catches conversions between NULL and non-pointer types
+ # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+ # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
+ # -Woverloaded-virtual - function declaration hides virtual function from base class
+ # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
+ # -Wreturn-type - catches missing returns, zero false positives
+ # -Wsign-compare - catches comparison of signed and unsigned types
# -Wtype-limits - catches overflow bugs, few false positives
- # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
- # -Werror=conversion-null - catches conversions between NULL and non-pointer types
- # -Wsign-compare - catches comparison of signed and unsigned types
#
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)