Bug 216215 - -Wreturn-type warning in BaseAudioContext.cpp
Summary: -Wreturn-type warning in BaseAudioContext.cpp
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-05 07:07 PDT by Michael Catanzaro
Modified: 2020-09-05 08:57 PDT (History)
10 users (show)

See Also:


Attachments
Patch (1.63 KB, patch)
2020-09-05 07:11 PDT, 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 2020-09-05 07:07:11 PDT
[2556/3671] Building CXX object Source...ources/UnifiedSource-4babe430-24.cpp.o
In file included from DerivedSources/WebCore/unified-sources/UnifiedSource-4babe430-24.cpp:3:
../../Source/WebCore/Modules/webaudio/BaseAudioContext.cpp: In member function ‘WebCore::PeriodicWave& WebCore::BaseAudioContext::periodicWave(WebCore::OscillatorType)’:
../../Source/WebCore/Modules/webaudio/BaseAudioContext.cpp:1328:1: warning: control reaches end of non-void function [-Wreturn-type]
 1328 | }
      | ^

For the past several years, I've been fixing this with RELEASE_ASSERT_NOT_REACHED(). The other alternative would be to CRASH().

In this case, we also have an awkward construction:

    case OscillatorType::Custom:
        ASSERT_NOT_REACHED();
#ifdef NDEBUG
        FALLTHROUGH;
#endif

Which appears to be an attempt to avoid performance penalty form RELEASE_ASSERT_NOT_REACHED(). It's simpler and safer to just use RELEASE_ASSERT_NOT_REACHED().
Comment 1 Michael Catanzaro 2020-09-05 07:11:22 PDT
Created attachment 408084 [details]
Patch
Comment 2 EWS 2020-09-05 08:57:40 PDT
Committed r266661: <https://trac.webkit.org/changeset/266661>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 408084 [details].