Bug 195652 - [Win] Fix a slew of simple clang-cl warnings.
Summary: [Win] Fix a slew of simple clang-cl warnings.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-03-12 17:12 PDT by Ross Kirsling
Modified: 2019-03-19 19:02 PDT (History)
7 users (show)

See Also:


Attachments
Patch (31.14 KB, patch)
2019-03-12 17:38 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (2.59 MB, application/zip)
2019-03-12 18:52 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2019-03-12 17:12:20 PDT
[Win] Fix a slew of simple clang-cl warnings.
Comment 1 Ross Kirsling 2019-03-12 17:38:45 PDT
Created attachment 364483 [details]
Patch
Comment 2 Don Olmstead 2019-03-12 17:42:29 PDT
Comment on attachment 364483 [details]
Patch

r=me assuming we're green.
Comment 3 Build Bot 2019-03-12 18:52:26 PDT Comment hidden (obsolete)
Comment 4 Build Bot 2019-03-12 18:52:27 PDT Comment hidden (obsolete)
Comment 5 WebKit Commit Bot 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>
Comment 6 WebKit Commit Bot 2019-03-12 21:24:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-03-12 21:25:17 PDT
<rdar://problem/48836268>
Comment 8 Darin Adler 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.
Comment 9 Ross Kirsling 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?
Comment 10 Darin Adler 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.
Comment 11 Ross Kirsling 2019-03-19 19:02:35 PDT
Committed r243186: <https://trac.webkit.org/changeset/243186>