diff --git a/native/jni/Android.mk b/native/jni/Android.mk index 3b3da96cc..9657b9d65 100644 --- a/native/jni/Android.mk +++ b/native/jni/Android.mk @@ -31,15 +31,12 @@ LOCAL_CFLAGS += -Werror -Wall -Wextra -Weffc++ -Wformat=2 -Wcast-qual -Wcast-ali -Wwrite-strings -Wfloat-equal -Wpointer-arith -Winit-self -Wredundant-decls \ -Woverloaded-virtual -Wstrict-null-sentinel -Wsign-promo -Wno-system-headers -ifeq ($(TARGET_ARCH), arm) -ifeq ($(TARGET_GCC_VERSION), 4.6) -LOCAL_CFLAGS += -Winline -endif # TARGET_GCC_VERSION -endif # TARGET_ARCH - # To suppress compiler warnings for unused variables/functions used for debug features etc. LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function +# For C++11 +LOCAL_CFLAGS += -std=c++11 + include $(LOCAL_PATH)/NativeFileList.mk LOCAL_SRC_FILES := \ @@ -64,7 +61,7 @@ LOCAL_MODULE := libjni_latinime_common_static LOCAL_MODULE_TAGS := optional LOCAL_SDK_VERSION := 14 -LOCAL_NDK_STL_VARIANT := stlport_static +LOCAL_NDK_STL_VARIANT := gnustl_static include $(BUILD_STATIC_LIBRARY) ###################################### @@ -87,7 +84,7 @@ LOCAL_MODULE := libjni_latinime LOCAL_MODULE_TAGS := optional LOCAL_SDK_VERSION := 14 -LOCAL_NDK_STL_VARIANT := stlport_static +LOCAL_NDK_STL_VARIANT := gnustl_static LOCAL_LDFLAGS += -ldl include $(BUILD_SHARED_LIBRARY) diff --git a/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp b/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp index bc4ca8e9e..f84615487 100644 --- a/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp +++ b/native/jni/src/suggest/core/layout/proximity_info_state_utils.cpp @@ -16,6 +16,7 @@ #include "suggest/core/layout/proximity_info_state_utils.h" +#include #include #include // for memset() #include // for debug prints diff --git a/native/jni/src/utils/hash_map_compat.h b/native/jni/src/utils/hash_map_compat.h index a1e982bc4..7bf35a660 100644 --- a/native/jni/src/utils/hash_map_compat.h +++ b/native/jni/src/utils/hash_map_compat.h @@ -17,18 +17,12 @@ #ifndef LATINIME_HASH_MAP_COMPAT_H #define LATINIME_HASH_MAP_COMPAT_H -// TODO: Use std::unordered_map that has been standardized in C++11 +#include -#ifdef __APPLE__ -#include -#else // __APPLE__ -#include -#endif // __APPLE__ +#define hash_map_compat std::unordered_map -#ifdef __SGI_STL_PORT -#define hash_map_compat stlport::hash_map -#else // __SGI_STL_PORT -#define hash_map_compat __gnu_cxx::hash_map -#endif // __SGI_STL_PORT +#if 0 // TODO: Use this instead of the above macro. +template using hash_map_compat = std::unordered_map; +#endif #endif // LATINIME_HASH_MAP_COMPAT_H diff --git a/tools/dicttool/NativeLib.mk b/tools/dicttool/NativeLib.mk index 05e5841d3..26b677447 100644 --- a/tools/dicttool/NativeLib.mk +++ b/tools/dicttool/NativeLib.mk @@ -33,6 +33,10 @@ endif #HOST_JDK_IS_64BIT_VERSION LOCAL_CFLAGS += -DHOST_TOOL -fPIC -Wno-deprecated LOCAL_NO_DEFAULT_COMPILER_FLAGS := true +# For C++11 +# TODO: Change this to -std=c++11 +LOCAL_CFLAGS += -std=gnu++0x + LATINIME_NATIVE_JNI_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni LATINIME_NATIVE_SRC_DIR := $(LATINIME_DIR_RELATIVE_TO_DICTTOOL)/native/jni/src LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(LATINIME_NATIVE_SRC_DIR)