libandroidfw: add FALLTHROUGH_INTENDED to silence warnings

Add FALLTHROUGH_INTENDED to silence compiler warnings such as the
following:

-------- 8< --------
[ 42% 27/63] //frameworks/base/libs/androidfw:libandroidfw clang++
Locale.cpp
frameworks/base/libs/androidfw/Locale.cpp:166:7: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
      case 5:
      ^
frameworks/base/libs/androidfw/Locale.cpp:166:7: note: insert 'FALLTHROUGH_INTENDED;' to silence this warning
      case 5:
      ^
      FALLTHROUGH_INTENDED;
frameworks/base/libs/androidfw/Locale.cpp:166:7: note: insert 'break;' to avoid fall-through
      case 5:
      ^
      break;
1 warning generated.
-------- >8 --------

Test: 'make libandroidfw' builds with no compiler warnings
Change-Id: I6bc67f2c072f88c9f1a92b7378a6f1a460db70b4
This commit is contained in:
Mårten Kongstad
2018-10-18 14:50:15 +02:00
committed by Todd Kennedy
parent b4c2dc0c1f
commit e0930d324c
3 changed files with 6 additions and 4 deletions

View File

@@ -59,8 +59,6 @@ cc_library {
"ZipFileRO.cpp",
"ZipUtils.cpp",
],
// Allow implicit fallthroughs in Locale.cpp and ResourceTypes.cpp until they are fixed.
cflags: ["-Wno-implicit-fallthrough"],
export_include_dirs: ["include"],
export_shared_lib_headers: ["libz"],
target: {

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "android-base/macros.h"
#include "androidfw/Locale.h"
#include "androidfw/Util.h"
@@ -162,6 +163,7 @@ bool LocaleValue::InitFromBcp47TagImpl(const StringPiece& bcp47tag, const char s
set_script(subtags[1].c_str());
break;
}
FALLTHROUGH_INTENDED;
case 5:
case 6:
case 7:

View File

@@ -29,6 +29,7 @@
#include <memory>
#include <type_traits>
#include <android-base/macros.h>
#include <androidfw/ByteBucketArray.h>
#include <androidfw/ResourceTypes.h>
#include <androidfw/TypeWrappers.h>
@@ -3073,6 +3074,7 @@ struct LocaleParserState {
}
break;
}
FALLTHROUGH_INTENDED;
case 5:
case 6:
case 7:
@@ -7002,7 +7004,7 @@ status_t DynamicRefTable::lookupResourceValue(Res_value* value) const {
switch (value->dataType) {
case Res_value::TYPE_ATTRIBUTE:
resolvedType = Res_value::TYPE_ATTRIBUTE;
// fallthrough
FALLTHROUGH_INTENDED;
case Res_value::TYPE_REFERENCE:
// Only resolve non-dynamic references and attributes if the package is loaded as a
// library or if a shared library is attempting to retrieve its own resource
@@ -7015,7 +7017,7 @@ status_t DynamicRefTable::lookupResourceValue(Res_value* value) const {
break;
case Res_value::TYPE_DYNAMIC_ATTRIBUTE:
resolvedType = Res_value::TYPE_ATTRIBUTE;
// fallthrough
FALLTHROUGH_INTENDED;
case Res_value::TYPE_DYNAMIC_REFERENCE:
break;
default: