Bug 182389 - -Wreturn-type warning in DFGObjectAllocationSinkingPhase.cpp
Summary: -Wreturn-type warning in DFGObjectAllocationSinkingPhase.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-02-01 08:05 PST by Michael Catanzaro
Modified: 2018-02-01 09:29 PST (History)
9 users (show)

See Also:


Attachments
Patch (2.46 KB, patch)
2018-02-01 08:07 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>