diff options
author | Galina Kistanova <gkistanova@gmail.com> | 2017-05-29 01:34:26 +0000 |
---|---|---|
committer | Galina Kistanova <gkistanova@gmail.com> | 2017-05-29 01:34:26 +0000 |
commit | 229c9c115997141ad95632a0bf512eb68b86bd56 (patch) | |
tree | 77d161967a35c304818e6364da27f18397330269 /llvm/lib/Support/ConvertUTF.cpp | |
parent | ce0c205813c74b4225180ac8a6e40fd52ea88229 (diff) | |
download | bcm5719-llvm-229c9c115997141ad95632a0bf512eb68b86bd56.tar.gz bcm5719-llvm-229c9c115997141ad95632a0bf512eb68b86bd56.zip |
Disabled implicit-fallthrough warnings for ConvertUTF.cpp.
ConvertUTF.cpp has a little dependency on LLVM, and since the code extensively uses fall-through switches,
I prefer disabling the warning for the whole file, rather than adding attributes for each case.
llvm-svn: 304120
Diffstat (limited to 'llvm/lib/Support/ConvertUTF.cpp')
-rw-r--r-- | llvm/lib/Support/ConvertUTF.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/Support/ConvertUTF.cpp b/llvm/lib/Support/ConvertUTF.cpp index 39fd218d3f0..aa9507c189e 100644 --- a/llvm/lib/Support/ConvertUTF.cpp +++ b/llvm/lib/Support/ConvertUTF.cpp @@ -53,6 +53,35 @@ #endif #include <assert.h> + +/* + * This code extensively uses fall-through switches. + * Keep the compiler from warning about that. + */ +#if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wimplicit-fallthrough") +# define ConvertUTF_DISABLE_WARNINGS \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wimplicit-fallthrough\"") +# define ConvertUTF_RESTORE_WARNINGS \ + _Pragma("clang diagnostic pop") +# endif +#elif defined(__GNUC__) && __GNUC__ > 6 +# define ConvertUTF_DISABLE_WARNINGS \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") +# define ConvertUTF_RESTORE_WARNINGS \ + _Pragma("GCC diagnostic pop") +#endif +#ifndef ConvertUTF_DISABLE_WARNINGS +# define ConvertUTF_DISABLE_WARNINGS +#endif +#ifndef ConvertUTF_RESTORE_WARNINGS +# define ConvertUTF_RESTORE_WARNINGS +#endif + +ConvertUTF_DISABLE_WARNINGS + namespace llvm { static const int halfShift = 10; /* used for shifting by 10 bits */ @@ -708,3 +737,5 @@ ConversionResult ConvertUTF8toUTF32(const UTF8 **sourceStart, --------------------------------------------------------------------- */ } // namespace llvm + +ConvertUTF_RESTORE_WARNINGS |