зеркало из https://github.com/mozilla/pjs.git
Bug 711895 - Tweak the warning options used for GCC builds (3rd attempt). r=waldo,derf,khuey,mhommey.
--HG-- extra : rebase_source : 20540c9b838ee3be6cb0847c1b90fdc3bd44059d
This commit is contained in:
Родитель
bd29bcbee8
Коммит
3668e4363c
|
@ -82,3 +82,49 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
|
|||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl GCC and clang will fail if given an unknown warning option like -Wfoobar.
|
||||
dnl But later versions won't fail if given an unknown negated warning option
|
||||
dnl like -Wno-foobar. So when we are check for support of negated warning
|
||||
dnl options, we actually test the positive form, but add the negated form to
|
||||
dnl the flags variable.
|
||||
|
||||
AC_DEFUN([MOZ_C_SUPPORTS_WARNING],
|
||||
[
|
||||
AC_CACHE_CHECK(whether the C compiler supports $1$2, $3,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -W$2"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
$3="yes",
|
||||
$3="no")
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "${$3}" = "yes"; then
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} $1$2"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MOZ_CXX_SUPPORTS_WARNING],
|
||||
[
|
||||
AC_CACHE_CHECK(whether the C++ compiler supports $1$2, $3,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror -W$2"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
$3="yes",
|
||||
$3="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "${$3}" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} $1$2"
|
||||
fi
|
||||
])
|
||||
|
|
137
configure.in
137
configure.in
|
@ -1707,15 +1707,27 @@ if test "$GNU_CC"; then
|
|||
_MOZ_RTTI_FLAGS_ON=-frtti
|
||||
_MOZ_RTTI_FLAGS_OFF=-fno-rtti
|
||||
|
||||
# Turn on GNU specific features
|
||||
# -Wall - turn on all warnings
|
||||
# -pedantic - make compiler warn about non-ANSI stuff, and
|
||||
# be a little bit stricter
|
||||
# Turn on GNU-specific warnings:
|
||||
# -Wall - turn on a lot of warnings
|
||||
# -pedantic - this is turned on below
|
||||
# -Wpointer-arith - enabled with -pedantic, but good to have even if not
|
||||
# -Wdeclaration-after-statement - MSVC doesn't like these
|
||||
# Warnings slamm took out for now (these were giving more noise than help):
|
||||
# -Wbad-function-cast - warns when casting a function to a new return type
|
||||
# -Wshadow - removed because it generates more noise than help --pete
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wdeclaration-after-statement"
|
||||
# -Werror=return-type - catches missing returns, zero false positives
|
||||
# -Wtype-limits - catches overflow bugs, few false positives
|
||||
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
|
||||
#
|
||||
_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, type-limits, ac_c_has_wtype_limits)
|
||||
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
|
||||
|
||||
# Turn off the following warnings that -Wall/-pedantic turn on:
|
||||
# -Wno-unused - lots of violations in third-party code
|
||||
# -Wno-overlength-strings - we exceed the minimum maximum length frequently
|
||||
#
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
|
||||
MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
|
||||
|
||||
if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
|
||||
# Don't use -Wcast-align with ICC or clang
|
||||
case "$CPU_ARCH" in
|
||||
|
@ -1731,12 +1743,9 @@ if test "$GNU_CC"; then
|
|||
dnl Turn pedantic on but disable the warnings for long long
|
||||
_PEDANTIC=1
|
||||
|
||||
if test -z "$INTEL_CC"; then
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
|
||||
fi
|
||||
|
||||
_DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
|
||||
_USE_CPP_INCLUDE_FLAG=1
|
||||
|
||||
elif test "$SOLARIS_SUNPRO_CC"; then
|
||||
DSO_CFLAGS=''
|
||||
if test "$CPU_ARCH" = "sparc"; then
|
||||
|
@ -1764,8 +1773,32 @@ 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 features
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
|
||||
|
||||
# Turn on GNU-specific warnings:
|
||||
# -Wall - turn on a lot of warnings
|
||||
# -pedantic - this is turned on below
|
||||
# -Wpointer-arith - enabled with -pedantic, but good to have even if not
|
||||
# -Woverloaded-virtual - ???
|
||||
# -Werror=return-type - catches missing returns, zero false positives
|
||||
# -Wtype-limits - catches overflow bugs, few false positives
|
||||
# -Wempty-body - catches bugs, e.g. "if (c); foo();", 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, type-limits, ac_cxx_has_wtype_limits)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
|
||||
|
||||
# Turn off the following warnings that -Wall/-pedantic turn on:
|
||||
# -Wno-ctor-dtor-privacy - ???
|
||||
# -Wno-overlength-strings - we exceed the minimum maximum length frequently
|
||||
# -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
|
||||
# -Wno-variadic-macros - ???
|
||||
#
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
|
||||
|
||||
if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
|
||||
# Don't use -Wcast-align with ICC or clang
|
||||
case "$CPU_ARCH" in
|
||||
|
@ -1789,81 +1822,7 @@ if test "$GNU_CXX"; then
|
|||
# deleted function syntax.
|
||||
if test "$CLANG_CXX"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-extended-offsetof,
|
||||
ac_has_wno_extended_offsetof,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-extended-offsetof"
|
||||
AC_TRY_COMPILE([$configure_static_assert_macros
|
||||
#ifndef __has_warning
|
||||
#define __has_warning(x) 0
|
||||
#endif],
|
||||
[CONFIGURE_STATIC_ASSERT(__has_warning("-Wextended-offsetof"))],
|
||||
ac_has_wno_extended_offsetof="yes",
|
||||
ac_has_wno_extended_offsetof="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_extended_offsetof" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-extended-offsetof"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
|
||||
ac_has_wno_invalid_offsetof,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_wno_invalid_offsetof="yes",
|
||||
ac_has_wno_invalid_offsetof="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_invalid_offsetof" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
|
||||
ac_has_wno_variadic_macros,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-variadic-macros"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_wno_variadic_macros="yes",
|
||||
ac_has_wno_variadic_macros="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_variadic_macros" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-variadic-macros"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
|
||||
ac_has_werror_return_type,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror=return-type"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_werror_return_type="yes",
|
||||
ac_has_werror_return_type="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_werror_return_type" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
|
||||
fi
|
||||
|
||||
else
|
||||
|
|
|
@ -671,7 +671,7 @@ nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
|
|||
return aProgress;
|
||||
|
||||
PRUint32 i = 0;
|
||||
for (; i < numTimes - 2 && aProgress >= mKeyTimes[i+1]; ++i);
|
||||
for (; i < numTimes - 2 && aProgress >= mKeyTimes[i+1]; ++i) { }
|
||||
|
||||
if (aCalcMode == CALC_DISCRETE) {
|
||||
// discrete calcMode behaviour differs in that each keyTime defines the time
|
||||
|
|
|
@ -1767,7 +1767,7 @@ nsSMILTimedElement::GetNextGreater(const InstanceTimeList& aList,
|
|||
{
|
||||
nsSMILInstanceTime* result = nsnull;
|
||||
while ((result = GetNextGreaterOrEqual(aList, aBase, aPosition)) &&
|
||||
result->Time() == aBase);
|
||||
result->Time() == aBase) { }
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,8 +102,7 @@ protected:
|
|||
|
||||
const txExpandedName key()
|
||||
{
|
||||
NS_ASSERTION(mCurrentPos >= 0 &&
|
||||
mCurrentPos < mMap.mItems.Length(),
|
||||
NS_ASSERTION(mCurrentPos < mMap.mItems.Length(),
|
||||
"invalid position in txExpandedNameMap::iterator");
|
||||
return txExpandedName(mMap.mItems[mCurrentPos].mNamespaceID,
|
||||
mMap.mItems[mCurrentPos].mLocalName);
|
||||
|
@ -112,8 +111,7 @@ protected:
|
|||
protected:
|
||||
void* itemValue()
|
||||
{
|
||||
NS_ASSERTION(mCurrentPos >= 0 &&
|
||||
mCurrentPos < mMap.mItems.Length(),
|
||||
NS_ASSERTION(mCurrentPos < mMap.mItems.Length(),
|
||||
"invalid position in txExpandedNameMap::iterator");
|
||||
return mMap.mItems[mCurrentPos].mValue;
|
||||
}
|
||||
|
|
|
@ -2336,19 +2336,19 @@ public:
|
|||
}
|
||||
|
||||
bool CharIsSpace(PRUint32 aPos) {
|
||||
NS_ASSERTION(0 <= aPos && aPos < mCharacterCount, "aPos out of range");
|
||||
NS_ASSERTION(aPos < mCharacterCount, "aPos out of range");
|
||||
return mCharacterGlyphs[aPos].CharIsSpace();
|
||||
}
|
||||
bool CharIsTab(PRUint32 aPos) {
|
||||
NS_ASSERTION(0 <= aPos && aPos < mCharacterCount, "aPos out of range");
|
||||
NS_ASSERTION(aPos < mCharacterCount, "aPos out of range");
|
||||
return mCharacterGlyphs[aPos].CharIsTab();
|
||||
}
|
||||
bool CharIsNewline(PRUint32 aPos) {
|
||||
NS_ASSERTION(0 <= aPos && aPos < mCharacterCount, "aPos out of range");
|
||||
NS_ASSERTION(aPos < mCharacterCount, "aPos out of range");
|
||||
return mCharacterGlyphs[aPos].CharIsNewline();
|
||||
}
|
||||
bool CharIsLowSurrogate(PRUint32 aPos) {
|
||||
NS_ASSERTION(0 <= aPos && aPos < mCharacterCount, "aPos out of range");
|
||||
NS_ASSERTION(aPos < mCharacterCount, "aPos out of range");
|
||||
return mCharacterGlyphs[aPos].CharIsLowSurrogate();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
diff --git a/gfx/ycbcr/yuv_convert.cpp b/gfx/ycbcr/yuv_convert.cpp
|
||||
--- a/gfx/ycbcr/yuv_convert.cpp
|
||||
+++ b/gfx/ycbcr/yuv_convert.cpp
|
||||
@@ -337,16 +337,17 @@ NS_GFX_(void) ScaleYCbCrToRGB32(const ui
|
||||
source_dx_uv >> kFractionBits);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ScaleYUVToRGB32Row_C(y_ptr, u_ptr, v_ptr,
|
||||
dest_pixel, width, source_dx);
|
||||
}
|
||||
#else
|
||||
+ (void)source_dx_uv;
|
||||
ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
|
||||
dest_pixel, width, source_dx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// MMX used for FastConvertYUVToRGB32Row and FilterRows requires emms.
|
||||
if (has_mmx)
|
||||
EMMS();
|
||||
diff --git a/gfx/ycbcr/yuv_row.h b/gfx/ycbcr/yuv_row.h
|
||||
--- a/gfx/ycbcr/yuv_row.h
|
||||
+++ b/gfx/ycbcr/yuv_row.h
|
||||
@@ -129,14 +129,14 @@ extern SIMD_ALIGNED(int16 kCoefficientsR
|
||||
#if defined(ARCH_CPU_X86) && !defined(ARCH_CPU_X86_64)
|
||||
#if defined(_MSC_VER)
|
||||
#define EMMS() __asm emms
|
||||
#pragma warning(disable: 4799)
|
||||
#else
|
||||
#define EMMS() asm("emms")
|
||||
#endif
|
||||
#else
|
||||
-#define EMMS()
|
||||
+#define EMMS() ((void)0)
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // MEDIA_BASE_YUV_ROW_H_
|
|
@ -25,3 +25,5 @@ convert.patch contains the following changes:
|
|||
win64.patch: SSE2 optimization for Microsoft Visual C++ x64 version
|
||||
|
||||
TypeFromSize.patch: Bug 656185 - Add a method to detect YUVType from plane sizes.
|
||||
|
||||
QuellGccWarnings.patch: Bug 711895 - Avoid some GCC compilation warnings.
|
||||
|
|
|
@ -9,3 +9,4 @@ cp $1/media/base/yuv_row_posix.cc yuv_row_c.cpp
|
|||
patch -p3 <convert.patch
|
||||
patch -p3 <win64.patch
|
||||
patch -p3 <TypeFromSize.patch
|
||||
patch -p3 <QuellGccWarnings.patch
|
||||
|
|
|
@ -342,6 +342,7 @@ NS_GFX_(void) ScaleYCbCrToRGB32(const uint8* y_buf,
|
|||
dest_pixel, width, source_dx);
|
||||
}
|
||||
#else
|
||||
(void)source_dx_uv;
|
||||
ScaleYUVToRGB32Row(y_ptr, u_ptr, v_ptr,
|
||||
dest_pixel, width, source_dx);
|
||||
#endif
|
||||
|
|
|
@ -134,7 +134,7 @@ extern SIMD_ALIGNED(int16 kCoefficientsRgbY[768][4]);
|
|||
#define EMMS() asm("emms")
|
||||
#endif
|
||||
#else
|
||||
#define EMMS()
|
||||
#define EMMS() ((void)0)
|
||||
#endif
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -379,10 +379,6 @@ jsd_GetErrorReporter(JSDContext* jsdc,
|
|||
JSD_ErrorReporter* reporter,
|
||||
void** callerdata);
|
||||
|
||||
static JSBool
|
||||
jsd_DebugErrorHook(JSContext *cx, const char *message,
|
||||
JSErrorReport *report, void *closure);
|
||||
|
||||
/***************************************************************************/
|
||||
/* Script functions */
|
||||
|
||||
|
|
|
@ -276,6 +276,10 @@ jsd_DebuggerPause(JSDContext* jsdc, JSBool forceAllHooksOff)
|
|||
JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
jsd_DebugErrorHook(JSContext *cx, const char *message,
|
||||
JSErrorReport *report, void *closure);
|
||||
|
||||
void
|
||||
jsd_DebuggerUnpause(JSDContext* jsdc)
|
||||
{
|
||||
|
|
|
@ -82,3 +82,49 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
|
|||
fi
|
||||
|
||||
])
|
||||
|
||||
dnl GCC and clang will fail if given an unknown warning option like -Wfoobar.
|
||||
dnl But later versions won't fail if given an unknown negated warning option
|
||||
dnl like -Wno-foobar. So when we are check for support of negated warning
|
||||
dnl options, we actually test the positive form, but add the negated form to
|
||||
dnl the flags variable.
|
||||
|
||||
AC_DEFUN([MOZ_C_SUPPORTS_WARNING],
|
||||
[
|
||||
AC_CACHE_CHECK(whether the C compiler supports $1$2, $3,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
_SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -W$2"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
$3="yes",
|
||||
$3="no")
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "${$3}" = "yes"; then
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} $1$2"
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MOZ_CXX_SUPPORTS_WARNING],
|
||||
[
|
||||
AC_CACHE_CHECK(whether the C++ compiler supports $1$2, $3,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror -W$2"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
$3="yes",
|
||||
$3="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "${$3}" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} $1$2"
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -1627,14 +1627,27 @@ if test "$GNU_CC"; then
|
|||
_MOZ_RTTI_FLAGS_ON=-frtti
|
||||
_MOZ_RTTI_FLAGS_OFF=-fno-rtti
|
||||
|
||||
# Turn on GNU specific features
|
||||
# -Wall - turn on all warnings
|
||||
# -pedantic - make compiler warn about non-ANSI stuff, and
|
||||
# be a little bit stricter
|
||||
# Warnings slamm took out for now (these were giving more noise than help):
|
||||
# -Wbad-function-cast - warns when casting a function to a new return type
|
||||
# -Wshadow - removed because it generates more noise than help --pete
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
|
||||
# Turn on GNU-specific warnings:
|
||||
# -Wall - turn on a lot of warnings
|
||||
# -pedantic - this is turned on below
|
||||
# -Wpointer-arith - enabled with -pedantic, but good to have even if not
|
||||
# -Wdeclaration-after-statement - MSVC doesn't like these
|
||||
# -Werror=return-type - catches missing returns, zero false positives
|
||||
# -Wtype-limits - catches overflow bugs, few false positives
|
||||
# -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
|
||||
#
|
||||
_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, type-limits, ac_c_has_wtype_limits)
|
||||
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
|
||||
|
||||
# Turn off the following warnings that -Wall/-pedantic turn on:
|
||||
# -Wno-unused - lots of violations in third-party code
|
||||
# -Wno-overlength-strings - we exceed the minimum maximum length frequently
|
||||
#
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
|
||||
MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
|
||||
|
||||
if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
|
||||
# Don't use -Wcast-align with ICC or clang
|
||||
case "$CPU_ARCH" in
|
||||
|
@ -1650,12 +1663,9 @@ if test "$GNU_CC"; then
|
|||
dnl Turn pedantic on but disable the warnings for long long
|
||||
_PEDANTIC=1
|
||||
|
||||
if test -z "$INTEL_CC"; then
|
||||
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
|
||||
fi
|
||||
|
||||
_DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
|
||||
_USE_CPP_INCLUDE_FLAG=1
|
||||
|
||||
elif test "$SOLARIS_SUNPRO_CC"; then
|
||||
DSO_CFLAGS=''
|
||||
if test "$CPU_ARCH" = "sparc"; then
|
||||
|
@ -1681,8 +1691,31 @@ else
|
|||
fi
|
||||
|
||||
if test "$GNU_CXX"; then
|
||||
# Turn on GNU specific features
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
|
||||
# Turn on GNU-specific warnings:
|
||||
# -Wall - turn on a lot of warnings
|
||||
# -pedantic - this is turned on below
|
||||
# -Wpointer-arith - enabled with -pedantic, but good to have even if not
|
||||
# -Woverloaded-virtual - ???
|
||||
# -Werror=return-type - catches missing returns, zero false positives
|
||||
# -Wtype-limits - catches overflow bugs, few false positives
|
||||
# -Wempty-body - catches bugs, e.g. "if (c); foo();", 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, type-limits, ac_cxx_has_wtype_limits)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
|
||||
|
||||
# Turn off the following warnings that -Wall/-pedantic turn on:
|
||||
# -Wno-ctor-dtor-privacy - ???
|
||||
# -Wno-overlength-strings - we exceed the minimum maximum length frequently
|
||||
# -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
|
||||
# -Wno-variadic-macros - ???
|
||||
#
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
|
||||
|
||||
if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
|
||||
# Don't use -Wcast-align with ICC or clang
|
||||
case "$CPU_ARCH" in
|
||||
|
@ -1706,81 +1739,7 @@ if test "$GNU_CXX"; then
|
|||
# deleted function syntax.
|
||||
if test "$CLANG_CXX"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-extended-offsetof,
|
||||
ac_has_wno_extended_offsetof,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-extended-offsetof"
|
||||
AC_TRY_COMPILE([$configure_static_assert_macros
|
||||
#ifndef __has_warning
|
||||
#define __has_warning(x) 0
|
||||
#endif],
|
||||
[CONFIGURE_STATIC_ASSERT(__has_warning("-Wextended-offsetof"))],
|
||||
ac_has_wno_extended_offsetof="yes",
|
||||
ac_has_wno_extended_offsetof="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_extended_offsetof" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-extended-offsetof"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
|
||||
ac_has_wno_invalid_offsetof,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_wno_invalid_offsetof="yes",
|
||||
ac_has_wno_invalid_offsetof="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_invalid_offsetof" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
|
||||
ac_has_wno_variadic_macros,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Wno-variadic-macros"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_wno_variadic_macros="yes",
|
||||
ac_has_wno_variadic_macros="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_wno_variadic_macros" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-variadic-macros"
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
|
||||
ac_has_werror_return_type,
|
||||
[
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
_SAVE_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS -Werror=return-type"
|
||||
AC_TRY_COMPILE([],
|
||||
[return(0);],
|
||||
ac_has_werror_return_type="yes",
|
||||
ac_has_werror_return_type="no")
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
if test "$ac_has_werror_return_type" = "yes"; then
|
||||
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
|
||||
MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
|
||||
fi
|
||||
|
||||
else
|
||||
|
|
|
@ -404,11 +404,24 @@ DoGetElement(JSContext *cx, JSObject *obj, uint32_t index, JSBool *hole, Value *
|
|||
return true;
|
||||
}
|
||||
|
||||
template<typename IndexType>
|
||||
static void
|
||||
AssertGreaterThanZero(IndexType index)
|
||||
{
|
||||
JS_ASSERT(index >= 0);
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
AssertGreaterThanZero(uint32_t index)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename IndexType>
|
||||
static JSBool
|
||||
GetElement(JSContext *cx, JSObject *obj, IndexType index, JSBool *hole, Value *vp)
|
||||
{
|
||||
JS_ASSERT(index >= 0);
|
||||
AssertGreaterThanZero(index);
|
||||
if (obj->isDenseArray() && index < obj->getDenseArrayInitializedLength() &&
|
||||
!(*vp = obj->getDenseArrayElement(uint32_t(index))).isMagic(JS_ARRAY_HOLE)) {
|
||||
*hole = JS_FALSE;
|
||||
|
|
|
@ -1367,7 +1367,7 @@ void
|
|||
JSCompartment::reduceGCTriggerBytes(size_t amount)
|
||||
{
|
||||
JS_ASSERT(amount > 0);
|
||||
JS_ASSERT(gcTriggerBytes - amount >= 0);
|
||||
JS_ASSERT(gcTriggerBytes >= amount);
|
||||
if (gcTriggerBytes - amount < GC_ALLOCATION_THRESHOLD * GC_HEAP_GROWTH_FACTOR)
|
||||
return;
|
||||
gcTriggerBytes -= amount;
|
||||
|
|
|
@ -1775,9 +1775,7 @@ class TypedArrayTemplate
|
|||
{
|
||||
JS_ASSERT(tarray);
|
||||
|
||||
JS_ASSERT(0 <= begin);
|
||||
JS_ASSERT(begin <= getLength(tarray));
|
||||
JS_ASSERT(0 <= end);
|
||||
JS_ASSERT(end <= getLength(tarray));
|
||||
|
||||
JSObject *bufobj = getBuffer(tarray);
|
||||
|
|
|
@ -71,11 +71,11 @@ private:
|
|||
nsRect mRects[2];
|
||||
public:
|
||||
nsRect& Overflow(size_t aIndex) {
|
||||
NS_ASSERTION(0 <= aIndex && aIndex < 2, "index out of range");
|
||||
NS_ASSERTION(aIndex < 2, "index out of range");
|
||||
return mRects[aIndex];
|
||||
}
|
||||
const nsRect& Overflow(size_t aIndex) const {
|
||||
NS_ASSERTION(0 <= aIndex && aIndex < 2, "index out of range");
|
||||
NS_ASSERTION(aIndex < 2, "index out of range");
|
||||
return mRects[aIndex];
|
||||
}
|
||||
|
||||
|
|
|
@ -1925,6 +1925,7 @@ static unsigned int plt_reloc(soinfo *si, unsigned int num)
|
|||
return *(unsigned int *)(si->base + si->plt_rela[num].r_offset);
|
||||
}
|
||||
#endif
|
||||
return 0; // NOT REACHED
|
||||
}
|
||||
|
||||
/* As this function is only referenced from assembly, we need to tell the
|
||||
|
|
Загрузка…
Ссылка в новой задаче