diff options
author | Chih-Hung Hsieh <chh@google.com> | 2018-09-24 21:45:27 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-09-24 21:45:27 -0700 |
commit | ce9dd1ff59c8811c3f86388b848ae8414e4949c5 (patch) | |
tree | 12a9aab563fabba3194f3c1e55e5b9d1e42cd411 | |
parent | 6d9c135de32e2ec67dfd0f213cbb783c7c96b953 (diff) | |
parent | 4c2e5755ba00b1728a7edbfba0a8b86ee713329b (diff) | |
download | wilhelm-ce9dd1ff59c8811c3f86388b848ae8414e4949c5.tar.gz |
Merge "Suppress implicit-fallthrough warnings." am: 7c1aa36d10
am: 4c2e5755ba
Change-Id: Iae0fd47ea7a3e725f6a809c4ddba7d5fc1649558
-rw-r--r-- | src/android/AudioPlayer_to_android.cpp | 28 | ||||
-rw-r--r-- | src/android/AudioRecorder_to_android.cpp | 3 | ||||
-rw-r--r-- | src/android/MediaPlayer_to_android.cpp | 30 | ||||
-rw-r--r-- | src/data.cpp | 5 | ||||
-rw-r--r-- | src/itf/I3DDoppler.cpp | 2 | ||||
-rw-r--r-- | src/itf/I3DLocation.cpp | 4 | ||||
-rw-r--r-- | src/itf/I3DMacroscopic.cpp | 2 | ||||
-rw-r--r-- | src/itf/IDeviceVolume.cpp | 4 | ||||
-rw-r--r-- | src/itf/IObject.cpp | 4 | ||||
-rw-r--r-- | src/itf/IPlay.cpp | 2 | ||||
-rw-r--r-- | src/sles_allinclusive.h | 8 |
11 files changed, 59 insertions, 33 deletions
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp index e361dcb..23411b0 100644 --- a/src/android/AudioPlayer_to_android.cpp +++ b/src/android/AudioPlayer_to_android.cpp @@ -117,9 +117,9 @@ SLresult aplayer_setPlayState(const android::sp<android::GenericPlayer> &ap, SLu case ANDROID_UNINITIALIZED: *pObjState = ANDROID_PREPARING; ap->prepare(); - // intended fall through + FALLTHROUGH_INTENDED; case ANDROID_PREPARING: - // intended fall through + FALLTHROUGH_INTENDED; case ANDROID_READY: ap->play(); break; @@ -1064,6 +1064,7 @@ SLresult android_audioPlayer_checkSourceSink(CAudioPlayer *pAudioPlayer) // checkDataFormat() already checked representation df_representation = &df_pcm->representation; } // SL_ANDROID_DATAFORMAT_PCM_EX - fall through to next test. + FALLTHROUGH_INTENDED; case SL_DATAFORMAT_PCM: { // checkDataFormat() already did generic checks, now do the Android-specific checks const SLDataFormat_PCM *df_pcm = (const SLDataFormat_PCM *) pAudioSrc->pFormat; @@ -1360,6 +1361,7 @@ static void audioTrack_callBack_pullFromBuffQueue(int event, void* user, void *i case android::AudioTrack::EVENT_LOOP_END: case android::AudioTrack::EVENT_STREAM_END: // These are unexpected so fall through + FALLTHROUGH_INTENDED; default: // FIXME where does the notification of SL_PLAYEVENT_HEADMOVING fit? SL_LOGE("Encountered unknown AudioTrack event %d for CAudioPlayer %p", event, @@ -1598,7 +1600,7 @@ static void checkAndSetPerformanceModePost(CAudioPlayer *pAudioPlayer) break; } pAudioPlayer->mPerformanceMode = ANDROID_PERFORMANCE_MODE_LATENCY_EFFECTS; - /* FALL THROUGH */ + FALLTHROUGH_INTENDED; case ANDROID_PERFORMANCE_MODE_LATENCY_EFFECTS: if ((flags & AUDIO_OUTPUT_FLAG_FAST) == 0) { pAudioPlayer->mPerformanceMode = ANDROID_PERFORMANCE_MODE_NONE; @@ -1962,14 +1964,16 @@ SLresult android_audioPlayer_destroy(CAudioPlayer *pAudioPlayer) { case AUDIOPLAYER_FROM_PCM_BUFFERQUEUE: // intended fall-throughk, both types of players // use the TrackPlayerBase for playback + FALLTHROUGH_INTENDED; case AUDIOPLAYER_FROM_URIFD: if (pAudioPlayer->mTrackPlayer != 0) { pAudioPlayer->mTrackPlayer->destroy(); } - - // intended fall-through - case AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through - case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE: // intended fall-through + FALLTHROUGH_INTENDED; + case AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; + case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE: + FALLTHROUGH_INTENDED; case AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE: pAudioPlayer->mAPlayer.clear(); break; @@ -2262,8 +2266,10 @@ void android_audioPlayer_setPlayState(CAudioPlayer *ap) { } break; - case AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through - case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE: // intended fall-through + case AUDIOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; + case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE: + FALLTHROUGH_INTENDED; case AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE: // FIXME report and use the return code to the lock mechanism, which is where play state // changes are updated (see object_unlock_exclusive_attributes()) @@ -2337,7 +2343,8 @@ SLresult android_audioPlayer_getDuration(IPlay *pPlayItf, SLmillisecond *pDurMse CAudioPlayer *ap = (CAudioPlayer *)pPlayItf->mThis; switch (ap->mAndroidObjType) { - case AUDIOPLAYER_FROM_URIFD: // intended fall-through + case AUDIOPLAYER_FROM_URIFD: + FALLTHROUGH_INTENDED; case AUDIOPLAYER_FROM_URIFD_TO_PCM_BUFFERQUEUE: { int32_t durationMsec = ANDROID_UNKNOWN_TIME; if (ap->mAPlayer != 0) { @@ -2522,6 +2529,7 @@ void android_audioPlayer_androidBufferQueue_clear_l(CAudioPlayer *ap) { } break; case AUDIOPLAYER_FROM_ADTS_ABQ_TO_PCM_BUFFERQUEUE: // nothing to do here, fall through + FALLTHROUGH_INTENDED; default: break; } diff --git a/src/android/AudioRecorder_to_android.cpp b/src/android/AudioRecorder_to_android.cpp index 38e50bf..4e2f31d 100644 --- a/src/android/AudioRecorder_to_android.cpp +++ b/src/android/AudioRecorder_to_android.cpp @@ -245,6 +245,7 @@ SLresult android_audioRecorder_checkSourceSink(CAudioRecorder* ar) { // checkDataFormat() already checked representation df_representation = &df_pcm->representation; } // SL_ANDROID_DATAFORMAT_PCM_EX - fall through to next test. + FALLTHROUGH_INTENDED; case SL_DATAFORMAT_PCM: { const SLDataFormat_PCM *df_pcm = (const SLDataFormat_PCM *) pAudioSnk->pFormat; // checkDataFormat already checked sample rate, channels, and mask @@ -618,7 +619,7 @@ static void checkAndSetPerformanceModePost(CAudioRecorder* ar) break; } ar->mPerformanceMode = ANDROID_PERFORMANCE_MODE_LATENCY_EFFECTS; - /* FALL THROUGH */ + FALLTHROUGH_INTENDED; case ANDROID_PERFORMANCE_MODE_LATENCY_EFFECTS: if ((flags & AUDIO_INPUT_FLAG_FAST) == 0) { ar->mPerformanceMode = ANDROID_PERFORMANCE_MODE_NONE; diff --git a/src/android/MediaPlayer_to_android.cpp b/src/android/MediaPlayer_to_android.cpp index 7d8d1af..5b150f4 100644 --- a/src/android/MediaPlayer_to_android.cpp +++ b/src/android/MediaPlayer_to_android.cpp @@ -334,7 +334,8 @@ XAresult android_Player_checkSourceSink(CMediaPlayer *mp) { } } break; - case XA_DATALOCATOR_URI: // intended fall-through + case XA_DATALOCATOR_URI: + FALLTHROUGH_INTENDED; case XA_DATALOCATOR_ANDROIDFD: break; @@ -378,11 +379,13 @@ XAresult android_Player_create(CMediaPlayer *mp) { case XA_DATALOCATOR_ANDROIDBUFFERQUEUE: mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE; break; - case XA_DATALOCATOR_URI: // intended fall-through + case XA_DATALOCATOR_URI: + FALLTHROUGH_INTENDED; case SL_DATALOCATOR_ANDROIDFD: mp->mAndroidObjType = AUDIOVIDEOPLAYER_FROM_URIFD; break; - case XA_DATALOCATOR_ADDRESS: // intended fall-through + case XA_DATALOCATOR_ADDRESS: + FALLTHROUGH_INTENDED; default: mp->mAndroidObjType = INVALID_TYPE; SL_LOGE("Unable to create MediaPlayer for data source locator 0x%x", sourceLocator); @@ -446,7 +449,8 @@ XAresult android_Player_realize(CMediaPlayer *mp, SLboolean async) { } } break; - case INVALID_TYPE: // intended fall-through + case INVALID_TYPE: + FALLTHROUGH_INTENDED; default: SL_LOGE("Unable to realize MediaPlayer, invalid internal Android object type"); result = XA_RESULT_PARAMETER_INVALID; @@ -534,7 +538,8 @@ XAresult android_Player_getDuration(IPlay *pPlayItf, XAmillisecond *pDurMsec) { } } break; - case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through + case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; default: *pDurMsec = XA_TIME_UNKNOWN; break; @@ -551,7 +556,8 @@ XAresult android_Player_getPosition(IPlay *pPlayItf, XAmillisecond *pPosMsec) { switch (avp->mAndroidObjType) { - case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through + case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; case AUDIOVIDEOPLAYER_FROM_URIFD: { int pos = ANDROID_UNKNOWN_TIME; if (avp->mAVPlayer != 0) { @@ -631,9 +637,9 @@ XAresult android_Player_setPlayState(const android::sp<android::GenericPlayer> & case ANDROID_UNINITIALIZED: *pObjState = ANDROID_PREPARING; gp->prepare(); - // intended fall through + FALLTHROUGH_INTENDED; case ANDROID_PREPARING: - // intended fall through + FALLTHROUGH_INTENDED; case ANDROID_READY: gp->play(); break; @@ -663,7 +669,8 @@ XAresult android_Player_seek(CMediaPlayer *mp, SLmillisecond posMsec) { mp->mAVPlayer->seek(posMsec); } break; - case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through + case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; default: { result = XA_RESULT_FEATURE_UNSUPPORTED; } @@ -683,7 +690,8 @@ XAresult android_Player_loop(CMediaPlayer *mp, SLboolean loopEnable) { mp->mAVPlayer->loop(loopEnable); } break; - case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: // intended fall-through + case AUDIOVIDEOPLAYER_FROM_TS_ANDROIDBUFFERQUEUE: + FALLTHROUGH_INTENDED; default: { result = XA_RESULT_FEATURE_UNSUPPORTED; } @@ -746,7 +754,7 @@ SLresult android_Player_setNativeWindow(CMediaPlayer *mp, ANativeWindow *nativeW result = SL_RESULT_SUCCESS; } break; case NATIVE_WINDOW_FRAMEBUFFER: // FramebufferNativeWindow - // fall through + FALLTHROUGH_INTENDED; default: SL_LOGE("ANativeWindow * %p has unknown or unsupported concrete type %d", nativeWindow, value); diff --git a/src/data.cpp b/src/data.cpp index ace2862..fc6dffc 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -364,6 +364,7 @@ static SLresult checkDataFormat(const char *name, void *pFormat, DataFormat *pDa break; } // SL_ANDROID_DATAFORMAT_PCM_EX - fall through to next test. + FALLTHROUGH_INTENDED; case SL_DATAFORMAT_PCM: pDataFormat->mPCM = *(SLDataFormat_PCM *)pFormat; do { @@ -790,7 +791,7 @@ SLresult checkDataSource(const char *name, const SLDataSource *pDataSrc, // Per the spec, the pFormat field is ignored in some cases case SL_DATALOCATOR_IODEVICE: myDataSrc.pFormat = NULL; - // fall through + FALLTHROUGH_INTENDED; case SL_DATALOCATOR_NULL: case SL_DATALOCATOR_MIDIBUFFERQUEUE: allowedDataFormatMask &= DATAFORMAT_MASK_NULL; @@ -872,7 +873,7 @@ SLresult checkDataSink(const char *name, const SLDataSink *pDataSink, case SL_DATALOCATOR_OUTPUTMIX: case XA_DATALOCATOR_NATIVEDISPLAY: myDataSink.pFormat = NULL; - // fall through + FALLTHROUGH_INTENDED; case SL_DATALOCATOR_NULL: case SL_DATALOCATOR_MIDIBUFFERQUEUE: allowedDataFormatMask &= DATAFORMAT_MASK_NULL; diff --git a/src/itf/I3DDoppler.cpp b/src/itf/I3DDoppler.cpp index 8a20f81..174bd75 100644 --- a/src/itf/I3DDoppler.cpp +++ b/src/itf/I3DDoppler.cpp @@ -81,7 +81,7 @@ static SLresult I3DDoppler_GetVelocityCartesian(SL3DDopplerItf self, SLVec3D *pV break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: thiz->mVelocityActive = CARTESIAN_REQUESTED_SPHERICAL_SET; - // fall through + FALLTHROUGH_INTENDED; case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 diff --git a/src/itf/I3DLocation.cpp b/src/itf/I3DLocation.cpp index c0eff3b..d323232 100644 --- a/src/itf/I3DLocation.cpp +++ b/src/itf/I3DLocation.cpp @@ -87,7 +87,7 @@ static SLresult I3DLocation_Move(SL3DLocationItf self, const SLVec3D *pMovement) break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; - // fall through + FALLTHROUGH_INTENDED; case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 @@ -134,7 +134,7 @@ static SLresult I3DLocation_GetLocationCartesian(SL3DLocationItf self, SLVec3D * break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; - // fall through + FALLTHROUGH_INTENDED; case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 diff --git a/src/itf/I3DMacroscopic.cpp b/src/itf/I3DMacroscopic.cpp index feb91e2..01da236 100644 --- a/src/itf/I3DMacroscopic.cpp +++ b/src/itf/I3DMacroscopic.cpp @@ -170,7 +170,7 @@ static SLresult I3DMacroscopic_GetOrientationVectors(SL3DMacroscopicItf self, break; case ANGLES_SET_VECTORS_UNKNOWN: thiz->mOrientationActive = ANGLES_SET_VECTORS_REQUESTED; - // fall through + FALLTHROUGH_INTENDED; case ANGLES_SET_VECTORS_REQUESTED: // matched by cond_broadcast in case multiple requesters #if 0 diff --git a/src/itf/IDeviceVolume.cpp b/src/itf/IDeviceVolume.cpp index bd9f0be..58e10ff 100644 --- a/src/itf/IDeviceVolume.cpp +++ b/src/itf/IDeviceVolume.cpp @@ -55,7 +55,7 @@ static SLresult IDeviceVolume_SetVolume(SLDeviceVolumeItf self, SLuint32 deviceI case DEVICE_ID_HEADSET: case DEVICE_ID_HANDSFREE: deviceID = SL_DEFAULTDEVICEID_AUDIOOUTPUT; - // fall through + FALLTHROUGH_INTENDED; case SL_DEFAULTDEVICEID_AUDIOINPUT: case SL_DEFAULTDEVICEID_AUDIOOUTPUT: { @@ -87,7 +87,7 @@ static SLresult IDeviceVolume_GetVolume(SLDeviceVolumeItf self, SLuint32 deviceI case DEVICE_ID_HEADSET: case DEVICE_ID_HANDSFREE: deviceID = SL_DEFAULTDEVICEID_AUDIOOUTPUT; - // fall through + FALLTHROUGH_INTENDED; case SL_DEFAULTDEVICEID_AUDIOINPUT: case SL_DEFAULTDEVICEID_AUDIOOUTPUT: { diff --git a/src/itf/IObject.cpp b/src/itf/IObject.cpp index adcc4b2..da88845 100644 --- a/src/itf/IObject.cpp +++ b/src/itf/IObject.cpp @@ -534,7 +534,7 @@ void IObject_Destroy(SLObjectItf self) break; case predestroy_error: SL_LOGE("Object::Destroy(%p) not allowed", thiz); - // fall through + FALLTHROUGH_INTENDED; case predestroy_again: object_unlock_exclusive(thiz); // unfortunately Destroy doesn't return a result @@ -601,7 +601,7 @@ void IObject_Destroy(SLObjectItf self) } *interfaceStateP = INTERFACE_INITIALIZED; } - // fall through + FALLTHROUGH_INTENDED; case INTERFACE_INITIALIZED: { VoidHook deinit = MPH_init_table[x->mMPH].mDeinit; diff --git a/src/itf/IPlay.cpp b/src/itf/IPlay.cpp index 8e44463..acee3ff 100644 --- a/src/itf/IPlay.cpp +++ b/src/itf/IPlay.cpp @@ -61,7 +61,7 @@ static SLresult IPlay_SetPlayState(SLPlayItf self, SLuint32 state) // note that USE_OUTPUTMIXEXT does not support ATTR_ABQ_ENQUEUE attr |= ATTR_BQ_ENQUEUE; } - // fall through + FALLTHROUGH_INTENDED; case (SL_PLAYSTATE_STOPPED << 2) | SL_PLAYSTATE_PAUSED: case (SL_PLAYSTATE_PLAYING << 2) | SL_PLAYSTATE_PAUSED: diff --git a/src/sles_allinclusive.h b/src/sles_allinclusive.h index ede6210..0e6d09a 100644 --- a/src/sles_allinclusive.h +++ b/src/sles_allinclusive.h @@ -400,6 +400,14 @@ extern const char * const interface_names[MPH_MAX]; extern void audioPlayerTransportUpdate(CAudioPlayer *audioPlayer); #endif +#ifndef FALLTHROUGH_INTENDED +#ifdef __clang__ +#define FALLTHROUGH_INTENDED [[clang::fallthrough]] +#else +#define FALLTHROUGH_INTENDED +#endif // __clang__ +#endif // FALLTHROUGH_INTENDED + extern SLresult IBufferQueue_Enqueue(SLBufferQueueItf self, const void *pBuffer, SLuint32 size); extern SLresult IBufferQueue_Clear(SLBufferQueueItf self); extern SLresult IBufferQueue_RegisterCallback(SLBufferQueueItf self, |