Switch to C++11

Change-Id: Ib2970327c36422d7b11103d52ba7e9e52db5554f
This commit is contained in:
Ken Wakasa 2014-03-06 19:47:20 +09:00
parent 51523c3bc4
commit ca0a0da864
4 changed files with 15 additions and 19 deletions

View file

@ -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)

View file

@ -16,6 +16,7 @@
#include "suggest/core/layout/proximity_info_state_utils.h"
#include <algorithm>
#include <cmath>
#include <cstring> // for memset()
#include <sstream> // for debug prints

View file

@ -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 <unordered_map>
#ifdef __APPLE__
#include <ext/hash_map>
#else // __APPLE__
#include <hash_map>
#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 <typename TKey, typename TValue> using hash_map_compat = std::unordered_map<TKey, TValue>;
#endif
#endif // LATINIME_HASH_MAP_COMPAT_H

View file

@ -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)