RESOLVED FIXED 195652
[Win] Fix a slew of simple clang-cl warnings.
https://bugs.webkit.org/show_bug.cgi?id=195652
Summary [Win] Fix a slew of simple clang-cl warnings.
Ross Kirsling
Reported 2019-03-12 17:12:20 PDT
[Win] Fix a slew of simple clang-cl warnings.
Attachments
Patch (31.14 KB, patch)
2019-03-12 17:38 PDT, Ross Kirsling
no flags
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (2.59 MB, application/zip)
2019-03-12 18:52 PDT, EWS Watchlist
no flags
Ross Kirsling
Comment 1 2019-03-12 17:38:45 PDT
Don Olmstead
Comment 2 2019-03-12 17:42:29 PDT
Comment on attachment 364483 [details] Patch r=me assuming we're green.
EWS Watchlist
Comment 3 2019-03-12 18:52:26 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 4 2019-03-12 18:52:27 PDT Comment hidden (obsolete)
WebKit Commit Bot
Comment 5 2019-03-12 21:24:54 PDT
Comment on attachment 364483 [details] Patch Clearing flags on attachment: 364483 Committed r242842: <https://trac.webkit.org/changeset/242842>
WebKit Commit Bot
Comment 6 2019-03-12 21:24:55 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 7 2019-03-12 21:25:17 PDT
Darin Adler
Comment 8 2019-03-18 13:35:51 PDT
Comment on attachment 364483 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=364483&action=review > Source/WebCore/PAL/pal/win/LoggingWin.cpp:40 > + static const char* loggingEnvironmentVariable = "WebCoreLogging"; Should have been "const char* const" > Source/WebCore/platform/win/LoggingWin.cpp:40 > + static const char* loggingEnvironmentVariable = "WebCoreLogging"; Ditto. > Source/WebKit/Platform/win/LoggingWin.cpp:41 > + static const char* loggingEnvironmentVariable = "WebKitLogging"; Ditto.
Ross Kirsling
Comment 9 2019-03-19 04:00:05 PDT
(In reply to Darin Adler from comment #8) > > Source/WebCore/PAL/pal/win/LoggingWin.cpp:40 > > + static const char* loggingEnvironmentVariable = "WebCoreLogging"; > > Should have been "const char* const" It seemed to be a really strange typo(?) so I made it match what `auto` would give, but certainly that wouldn't stop one from overwriting the string. At that rate surely `constexpr auto` (or explicitly `constexpr const char*`) would be better though, no?
Darin Adler
Comment 10 2019-03-19 09:15:33 PDT
"static const char*" is a global variable that can be overwritten with a new value. The characters can’t be overwritten, but the pointer can be. "static const char* const" is a global constant that can’t be overwritten. I don’t think the patch should have removed const, that was my point. The patch changed from a constant pointer to non-constant characters (warning was about the non-constant characters pointing to read-only characters that are not safe to modify) to a *non-constant* pointer to constant characters. I don’t think making the pointer non-const was an improvement. And yes, other ways to write it. The constexpr version sounds fine.
Ross Kirsling
Comment 11 2019-03-19 19:02:35 PDT
Note You need to log in before you can comment on or make changes to this bug.