aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2017-10-20 15:10:59 -0700
committerChih-Hung Hsieh <chh@google.com>2017-10-20 15:19:55 -0700
commit1da7b0c5bb04e4f3dca660819cafed14a1f67702 (patch)
tree343ea05fbf05a9b45962a923e58e3b4f952a6e88
parentad5da5881dcaf3a1b4ec0cbdda51401460b6e37a (diff)
downloadlatinime-1da7b0c5bb04e4f3dca660819cafed14a1f67702.tar.gz
latinime-1da7b0c5bb04e4f3dca660819cafed14a1f67702.tar.xz
latinime-1da7b0c5bb04e4f3dca660819cafed14a1f67702.zip
Use -Werror in packages/inputmethods/LatinIME/native/jni
* Suppress warning on unused loop index variable. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: Ia3f0f9cc4cb0ebeeac9b1ff51955597a725c87ef
-rw-r--r--native/jni/Android.mk2
-rw-r--r--native/jni/HostUnitTests.mk2
-rw-r--r--native/jni/TargetUnitTests.mk4
-rw-r--r--native/jni/tests/dictionary/utils/trie_map_test.cpp1
4 files changed, 6 insertions, 3 deletions
diff --git a/native/jni/Android.mk b/native/jni/Android.mk
index 01b32a95e..53846485f 100644
--- a/native/jni/Android.mk
+++ b/native/jni/Android.mk
@@ -88,6 +88,7 @@ LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := 14
LOCAL_NDK_STL_VARIANT := c++_static
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_LDFLAGS += -ldl
include $(BUILD_SHARED_LIBRARY)
@@ -99,3 +100,4 @@ include $(LOCAL_PATH)/HostUnitTests.mk
#################### Unit test on target environment
include $(LOCAL_PATH)/TargetUnitTests.mk
+//LOCAL_CFLAGS += -Wall -Werror
diff --git a/native/jni/HostUnitTests.mk b/native/jni/HostUnitTests.mk
index 6dd615cf7..baf1cace3 100644
--- a/native/jni/HostUnitTests.mk
+++ b/native/jni/HostUnitTests.mk
@@ -29,7 +29,7 @@ include $(LOCAL_PATH)/NativeFileList.mk
#################### Host library for unit test
LATIN_IME_SRC_DIR := src
LOCAL_ADDRESS_SANITIZER := true
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wall -Werror
LOCAL_CXX_STL := libc++
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_MODULE := liblatinime_host_static_for_unittests
diff --git a/native/jni/TargetUnitTests.mk b/native/jni/TargetUnitTests.mk
index b05cd1401..32aada057 100644
--- a/native/jni/TargetUnitTests.mk
+++ b/native/jni/TargetUnitTests.mk
@@ -21,7 +21,7 @@ include $(LOCAL_PATH)/NativeFileList.mk
#################### Target library for unit test
LATIN_IME_SRC_DIR := src
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wall -Werror
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_MODULE := liblatinime_target_static_for_unittests
LOCAL_MODULE_TAGS := optional
@@ -33,7 +33,7 @@ include $(BUILD_STATIC_LIBRARY)
#################### Target native tests
include $(CLEAR_VARS)
LATIN_IME_TEST_SRC_DIR := tests
-LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function -Wall -Werror
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
LOCAL_MODULE := liblatinime_target_unittests
LOCAL_MODULE_TAGS := tests
diff --git a/native/jni/tests/dictionary/utils/trie_map_test.cpp b/native/jni/tests/dictionary/utils/trie_map_test.cpp
index 745d39897..8f3ec9d24 100644
--- a/native/jni/tests/dictionary/utils/trie_map_test.cpp
+++ b/native/jni/tests/dictionary/utils/trie_map_test.cpp
@@ -55,6 +55,7 @@ TEST(TrieMapTest, TestRemove) {
EXPECT_TRUE(trieMap.remove(10, trieMap.getRootBitmapEntryIndex()));
EXPECT_FALSE(trieMap.getRoot(10).mIsValid);
for (const auto &element : trieMap.getEntriesInRootLevel()) {
+ (void)element; // not used
EXPECT_TRUE(false);
}
EXPECT_TRUE(trieMap.putRoot(10, 0x3FFFFF));