Bug 136603

Summary: Make updates suggested by new version of Xcode
Product: WebKit Reporter: Darin Adler <darin>
Component: New BugsAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, calvaris, commit-queue, dino, eric.carlson, esprehn+autocc, glenn, gyuyoung.kim, jer.noble, kondapallykalyan, mitz, mjs, mrowe, philipj, roger_fong, sergio, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Darin Adler 2014-09-06 14:38:21 PDT
Make updates suggested by new version of Xcode
Comment 1 Darin Adler 2014-09-06 15:01:11 PDT
Created attachment 237744 [details]
Patch
Comment 2 WebKit Commit Bot 2014-09-06 15:02:11 PDT
Note that there are important steps to take when updating ANGLE. See http://trac.webkit.org/wiki/UpdatingANGLE
Comment 3 Mark Rowe (bdash) 2014-09-06 15:25:18 PDT
Comment on attachment 237744 [details]
Patch

I'm not sure whether setting COMBINE_HIDPI_IMAGES = YES is compatible with our production builds. Can we leave that set to NO for projects that it wasn't already set in until we're able to determine for sure?
Comment 4 Darin Adler 2014-09-06 15:47:29 PDT
Created attachment 237746 [details]
Patch
Comment 5 Darin Adler 2014-09-06 15:53:26 PDT
Committed r173364: <http://trac.webkit.org/changeset/173364>
Comment 6 Alexey Proskuryakov 2014-09-06 23:02:54 PDT
EWS didn't approve of this patch, and it did break the build:

/Volumes/Data/EWS/WebKit/Source/WebKit/mac/Misc/WebNSDataExtras.m:120:21: error: comparison of integers of different signs: 'typeof (length)' (aka 'unsigned long') and 'typeof (1024)' (aka 'int') [-Werror,-Wsign-compare]
    int remaining = MIN(length, WEB_GUESS_MIME_TYPE_PEEK_LENGTH) - (CHANNEL_TAG_LENGTH - 1);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looks like a fix would not be mechanical.
Comment 7 Timothy Hatcher 2014-09-07 00:15:09 PDT
CLANG_WARN_UNREACHABLE_CODE is causing issues in Release builds in JSC.

/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/bytecode/CodeBlock.cpp:282:14: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp:126:24: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/dfg/DFGPlan.cpp:184:24: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:383:26: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:370:26: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:334:22: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/runtime/RegExp.cpp:276:19: error: code will never be executed [-Werror,-Wunreachable-code]
/Users/Timothy/Work/Safari-TOT.git/OpenSource/Source/JavaScriptCore/runtime/RegExp.cpp:399:19: error: code will never be executed [-Werror,-Wunreachable-code]

Seems to be mostly about RELEASE_ASSERT_NOT_REACHED().
Comment 8 Darin Adler 2014-09-07 11:14:24 PDT
(In reply to comment #6)
> Looks like a fix would not be mechanical.

We can just turn that warning off for that project.
Comment 9 Darin Adler 2014-09-07 11:14:54 PDT
(In reply to comment #7)
> CLANG_WARN_UNREACHABLE_CODE is causing issues in Release builds in JSC.

Should turn that warning off for that project.
Comment 10 Darin Adler 2014-09-07 11:17:57 PDT
(In reply to comment #6)
> EWS didn't approve of this patch, and it did break the build:

Maybe only on some versions of the compiler. Did not break the build on my system. Despite not seeing the problem locally, I am pretty sure that adding a U after 1024 would fix the bug without turning off any warnings:

#define WEB_GUESS_MIME_TYPE_PEEK_LENGTH 1024U
Comment 11 mitz 2014-09-07 11:20:29 PDT
(In reply to comment #9)
> (In reply to comment #7)
> > CLANG_WARN_UNREACHABLE_CODE is causing issues in Release builds in JSC.
> 
> Should turn that warning off for that project.

There’s also unreachable code in 32-bit builds of WTF and any other project that includes BitVector.h.
Comment 12 Alexey Proskuryakov 2014-09-07 11:27:21 PDT
> adding a U after 1024 would fix the bug without turning off any warnings

That should make MIN compile, but we'd still have an unchecked cast from the result of MIN to a signed int. While I'm not sure whether that would break the build anywhere, it's clearly wrong.
Comment 13 Darin Adler 2014-09-07 11:30:32 PDT
(In reply to comment #12)
> > adding a U after 1024 would fix the bug without turning off any warnings
> 
> That should make MIN compile, but we'd still have an unchecked cast from the result of MIN to a signed int. While I'm not sure whether that would break the build anywhere, it's clearly wrong.

I don’t know what you mean when you say it’s wrong. It’s not wrong to cast something in the range 0-1024 to an int. I can’t think of any checking that would be needed. Maybe there’s better coding style, but there’s no correctness issue.
Comment 14 Darin Adler 2014-09-07 11:31:08 PDT
(In reply to comment #11)
> There’s also unreachable code in 32-bit builds of WTF and any other project that includes BitVector.h.

To me it seems fine to turn it off until we resolve those issues.
Comment 15 Darin Adler 2014-09-07 11:33:33 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > > adding a U after 1024 would fix the bug without turning off any warnings
> > 
> > That should make MIN compile, but we'd still have an unchecked cast from the result of MIN to a signed int. While I'm not sure whether that would break the build anywhere, it's clearly wrong.
> 
> I don’t know what you mean when you say it’s wrong. It’s not wrong to cast something in the range 0-1024 to an int. I can’t think of any checking that would be needed. Maybe there’s better coding style, but there’s no correctness issue.

Oh, I see, it’s not in the range 0-1024, but I still don’t see a correctness problem. Here’s the code:

    int remaining = MIN(length, WEB_GUESS_MIME_TYPE_PEEK_LENGTH) - (CHANNEL_TAG_LENGTH - 1);

The MIN expression will be of type NSUInteger, CHANNEL_TAG_LENGTH is an int, as is 1, so we’re taking an NSUInteger in the range 0-1024, subtracting an int, and assigning to an int. I believe that is guaranteed to work. As I said, there may be a stylistic issue, but there is not a correctness issue.
Comment 16 Maciej Stachowiak 2014-09-07 17:47:47 PDT
I'm fixing the unreachable code cases on my (local, 64-bit) build. It might still be good to remove the warning in the interim.

I'm introducing COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) since it's non-clang that is arguably wrong (by warning about problems that can happen on unreachable code paths). I will file a separate bug with that change.
Comment 17 Maciej Stachowiak 2014-09-07 17:55:29 PDT
See https://bugs.webkit.org/show_bug.cgi?id=136616
Comment 18 Darin Adler 2014-09-07 18:04:43 PDT
(In reply to comment #16)
> I'm fixing the unreachable code cases on my (local, 64-bit) build. It might still be good to remove the warning in the interim.

Great!

> I'm introducing COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) since it's non-clang that is arguably wrong (by warning about problems that can happen on unreachable code paths). I will file a separate bug with that change.

I like that. I should not have used !COMPILER(CLANG).