diff options
-rw-r--r-- | base/allocator/allocator_unittest.cc | 11 | ||||
-rw-r--r-- | build/common.gypi | 55 | ||||
-rw-r--r-- | build/config/compiler/BUILD.gn | 76 | ||||
-rw-r--r-- | components/nacl/renderer/ppb_nacl_private_impl.cc | 20 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_service_record_win.cc | 2 | ||||
-rw-r--r-- | gpu/gles2_conform_support/egl/config.cc | 8 |
6 files changed, 130 insertions, 42 deletions
diff --git a/base/allocator/allocator_unittest.cc b/base/allocator/allocator_unittest.cc index eb20b38..a39b838 100644 --- a/base/allocator/allocator_unittest.cc +++ b/base/allocator/allocator_unittest.cc @@ -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 //----------------------------------------------------------------------------- diff --git a/build/common.gypi b/build/common.gypi index dc80c4b..79b682e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -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': { diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index d2b27ec..20a8de4 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -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. diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc index 894f773..b814a9a 100644 --- a/components/nacl/renderer/ppb_nacl_private_impl.cc +++ b/components/nacl/renderer/ppb_nacl_private_impl.cc @@ -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) { diff --git a/device/bluetooth/bluetooth_service_record_win.cc b/device/bluetooth/bluetooth_service_record_win.cc index a5ecdf7..061316e 100644 --- a/device/bluetooth/bluetooth_service_record_win.cc +++ b/device/bluetooth/bluetooth_service_record_win.cc @@ -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]); diff --git a/gpu/gles2_conform_support/egl/config.cc b/gpu/gles2_conform_support/egl/config.cc index 6c914be9..d6ce307 100644 --- a/gpu/gles2_conform_support/egl/config.cc +++ b/gpu/gles2_conform_support/egl/config.cc @@ -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), |