Bug 1232772 - suppress numerous clang-style warnings when using clang-cl; r=glandium

Suppressing these warnings significantly cuts down the warning spam on
clang-cl builds.
This commit is contained in:
Nathan Froyd 2015-12-15 15:35:27 -05:00
parent 1f91507e4e
commit 02985b10d7
2 changed files with 106 additions and 0 deletions

View File

@ -2245,8 +2245,61 @@ ia64*-hpux*)
CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4800 -wd4819"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.
#
# Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
# We use offsetof on non-POD objects all the time.
# We also suppress this warning on other platforms.
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
# MFBT thinks clang-cl supports constexpr, which it does, but
# not everything in Windows C++ headers supports constexpr
# as we might expect until MSVC 2015, so turn off this warning
# for now.
CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
# This warns for reasonable things like:
# enum { X = 0xffffffffU };
# which is annoying for IDL headers.
CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
# This warns for cases that would be reached by the Microsoft
# #include rules, but also currently warns on cases that would
# *also* be reached by standard C++ include rules. That
# behavior doesn't seem useful, so we turn it off.
CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
# We normally error out on unknown pragmas, but since clang-cl
# claims to be MSVC, it would be difficult to add
# #if defined(_MSC_VER) && !defined(__clang__) everywhere we
# use such pragmas, so just ignore them.
CFLAGS="$CFLAGS -Wno-unknown-pragmas"
CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
# clang-cl's Intrin.h marks things like _ReadWriteBarrier
# as __attribute((__deprecated__)). This is nice to know,
# but since we don't get the equivalent warning from MSVC,
# let's just ignore it.
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
# We use a function like:
# __declspec(noreturn) __inline void f() {}
# which -Winvalid-noreturn complains about. Again, MSVC seems
# OK with it, so let's silence the warning.
CFLAGS="$CFLAGS -Wno-invalid-noreturn"
CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
# Missing |override| on virtual function declarations isn't
# something that MSVC currently warns about.
CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
# We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
# declaration on |operator delete(void*)|. However, clang-cl
# must internally declare |operator delete(void*)| differently,
# which causes this warning for virtually every file in the
# tree. clang-cl doesn't support -fno-exceptions or equivalent,
# so there doesn't seem to be any way to convince clang-cl to
# declare |delete| differently. Therefore, suppress this
# warning.
CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
# At least one MSVC header and several headers in-tree have
# unused typedefs, so turn this on.
CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
fi
# make 'foo == bar;' error out
CFLAGS="$CFLAGS -we4553"

View File

@ -1764,8 +1764,61 @@ ia64*-hpux*)
CFLAGS="$CFLAGS -wd4244 -wd4267"
CXXFLAGS="$CXXFLAGS -wd4244 -wd4267 -wd4251"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.
#
# Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
# We use offsetof on non-POD objects all the time.
# We also suppress this warning on other platforms.
CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
# MFBT thinks clang-cl supports constexpr, which it does, but
# not everything in Windows C++ headers supports constexpr
# as we might expect until MSVC 2015, so turn off this warning
# for now.
CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
# This warns for reasonable things like:
# enum { X = 0xffffffffU };
# which is annoying for IDL headers.
CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
# This warns for cases that would be reached by the Microsoft
# #include rules, but also currently warns on cases that would
# *also* be reached by standard C++ include rules. That
# behavior doesn't seem useful, so we turn it off.
CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
# We normally error out on unknown pragmas, but since clang-cl
# claims to be MSVC, it would be difficult to add
# #if defined(_MSC_VER) && !defined(__clang__) everywhere we
# use such pragmas, so just ignore them.
CFLAGS="$CFLAGS -Wno-unknown-pragmas"
CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
# clang-cl's Intrin.h marks things like _ReadWriteBarrier
# as __attribute((__deprecated__)). This is nice to know,
# but since we don't get the equivalent warning from MSVC,
# let's just ignore it.
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
# We use a function like:
# __declspec(noreturn) __inline void f() {}
# which -Winvalid-noreturn complains about. Again, MSVC seems
# OK with it, so let's silence the warning.
CFLAGS="$CFLAGS -Wno-invalid-noreturn"
CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
# Missing |override| on virtual function declarations isn't
# something that MSVC currently warns about.
CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
# We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
# declaration on |operator delete(void*)|. However, clang-cl
# must internally declare |operator delete(void*)| differently,
# which causes this warning for virtually every file in the
# tree. clang-cl doesn't support -fno-exceptions or equivalent,
# so there doesn't seem to be any way to convince clang-cl to
# declare |delete| differently. Therefore, suppress this
# warning.
CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
# At least one MSVC header and several headers in-tree have
# unused typedefs, so turn this on.
CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
fi
# make 'foo == bar;' error out
CFLAGS="$CFLAGS -we4553"