[msvc] Ignore some warnings on msvc
Port a partial revert of https://crrev.com/c/3189512. The comments are kept around to document what each flag does. Fixed: chromium:1255096 Change-Id: I8758a536a6f77826b0eb4918d7d8c85b772d9394 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3203004 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Zhi An Ng <zhin@chromium.org> Cr-Commit-Position: refs/heads/main@{#77227}
This commit is contained in:
parent
f80eed4729
commit
a735b400c4
139
BUILD.gn
139
BUILD.gn
@ -1254,7 +1254,144 @@ config("toolchain") {
|
||||
}
|
||||
|
||||
if (!is_clang && is_win) {
|
||||
cflags += [ "/wd4506" ] # Benign "no definition for inline function"
|
||||
cflags += [
|
||||
"/wd4506", # Benign "no definition for inline function"
|
||||
|
||||
# Warnings permanently disabled:
|
||||
|
||||
# C4091: 'typedef ': ignored on left of 'X' when no variable is
|
||||
# declared.
|
||||
# This happens in a number of Windows headers. Dumb.
|
||||
"/wd4091",
|
||||
|
||||
# C4127: conditional expression is constant
|
||||
# This warning can in theory catch dead code and other problems, but
|
||||
# triggers in far too many desirable cases where the conditional
|
||||
# expression is either set by macros or corresponds some legitimate
|
||||
# compile-time constant expression (due to constant template args,
|
||||
# conditionals comparing the sizes of different types, etc.). Some of
|
||||
# these can be worked around, but it's not worth it.
|
||||
"/wd4127",
|
||||
|
||||
# C4251: 'identifier' : class 'type' needs to have dll-interface to be
|
||||
# used by clients of class 'type2'
|
||||
# This is necessary for the shared library build.
|
||||
"/wd4251",
|
||||
|
||||
# C4275: non dll-interface class used as base for dll-interface class
|
||||
# This points out a potential (but rare) problem with referencing static
|
||||
# fields of a non-exported base, through the base's non-exported inline
|
||||
# functions, or directly. The warning is subtle enough that people just
|
||||
# suppressed it when they saw it, so it's not worth it.
|
||||
"/wd4275",
|
||||
|
||||
# C4312 is a VS 2015 64-bit warning for integer to larger pointer.
|
||||
# TODO(brucedawson): fix warnings, crbug.com/554200
|
||||
"/wd4312",
|
||||
|
||||
# C4324 warns when padding is added to fulfill alignas requirements,
|
||||
# but can trigger in benign cases that are difficult to individually
|
||||
# suppress.
|
||||
"/wd4324",
|
||||
|
||||
# C4351: new behavior: elements of array 'array' will be default
|
||||
# initialized
|
||||
# This is a silly "warning" that basically just alerts you that the
|
||||
# compiler is going to actually follow the language spec like it's
|
||||
# supposed to, instead of not following it like old buggy versions did.
|
||||
# There's absolutely no reason to turn this on.
|
||||
"/wd4351",
|
||||
|
||||
# C4355: 'this': used in base member initializer list
|
||||
# It's commonly useful to pass |this| to objects in a class' initializer
|
||||
# list. While this warning can catch real bugs, most of the time the
|
||||
# constructors in question don't attempt to call methods on the passed-in
|
||||
# pointer (until later), and annotating every legit usage of this is
|
||||
# simply more hassle than the warning is worth.
|
||||
"/wd4355",
|
||||
|
||||
# C4503: 'identifier': decorated name length exceeded, name was
|
||||
# truncated
|
||||
# This only means that some long error messages might have truncated
|
||||
# identifiers in the presence of lots of templates. It has no effect on
|
||||
# program correctness and there's no real reason to waste time trying to
|
||||
# prevent it.
|
||||
"/wd4503",
|
||||
|
||||
# Warning C4589 says: "Constructor of abstract class ignores
|
||||
# initializer for virtual base class." Disable this warning because it
|
||||
# is flaky in VS 2015 RTM. It triggers on compiler generated
|
||||
# copy-constructors in some cases.
|
||||
"/wd4589",
|
||||
|
||||
# C4611: interaction between 'function' and C++ object destruction is
|
||||
# non-portable
|
||||
# This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
|
||||
# suggests using exceptions instead of setjmp/longjmp for C++, but
|
||||
# Chromium code compiles without exception support. We therefore have to
|
||||
# use setjmp/longjmp for e.g. JPEG decode error handling, which means we
|
||||
# have to turn off this warning (and be careful about how object
|
||||
# destruction happens in such cases).
|
||||
"/wd4611",
|
||||
|
||||
# Warnings to evaluate and possibly fix/reenable later:
|
||||
|
||||
"/wd4100", # Unreferenced formal function parameter.
|
||||
"/wd4121", # Alignment of a member was sensitive to packing.
|
||||
"/wd4244", # Conversion: possible loss of data.
|
||||
"/wd4505", # Unreferenced local function has been removed.
|
||||
"/wd4510", # Default constructor could not be generated.
|
||||
"/wd4512", # Assignment operator could not be generated.
|
||||
"/wd4610", # Class can never be instantiated, constructor required.
|
||||
"/wd4838", # Narrowing conversion. Doesn't seem to be very useful.
|
||||
"/wd4995", # 'X': name was marked as #pragma deprecated
|
||||
"/wd4996", # Deprecated function warning.
|
||||
|
||||
# These are variable shadowing warnings that are new in VS2015. We
|
||||
# should work through these at some point -- they may be removed from
|
||||
# the RTM release in the /W4 set.
|
||||
"/wd4456",
|
||||
"/wd4457",
|
||||
"/wd4458",
|
||||
"/wd4459",
|
||||
|
||||
# All of our compilers support the extensions below.
|
||||
"/wd4200", # nonstandard extension used: zero-sized array in struct/union
|
||||
"/wd4201", # nonstandard extension used: nameless struct/union
|
||||
"/wd4204", # nonstandard extension used : non-constant aggregate
|
||||
# initializer
|
||||
|
||||
"/wd4221", # nonstandard extension used : 'identifier' : cannot be
|
||||
# initialized using address of automatic variable
|
||||
|
||||
# http://crbug.com/588506 - Conversion suppressions waiting on Clang
|
||||
# -Wconversion.
|
||||
"/wd4245", # 'conversion' : conversion from 'type1' to 'type2',
|
||||
# signed/unsigned mismatch
|
||||
|
||||
"/wd4267", # 'var' : conversion from 'size_t' to 'type', possible loss of
|
||||
# data
|
||||
|
||||
"/wd4305", # 'identifier' : truncation from 'type1' to 'type2'
|
||||
"/wd4389", # 'operator' : signed/unsigned mismatch
|
||||
|
||||
"/wd4702", # unreachable code
|
||||
|
||||
# http://crbug.com/848979 - MSVC is more conservative than Clang with
|
||||
# regards to variables initialized and consumed in different branches.
|
||||
"/wd4701", # Potentially uninitialized local variable 'name' used
|
||||
"/wd4703", # Potentially uninitialized local pointer variable 'name' used
|
||||
|
||||
# http://crbug.com/848979 - Remaining Clang permitted warnings.
|
||||
"/wd4661", # 'identifier' : no suitable definition provided for explicit
|
||||
# template instantiation request
|
||||
|
||||
"/wd4706", # assignment within conditional expression
|
||||
# MSVC is stricter and requires a boolean expression.
|
||||
|
||||
"/wd4715", # 'function' : not all control paths return a value'
|
||||
# MSVC does not analyze switch (enum) for completeness.
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_clang && !is_win) {
|
||||
|
Loading…
Reference in New Issue
Block a user