webrtc/rtc_base/system/fallthrough.h
Karl Wiberg 80ba333fc5 Move FALLTHROUGH macro to a separate header, and give it an RTC_ prefix
Bug: chromium:805946
Change-Id: Ibb5dce9af27d0e48c9aee6b0a860b6f62b3c76a0
Reviewed-on: https://webrtc-review.googlesource.com/46145
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21889}
2018-02-05 11:24:59 +00:00

31 lines
1.1 KiB
C

/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_SYSTEM_FALLTHROUGH_H_
#define RTC_BASE_SYSTEM_FALLTHROUGH_H_
// Macro to be used for switch-case fallthrough (required for enabling
// -Wimplicit-fallthrough warning on Clang).
// This macro definition must not be included from public headers! Because
// clang's diagnostic checks if there's a macro expanding to
// [[clang::fallthrough]] defined, and if so it suggests the first macro
// expanding to it. So if this macro is included in a public header, clang may
// suggest it instead of the client's own macro, which can cause confusion.
#ifdef __clang__
#define RTC_FALLTHROUGH() [[clang::fallthrough]]
#else
#define RTC_FALLTHROUGH() \
do { \
} while (0)
#endif
#endif // RTC_BASE_SYSTEM_FALLTHROUGH_H_