Commit 5a3c1f06 authored by pkasting@chromium.org's avatar pkasting@chromium.org

Re-enable various MSVC warnings.

BUG=81439
TEST=none

Review URL: https://codereview.chromium.org/415773009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285730 0039d316-1c4b-4281-b951-d872f2087c98
parent 13a2b92f
......@@ -287,6 +287,13 @@ static void TestCalloc(size_t n, size_t s, bool ok) {
}
}
// MSVC C4530 complains about exception handler usage when exceptions are
// disabled. Temporarily disable that warning so we can test that they are, in
// fact, disabled.
#if defined(OS_WIN)
#pragma warning(push)
#pragma warning(disable: 4530)
#endif
// A global test counter for number of times the NewHandler is called.
static int news_handled = 0;
......@@ -331,6 +338,10 @@ static void TestNothrowNew(void* (*func)(size_t)) {
std::set_new_handler(saved_handler);
}
#if defined(OS_WIN)
#pragma warning(pop)
#endif
} // namespace
//-----------------------------------------------------------------------------
......
......@@ -5251,11 +5251,60 @@
],
'msvs_cygwin_shell': 0,
'msvs_disabled_warnings': [
4351, 4355, 4396, 4503, 4819,
# 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.
4127,
# 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.
4351,
# 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.
4355,
# 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.
4503,
# 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).
4611,
# TODO(maruel): These warnings are level 4. They will be slowly
# removed as code is fixed.
4100, 4121, 4125, 4127, 4130, 4131, 4189, 4201, 4238, 4244, 4245,
4310, 4428, 4481, 4505, 4510, 4512, 4530, 4610, 4611, 4701, 4706,
4100, # Unreferenced formal parameter
4121, # Alignment of a member was sensitive to packing
4189, # Local variable is initialized but not referenced
4244, # Conversion from 'type1' to 'type2', possible loss of data
4481, # Nonstandard extension used: override specifier 'keyword'
4505, # Unreferenced local function has been removed
4510, # Default constructor could not be generated
4512, # Assignment operator could not be generated
4610, # Object can never be instantiated
],
'msvs_settings': {
'VCCLCompilerTool': {
......
......@@ -563,38 +563,70 @@ config("no_rtti") {
config("default_warnings") {
if (is_win) {
# Please keep ordered and add names if you add more.
cflags = [
"/WX", # Treat warnings as errors.
"/wd4018", # Comparing signed and unsigned values.
# Warnings permanently disabled:
# 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",
# 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",
# 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.
"/wd4125", # Decimal digit terminates octal escape sequence.
"/wd4127", # Conditional expression is constant.
"/wd4130", # Logical operation on address of string constant.
"/wd4189", # A variable was declared and initialized but never used.
"/wd4201", # Nonstandard extension used: nameless struct/union.
"/wd4238", # Nonstandard extension used: class rvalue used as lvalue.
"/wd4244", # Conversion: possible loss of data.
"/wd4245", # Conversion: signed/unsigned mismatch,
"/wd4251", # Class needs to have dll-interface.
"/wd4310", # Cast truncates constant value.
"/wd4351", # Elements of array will be default initialized.
"/wd4355", # 'this' used in base member initializer list.
"/wd4396", # Inline friend template thing.
"/wd4428", # Universal character name encountered in source.
"/wd4481", # Nonstandard extension: override specifier.
"/wd4503", # Decorated name length exceeded, name was truncated.
"/wd4505", # Unreferenced local function has been removed.
"/wd4510", # Default constructor could not be generated.
"/wd4512", # Assignment operator could not be generated.
"/wd4530", # Exception handler used, but unwind semantics not enabled.
"/wd4610", # Class can never be instantiated, constructor required.
"/wd4611", # C++ object destruction and 'catch'.
"/wd4701", # Potentially uninitialized local variable name used.
"/wd4702", # Unreachable code.
"/wd4706", # Assignment within conditional expression.
"/wd4819", # Character not in the current code page.
]
} else {
# Common GCC warning setup.
......
......@@ -590,13 +590,11 @@ PP_FileHandle CreateTemporaryFile(PP_Instance instance) {
}
int32_t GetNumberOfProcessors() {
int32_t num_processors;
IPC::Sender* sender = content::RenderThread::Get();
DCHECK(sender);
if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) {
return 1;
}
return num_processors;
int32_t num_processors = 1;
return sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors)) ?
num_processors : 1;
}
PP_Bool PPIsNonSFIModeEnabled() {
......@@ -787,15 +785,13 @@ void InstanceDestroyed(PP_Instance instance) {
PP_Bool NaClDebugEnabledForURL(const char* alleged_nmf_url) {
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableNaClDebug))
return PP_FALSE;
bool should_debug;
IPC::Sender* sender = content::RenderThread::Get();
DCHECK(sender);
if(!sender->Send(new NaClHostMsg_NaClDebugEnabledForURL(
GURL(alleged_nmf_url),
&should_debug))) {
return PP_FALSE;
}
return PP_FromBool(should_debug);
bool should_debug = false;
return PP_FromBool(
sender->Send(new NaClHostMsg_NaClDebugEnabledForURL(GURL(alleged_nmf_url),
&should_debug)) &&
should_debug);
}
void LogToConsole(PP_Instance instance, const char* message) {
......
......@@ -130,7 +130,7 @@ BluetoothServiceRecordWin::BluetoothServiceRecordWin(
name_(name),
uuid_(gatt_uuid),
supports_rfcomm_(false),
rfcomm_channel_(-1) {
rfcomm_channel_(0xFF) {
// Bluetooth 2.0
if (sdp_bytes.size() > 0) {
LPBYTE blob_data = const_cast<LPBYTE>(&sdp_bytes[0]);
......
......@@ -14,10 +14,10 @@ Config::Config()
luminance_size_(0),
alpha_size_(0),
alpha_mask_size_(0),
bind_to_texture_rgb_(EGL_DONT_CARE),
bind_to_texture_rgba_(EGL_DONT_CARE),
bind_to_texture_rgb_(EGL_FALSE),
bind_to_texture_rgba_(EGL_FALSE),
color_buffer_type_(EGL_RGB_BUFFER),
config_caveat_(EGL_DONT_CARE),
config_caveat_(EGL_NONE),
config_id_(EGL_DONT_CARE),
conformant_(EGL_OPENGL_ES2_BIT),
depth_size_(0),
......@@ -27,7 +27,7 @@ Config::Config()
max_pbuffer_pixels_(0),
min_swap_interval_(EGL_DONT_CARE),
max_swap_interval_(EGL_DONT_CARE),
native_renderable_(EGL_DONT_CARE),
native_renderable_(EGL_TRUE),
native_visual_id_(0),
native_visual_type_(EGL_DONT_CARE),
renderable_type_(EGL_OPENGL_ES2_BIT),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment