author | Nicholas Nethercote <nnethercote@mozilla.com> |
Wed, 16 Dec 2015 18:39:50 -0800 | |
changeset 278276 | 470ab2722530f603fde64de3554cbf16b39787db |
parent 278275 | 6f927d0ccfbd5971edf0e34808e1c78af7f9721b |
child 278277 | 6aedf1738475bac8518ae801b9df94dec0ade363 |
push id | 29847 |
push user | cbook@mozilla.com |
push date | Mon, 04 Jan 2016 10:55:44 +0000 |
treeherder | autoland@0771c5eab32f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | glandium, cpeterson |
bugs | 1232224 |
milestone | 46.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
configure.in | file | annotate | diff | comparison | revisions | |
js/src/configure.in | file | annotate | diff | comparison | revisions |
--- a/configure.in +++ b/configure.in @@ -1439,89 +1439,68 @@ if test "$GNU_CC"; then DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols" fi ;; esac fi fi # 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 - # -Wchar-subscripts - catches array index using signed char - # -Wcomment - catches nested comments + # https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html + + # -Wall - lots of useful warnings # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives - # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment - # -Wenum-compare - catches comparison of different enum types # -Wignored-qualifiers - catches returns types with qualifiers like const - # -Wint-to-pointer-cast - catches cast to pointer from integer of different size - # -Wmultichar - catches multicharacter integer constants like 'THIS' - # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant - # -Wnonnull - catches NULL used with functions arguments marked as non-null # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) - # -Wpointer-sign - catches mixing pointers to signed and unsigned types - # -Wpointer-to-int-cast - catches casts from pointer to different sized int - # -Wreturn-type - catches missing returns, zero false positives - # -Wsequence-point - catches undefined order behavior like `a = a++` - # -Wsign-compare - catches comparison of signed and unsigned types - # -Wtrigraphs - catches unlikely use of trigraphs # -Wtype-limits - catches overflow bugs, few false positives - # -Wunknown-pragmas - catches unexpected #pragma directives - # _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall" _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wignored-qualifiers" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-arith" _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits" - # Treat some warnings as errors if --enable-warnings-as-errors: + # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant + # -Wsometimes-initialized - catches some uninitialized values + # + # XXX: at the time of writing, the version of clang used on the OS X test + # machines has a bug that causes it to reject some valid files if both + # -Wnon-literal-null-conversion and -Wsometimes-uninitialized are + # specified. We work around this by instead using + # -Werror=non-literal-null-conversion, but we only do that when + # --enable-warnings-as-errors is specified so that no unexpected fatal + # warnings are produced. if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=uninitialized" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas" - - MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion) - MOZ_C_SUPPORTS_WARNING(-Werror=, sometimes-uninitialized, ac_c_has_sometimes_uninitialized) - fi - - # Turn off the following warnings that -Wall turns on: - # -Wno-unused - lots of violations in third-party code - # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros - # - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused" - - MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) - + MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_non_literal_null_conversion) + fi + MOZ_C_SUPPORTS_WARNING(-W, sometimes-uninitialized, ac_c_has_sometimes_uninitialized) + + # -Wcast-align - catches problems with cast alignment if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then # Don't use -Wcast-align with ICC or clang case "$CPU_ARCH" in # And don't use it on hppa, ia64, sparc, arm, since it's noisy there hppa | ia64 | sparc | arm) ;; *) _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align" ;; esac fi + # Turn off some non-useful warnings that -Wall turns on. + + # -Wno-unused - lots of violations in third-party code + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused" + + # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros + MOZ_C_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_c_has_wno_unused_local_typedef) + _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT' _USE_CPP_INCLUDE_FLAG=1 + ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS" elif test "$SOLARIS_SUNPRO_CC"; then DSO_CFLAGS='' if test "$CPU_ARCH" = "sparc"; then # for Sun Studio on Solaris/SPARC DSO_PIC_CFLAGS='-xcode=pic32' else @@ -1543,101 +1522,83 @@ else _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 gcc/clang warnings: - # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html - # - # -Wall - turn on a lot of warnings + # https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html + + # -Wall - lots of useful warnings # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives - # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment - # -Wint-to-pointer-cast - catches cast to pointer from integer of different size - # -Wmissing-braces - catches aggregate initializers missing nested braces - # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant # -Woverloaded-virtual - function declaration hides virtual function from base class - # -Wparentheses - catches `if (a=b)` and operator precedence bugs # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) - # -Wrange-loop-analysis - catches copies during range-based for loops. - # -Wreturn-type - catches missing returns, zero false positives - # -Wsequence-point - catches undefined order behavior like `a = a++` - # -Wsign-compare - catches comparison of signed and unsigned types - # -Wswitch - catches switches without all enum cases or default case - # -Wtrigraphs - catches unlikely use of trigraphs # -Wtype-limits - catches overflow bugs, few false positives - # -Wunused-label - catches unused goto labels - # -Wwrite-strings - catches non-const char* pointers to string literals - # _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall" _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body" _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings" - - # Treat some warnings as errors if --enable-warnings-as-errors: + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wpointer-arith" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wtype-limits" + + # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant + # -Wrange-loop-analysis - catches copies during range-based for loops. + # -Wsometimes-initialized - catches some uninitialized values + # + # XXX: at the time of writing, the version of clang used on the OS X test + # machines has a bug that causes it to reject some valid files if both + # -Wnon-literal-null-conversion and -Wsometimes-uninitialized are + # specified. We work around this by instead using + # -Werror=non-literal-null-conversion, but we only do that when + # --enable-warnings-as-errors is specified so that no unexpected fatal + # warnings are produced. if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=uninitialized" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label" - - MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion) - MOZ_CXX_SUPPORTS_WARNING(-Werror=, range-loop-analysis, ac_cxx_has_range_loop_analysis) - MOZ_CXX_SUPPORTS_WARNING(-Werror=, sometimes-uninitialized, ac_cxx_has_sometimes_uninitialized) - fi - - # Turn off the following warnings that -Wall turns on: - # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently - # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc - # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros - # for performance reasons, and because GCC and clang accept it (though - # clang warns about it). - # - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof" - - MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete) - MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) - + MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_non_literal_null_conversion) + fi + MOZ_CXX_SUPPORTS_WARNING(-W, range-loop-analysis, ac_cxx_has_range_loop_analysis) + MOZ_CXX_SUPPORTS_WARNING(-W, sometimes-uninitialized, ac_cxx_has_sometimes_uninitialized) + + # -Wcast-align - catches problems with cast alignment if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then # Don't use -Wcast-align with ICC or clang case "$CPU_ARCH" in # And don't use it on hppa, ia64, sparc, arm, since it's noisy there hppa | ia64 | sparc | arm) ;; *) _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align" ;; esac fi - _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h' - _USE_CPP_INCLUDE_FLAG=1 + # Turn off some non-useful warnings that -Wall turns on. + + # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof" + + # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc + # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros + MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete) + MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) # Recent clang and gcc support C++11 deleted functions without warnings if # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new # versions). We can't use -std=c++0x yet, so gcc's support must remain # unused. But clang's warning can be disabled, so when compiling with clang # we use it to opt out of the warning, enabling (macro-encapsulated) use of # deleted function syntax. if test "$CLANG_CXX"; then _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions" MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof) fi + _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h' + _USE_CPP_INCLUDE_FLAG=1 + else _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)' fi dnl ======================================================== dnl Checking for 64-bit OS dnl ======================================================== if test "$COMPILE_ENVIRONMENT"; then
--- a/js/src/configure.in +++ b/js/src/configure.in @@ -1182,101 +1182,65 @@ if test "$GNU_CC"; then _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 gcc/clang warnings: - # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html - # - # -Wall - turn on a lot of warnings - # -Waddress - catches suspicious uses of memory addresses - # -Wchar-subscripts - catches array index using signed char - # -Wcomment - catches nested comments + # https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html + + # -Wall - lots of useful warnings # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives - # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment - # -Wenum-compare - catches comparison of different enum types # -Wignored-qualifiers - catches returns types with qualifiers like const - # -Wimplicit-function-declaration - catches missing C function prototypes - # -Wint-to-pointer-cast - catches cast to pointer from integer of different size - # -Wmissing-braces - catches aggregate initializers missing nested braces - # -Wmultichar - catches multicharacter integer constants like 'THIS' + # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) + # -Wtype-limits - catches overflow bugs, few false positives + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wignored-qualifiers" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-arith" + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits" + # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant - # -Wnonnull - catches NULL used with functions arguments marked as non-null - # -Wparentheses - catches `if (a=b)` and operator precedence bugs - # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) - # -Wpointer-sign - catches mixing pointers to signed and unsigned types - # -Wpointer-to-int-cast - catches casts from pointer to different sized int - # -Wreturn-type - catches missing returns, zero false positives - # -Wsequence-point - catches undefined order behavior like `a = a++` - # -Wsign-compare - catches comparison of signed and unsigned types - # -Wswitch - catches switches without all enum cases or default case - # -Wtrigraphs - catches unlikely use of trigraphs - # -Wtype-limits - catches overflow bugs, few false positives - # -Wunknown-pragmas - catches unexpected #pragma directives - # -Wwrite-strings - catches non-const char* pointers to string literals + # -Wsometimes-initialized - catches some uninitialized values # - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits" - - # Treat some warnings as errors if --enable-warnings-as-errors: + # XXX: at the time of writing, the version of clang used on the OS X test + # machines has a bug that causes it to reject some valid files if both + # -Wnon-literal-null-conversion and -Wsometimes-uninitialized are + # specified. We work around this by instead using + # -Werror=non-literal-null-conversion, but we only do that when + # --enable-warnings-as-errors is specified so that no unexpected fatal + # warnings are produced. if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=address" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=empty-body" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=implicit-function-declaration" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=missing-braces" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=parentheses" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-to-int-cast" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=switch" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=uninitialized" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas" - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=write-strings" - - MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion) - MOZ_C_SUPPORTS_WARNING(-Werror=, sometimes-uninitialized, ac_c_has_sometimes_uninitialized) + MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_non_literal_null_conversion) fi - - # Turn off the following warnings that -Wall turns on: - # -Wno-unused - lots of violations in third-party code - # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc - # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros - # - _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused" - - MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete) - MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) - + MOZ_C_SUPPORTS_WARNING(-W, sometimes-uninitialized, ac_c_has_sometimes_uninitialized) + + # -Wcast-align - catches problems with cast alignment if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then # Don't use -Wcast-align with ICC or clang case "$CPU_ARCH" in # And don't use it on hppa, ia64, sparc, arm, since it's noisy there hppa | ia64 | sparc | arm) ;; *) _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align" ;; esac fi + # Turn off some non-useful warnings that -Wall turns on. + + # -Wno-unused - lots of violations in third-party code + _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused" + + # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros + MOZ_C_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_c_has_wno_unused_local_typedef) + _DEFINES_CFLAGS='-include $(topobjdir)/js/src/js-confdefs.h -DMOZILLA_CLIENT' _USE_CPP_INCLUDE_FLAG=1 elif test "$SOLARIS_SUNPRO_CC"; then DSO_CFLAGS='' if test "$CPU_ARCH" = "sparc"; then # for Sun Studio on Solaris/SPARC DSO_PIC_CFLAGS='-xcode=pic32' @@ -1296,113 +1260,86 @@ else DSO_CFLAGS='' DSO_PIC_CFLAGS='-KPIC' _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' fi if test "$GNU_CXX"; then # 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 - # -Wchar-subscripts - catches array index using signed char - # -Wcomment - catches nested comments - # -Wconversion-null - catches conversions between NULL and non-pointer types + # https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Warning-Options.html + + # -Wall - lots of useful warnings # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives - # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment - # -Wignored-qualifiers - catches returns types with qualifiers like const - # -Wint-to-pointer-cast - catches cast to pointer from integer of different size - # -Wmissing-braces - catches aggregate initializers missing nested braces + # -Woverloaded-virtual - function declaration hides virtual function from base class + # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) + # -Wtype-limits - catches overflow bugs, few false positives + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wpointer-arith" + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wtype-limits" + + # -Wclass-varargs - ??? # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant - # -Woverloaded-virtual - function declaration hides virtual function from base class - # -Wparentheses - catches `if (a=b)` and operator precedence bugs - # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void) - # -Wpointer-to-int-cast - catches casts from pointer to different sized int # -Wrange-loop-analysis - catches copies during range-based for loops. - # -Wreorder - catches ctor initializer list not matching class definition order - # -Wreturn-type - catches missing returns, zero false positives - # -Wsequence-point - catches undefined order behavior like `a = a++` - # -Wsign-compare - catches comparison of signed and unsigned types - # -Wswitch - catches switches without all enum cases or default case - # -Wtrigraphs - catches unlikely use of trigraphs - # -Wtype-limits - catches overflow bugs, few false positives - # -Wunknown-pragmas - catches unexpected #pragma directives - # -Wunused-label - catches unused goto labels - # -Wunused-value - catches unused expression results - # -Wwrite-strings - catches non-const char* pointers to string literals + # -Wsometimes-initialized - catches some uninitialized values # - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wtype-limits" - + # XXX: at the time of writing, the version of clang used on the OS X test + # machines has a bug that causes it to reject some valid files if both + # -Wnon-literal-null-conversion and -Wsometimes-uninitialized are + # specified. We work around this by instead using + # -Werror=non-literal-null-conversion, but we only do that when + # --enable-warnings-as-errors is specified so that no unexpected fatal + # warnings are produced. MOZ_CXX_SUPPORTS_WARNING(-W, class-varargs, ac_cxx_has_wclass_varargs) - # Treat some warnings as errors if --enable-warnings-as-errors: if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=char-subscripts" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=comment" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=ignored-qualifiers" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=overloaded-virtual" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=reorder" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=uninitialized" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unknown-pragmas" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-value" - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=write-strings" - - MOZ_CXX_SUPPORTS_WARNING(-Werror=, conversion-null, ac_cxx_has_werror_conversion_null) - MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion) - MOZ_CXX_SUPPORTS_WARNING(-Werror=, range-loop-analysis, ac_cxx_has_range_loop_analysis) - MOZ_CXX_SUPPORTS_WARNING(-Werror=, sometimes-uninitialized, ac_cxx_has_sometimes_uninitialized) + MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_non_literal_null_conversion) fi - - # Turn off the following warnings that -Wall turns on: - # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently - # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros - # - _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof" - - MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) - + MOZ_CXX_SUPPORTS_WARNING(-W, range-loop-analysis, ac_cxx_has_range_loop_analysis) + MOZ_CXX_SUPPORTS_WARNING(-W, sometimes-uninitialized, ac_cxx_has_sometimes_uninitialized) + + # -Wcast-align - catches problems with cast alignment if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then # Don't use -Wcast-align with ICC or clang case "$CPU_ARCH" in # And don't use it on hppa, ia64, sparc, arm, since it's noisy there hppa | ia64 | sparc | arm) ;; *) _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align" ;; esac fi - _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/js/src/js-confdefs.h' - _USE_CPP_INCLUDE_FLAG=1 + # Turn off some non-useful warnings that -Wall turns on. + + # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently + _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof" + + # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc + # -Wno-unused-local-typedef - catches unused typedefs, which are commonly used in assertion macros + MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete) + MOZ_CXX_SUPPORTS_WARNING(-Wno-, unused-local-typedef, ac_cxx_has_wno_unused_local_typedef) # Recent clang and gcc support C++11 deleted functions without warnings if # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new # versions). We can't use -std=c++0x yet, so gcc's support must remain # unused. But clang's warning can be disabled, so when compiling with clang # we use it to opt out of the warning, enabling (macro-encapsulated) use of # deleted function syntax. if test "$CLANG_CXX"; then _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions" MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof) fi + _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/js/src/js-confdefs.h' + _USE_CPP_INCLUDE_FLAG=1 + else _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)' fi dnl ======================================================== dnl Checking for 64-bit OS dnl ======================================================== if test "$COMPILE_ENVIRONMENT"; then