Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Issue 385443002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #1 (Closed)

Created:
6 years, 5 months ago by Peter Kasting
Modified:
6 years, 5 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, darin-cc_chromium.org, extensions-reviews_chromium.org, jam, markusheintz_
Visibility:
Public.

Description

Fixes for re-enabling more MSVC level 4 warnings: misc edition #1 This contains fixes for the following sorts of issues: * Signedness mismatch The problem here is that using enums to declare bitmasks results in the enum values being signed, when all consumers want to use the values in an unsigned context. Declaring them as consts allows using the more appropriate uint32 type. In C++11 we could use "enum class" for this, but C++11 isn't legal yet. BUG=81439 TEST=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=282419

Patch Set 1 #

Patch Set 2 : Restore missing code #

Total comments: 1

Patch Set 3 : Attempt build fix #

Patch Set 4 : Another build fix #

Patch Set 5 : Build fix, take 3 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+100 lines, -132 lines) Patch
M chrome/browser/browsing_data/browsing_data_remover_unittest.cc View 18 chunks +45 lines, -82 lines 0 comments Download
M chrome/browser/extensions/data_deleter.cc View 2 chunks +2 lines, -4 lines 0 comments Download
M content/browser/storage_partition_impl.cc View 1 2 3 4 1 chunk +15 lines, -0 lines 0 comments Download
M content/browser/storage_partition_impl_map.cc View 1 chunk +1 line, -2 lines 0 comments Download
M content/browser/storage_partition_impl_unittest.cc View 1 2 3 4 4 chunks +12 lines, -19 lines 0 comments Download
M content/public/browser/storage_partition.h View 1 2 3 4 3 chunks +25 lines, -25 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Peter Kasting
https://codereview.chromium.org/385443002/diff/20001/content/browser/storage_partition_impl_unittest.cc File content/browser/storage_partition_impl_unittest.cc (right): https://codereview.chromium.org/385443002/diff/20001/content/browser/storage_partition_impl_unittest.cc#newcode61 content/browser/storage_partition_impl_unittest.cc:61: StoragePartition::REMOVE_DATA_MASK_WEBSQL; This change is just to keep the order ...
6 years, 5 months ago (2014-07-09 21:33:24 UTC) #1
Peter Kasting
The newest version of the patch is less to my liking than the original version, ...
6 years, 5 months ago (2014-07-10 01:18:47 UTC) #2
jochen (gone - plz use gerrit)
lgtm
6 years, 5 months ago (2014-07-10 11:21:30 UTC) #3
Peter Kasting
The CQ bit was checked by pkasting@chromium.org
6 years, 5 months ago (2014-07-10 18:28:15 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pkasting@chromium.org/385443002/80001
6 years, 5 months ago (2014-07-10 18:29:36 UTC) #5
commit-bot: I haz the power
Change committed as 282419
6 years, 5 months ago (2014-07-10 20:30:15 UTC) #6
viettrungluu
On 2014/07/10 01:18:47, Peter Kasting wrote: > The newest version of the patch is less ...
6 years, 5 months ago (2014-07-10 20:41:42 UTC) #7
Peter Kasting
6 years, 5 months ago (2014-07-10 20:47:47 UTC) #8
Message was sent while issue was closed.
On 2014/07/10 20:41:42, viettrungluu wrote:
> Even when declaring a static constant in the header, according to the standard
> you're required to have storage for it in a single compilation unit

Pedantic: According to Effective C++, this is only true if you actually take the
address -- for things where one never takes the address, it's legal to have no
definition.  That might have changed in C++11 though.

Not that that matters here; unittest code _does_ take the address of some of
these (by passing them to Bind(), which takes const refs) so we have to address
the problem.

> i.e., put (e.g.) |uint32_t
> Foo::MY_STATIC;| in a single .cc file. MSVC does not handle this correctly.

Yep.  When I did that, MSVC barfed with multiple symbol definition errors,
because it apparently auto-defined things in all modules that took the address. 
Boo to MSVC.

> You can use the (awful) STATIC_CONST_MEMBER_DEFINITION macro (in
> base/compiler_specific.h) to make MSVC do the right thing. Or sometimes people
> just ifdef out the out-of-class definition for MSVC.

Wow, that's awesomely helpful.  I think I'll check in a followup here that uses
that, because having these values in the header seems a lot more readable to me
and worth the cost of ugly macros in the .cc file.

Thanks!

Powered by Google App Engine
This is Rietveld 408576698