Bug 182389

Summary: -Wreturn-type warning in DFGObjectAllocationSinkingPhase.cpp
Product: WebKit Reporter: Michael Catanzaro <mcatanzaro>
Component: JavaScriptCoreAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ews-watchlist, keith_miller, mark.lam, mcatanzaro, msaboff, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch none

Description Michael Catanzaro 2018-02-01 08:05:15 PST
-Wreturn-type warning in DFGObjectAllocationSinkingPhase.cpp:

[1296/3695] Building CXX object Source.../unified-sources/UnifiedSource48.cpp.o
In file included from DerivedSources/JavaScriptCore/unified-sources/UnifiedSource48.cpp:2:0:
../../Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp: In member function ‘JSC::DFG::Node* JSC::DFG::{anonymous}::ObjectAllocationSinkingPhase::createRecovery(JSC::DFG::BasicBlock*, JSC::DFG::PromotedHeapLocation, JSC::DFG::Node*, bool&)’:
../../Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp:2336:5: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
Comment 1 Michael Catanzaro 2018-02-01 08:07:35 PST
Created attachment 332878 [details]
Patch
Comment 2 Michael Catanzaro 2018-02-01 08:10:25 PST
Comment on attachment 332878 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=332878&action=review

> Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp:-1535
> -            break;

I dunno why these breaks were here, but they're right after return statements, so they can never be reached.

It's unrelated to the warning; I can leave them if this is considered desirable code style.

> Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp:2329
>              DFG_CRASH(m_graph, base, "Bad location kind");
>              break;

Could get rid of this break, too.

> Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp:2332
> +        RELEASE_ASSERT_NOT_REACHED();

This is what's actually needed to silence the warning.
Comment 3 Michael Catanzaro 2018-02-01 08:11:28 PST
(In reply to Michael Catanzaro from comment #2)
> This is what's actually needed to silence the warning.

Alternative would be to move the DFG_CRASH() down out of the switch case, but I figure it's a bit more clear this way.
Comment 4 Yusuke Suzuki 2018-02-01 08:46:41 PST
Comment on attachment 332878 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2018-02-01 09:27:10 PST
Comment on attachment 332878 [details]
Patch

Clearing flags on attachment: 332878

Committed r227970: <https://trac.webkit.org/changeset/227970>
Comment 6 WebKit Commit Bot 2018-02-01 09:27:11 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2018-02-01 09:29:06 PST
<rdar://problem/37118957>