diff options
author | Chih-Hung Hsieh <chh@google.com> | 2018-09-13 11:08:41 -0700 |
---|---|---|
committer | Chih-hung Hsieh <chh@google.com> | 2018-09-17 16:50:11 +0000 |
commit | 502f4864d6c92fce4cb0e4f7f2b12d7124da902b (patch) | |
tree | b34cb377a8a6543fb0baf68e566b120209b3aaf9 /libutils | |
parent | c2501fda600ea2067099c1de042e3db7acde74ee (diff) | |
download | system_core-502f4864d6c92fce4cb0e4f7f2b12d7124da902b.tar.gz system_core-502f4864d6c92fce4cb0e4f7f2b12d7124da902b.tar.bz2 system_core-502f4864d6c92fce4cb0e4f7f2b12d7124da902b.zip |
Suppress implicit-fallthrough warnings.
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I40f8bbf94e207c9dd90921e9b762ba51abab5777
Diffstat (limited to 'libutils')
-rw-r--r-- | libutils/Android.bp | 1 | ||||
-rw-r--r-- | libutils/RefBase.cpp | 4 | ||||
-rw-r--r-- | libutils/Unicode.cpp | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/libutils/Android.bp b/libutils/Android.bp index 1c1bdf788..600c91c0e 100644 --- a/libutils/Android.bp +++ b/libutils/Android.bp @@ -59,6 +59,7 @@ cc_defaults { "-Werror", ], header_libs: [ + "libbase_headers", "libutils_headers", ], export_header_lib_headers: [ diff --git a/libutils/RefBase.cpp b/libutils/RefBase.cpp index 3f1e79a04..ae107893c 100644 --- a/libutils/RefBase.cpp +++ b/libutils/RefBase.cpp @@ -19,6 +19,8 @@ #include <memory> +#include <android-base/macros.h> + #include <utils/RefBase.h> #include <utils/CallStack.h> @@ -479,7 +481,7 @@ void RefBase::forceIncStrong(const void* id) const case INITIAL_STRONG_VALUE: refs->mStrong.fetch_sub(INITIAL_STRONG_VALUE, std::memory_order_relaxed); - // fall through... + FALLTHROUGH_INTENDED; case 0: refs->mBase->onFirstRef(); } diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp index 82f650dce..5f0a51f1c 100644 --- a/libutils/Unicode.cpp +++ b/libutils/Unicode.cpp @@ -16,8 +16,9 @@ #define LOG_TAG "unicode" -#include <utils/Unicode.h> +#include <android-base/macros.h> #include <limits.h> +#include <utils/Unicode.h> #include <log/log.h> @@ -105,8 +106,11 @@ static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size switch (bytes) { /* note: everything falls through. */ case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + FALLTHROUGH_INTENDED; case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + FALLTHROUGH_INTENDED; case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + FALLTHROUGH_INTENDED; case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]); } } |