ICU-12893 enable U_FALLTHROUGH only for clang; fix a former .c file
X-SVN-Rev: 39702
This commit is contained in:
parent
8c61bdb545
commit
1d5d552ae1
@ -430,7 +430,7 @@
|
||||
# define U_HAVE_DEBUG_LOCATION_NEW 0
|
||||
#endif
|
||||
|
||||
/* Compatibility with non clang compilers: http://clang.llvm.org/docs/LanguageExtensions.html */
|
||||
/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
@ -538,8 +538,11 @@
|
||||
* @internal
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# if __has_cpp_attribute(clang::fallthrough) || \
|
||||
(__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))
|
||||
# ifdef U_FALLTHROUGH
|
||||
// Use the predefined value.
|
||||
# elif defined(__clang__) && \
|
||||
(__has_cpp_attribute(clang::fallthrough) || \
|
||||
(__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")))
|
||||
# define U_FALLTHROUGH [[clang::fallthrough]]
|
||||
# else
|
||||
# define U_FALLTHROUGH
|
||||
|
@ -155,6 +155,7 @@ utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c,
|
||||
c=(c<<6)|trail;
|
||||
/* c>=0x110 would result in code point>0x10ffff, outside Unicode */
|
||||
if(c>=0x110 || trail>0x3f) { break; }
|
||||
U_FALLTHROUGH;
|
||||
case 2:
|
||||
trail=s[i++]-0x80;
|
||||
c=(c<<6)|trail;
|
||||
@ -163,6 +164,7 @@ utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c,
|
||||
* before the last (c<<6), a surrogate is c=360..37f
|
||||
*/
|
||||
if(((c&0xffe0)==0x360 && strict!=-2) || trail>0x3f) { break; }
|
||||
U_FALLTHROUGH;
|
||||
case 1:
|
||||
trail=s[i++]-0x80;
|
||||
c=(c<<6)|trail;
|
||||
|
Loading…
Reference in New Issue
Block a user