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

Issue 12258039: enable -Wstring-conversion when compiling with clang (Closed)

Created:
7 years, 10 months ago by scottmg
Modified:
7 years, 10 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

enable -Wstring-conversion when compiling with clang Summary of try run with flag enabled as warning: On linux_clang, there's false positives from a bunch of assert usage that does !"string" or "string" for a true or false value. It's only in third_party (Mesa, skia, libjingle, etc.) so it probably wouldn't be too hard to disable the warnings in those subtrees. It diagnoses 4 useful locations: 1. ../../base/debug/trace_event_unittest.cc:70:41: warning: implicit conversion turns string literal into bool: 'const char [2]' to 'bool' [-Wstring-conversion] TraceLog::GetInstance()->SetEnabled("*"); ~~~~~~~~ ^~~ 2. ../../sync/syncable/entry_kernel.cc:77:38: warning: implicit conversion turns string literal into bool: 'const char [5]' to 'bool' [-Wstring-conversion] value->SetBoolean("encrypted", "true"); ~~~~~ ^~~~~~ 3. ../../chrome/browser/webdata/web_data_service.cc:334:17: warning: implicit conversion turns string literal into bool: 'const char [44]' to 'bool' [-Wstring-conversion] DLOG_ASSERT("WebDataService dtor called without Shutdown"); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../base/logging.h:595:43: note: expanded from macro 'DLOG_ASSERT' 4. ../../chrome/browser/renderer_host/web_cache_manager_unittest.cc:259:20: warning: implicit conversion turns string literal into bool: 'const char [29]' to 'bool' [-Wstring-conversion] EXPECT_FALSE("Unexpected entry in strategy"); ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Finding #1 is what made me look into this, #3 and #4 are not doing what they're supposed to, and #2 is kind of funny so not all is lost. So, 3 bugs and 1 very-close-to-a-bug: seems worth enabling. R=thakis@chromium.org TBR=darin@chromium.org, dhollowa@chromium.org, brettw@chromium.org, zea@chromium.org BUG=177306 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=183998

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : enable warning, fix some locations, disable for some subprojects #

Total comments: 4

Patch Set 4 : enable on mac, better fix in web_data_service #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -8 lines) Patch
M base/debug/trace_event_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M build/common.gypi View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/web_cache_manager_unittest.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/webdata/web_data_service.cc View 1 2 3 1 chunk +1 line, -2 lines 0 comments Download
M ppapi/examples/video_decode/video_decode.cc View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M skia/skia.gyp View 1 2 1 chunk +12 lines, -0 lines 0 comments Download
M sync/syncable/entry_kernel.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/libjingle/libjingle.gyp View 1 2 1 chunk +11 lines, -0 lines 0 comments Download
M third_party/mesa/mesa.gyp View 1 2 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
scottmg
7 years, 10 months ago (2013-02-21 20:25:56 UTC) #1
Nico
Add BUG=177306 to CL description. With that LGTM, but LBTM with enabling this on mac ...
7 years, 10 months ago (2013-02-21 20:36:00 UTC) #2
scottmg
https://codereview.chromium.org/12258039/diff/16001/build/common.gypi File build/common.gypi (right): https://codereview.chromium.org/12258039/diff/16001/build/common.gypi#newcode3393 build/common.gypi:3393: '-Wno-covered-switch-default', On 2013/02/21 20:36:00, Nico wrote: > Do you ...
7 years, 10 months ago (2013-02-21 20:47:57 UTC) #3
scottmg
TBR'ing a bunch of people for minor changes. Let me know if you don't like ...
7 years, 10 months ago (2013-02-22 02:33:41 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/scottmg@chromium.org/12258039/9026
7 years, 10 months ago (2013-02-22 02:34:52 UTC) #5
commit-bot: I haz the power
Change committed as 183998
7 years, 10 months ago (2013-02-22 03:37:54 UTC) #6
darin (slow to review)
7 years, 10 months ago (2013-02-23 00:32:21 UTC) #7
Message was sent while issue was closed.
LGTM

Powered by Google App Engine
This is Rietveld 408576698