Descriptionenable -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 #
Messages
Total messages: 7 (0 generated)
|