From c7d307d87394e154aa495d1ea23509c9a39e1108 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 29 Jul 2015 15:13:57 -0700 Subject: [PATCH] Bump the default C++ standard up to C++14. This also drops the NDK default back to C++98 (or C++11 for code using libc++). The platform NDK build should match the normal NDK build. Bug: http://b/23043421 Change-Id: I3a336767ce271e84f4dfdebdadb3a98e5689def9 --- core/binary.mk | 16 ++++++++++++++++ core/config.mk | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/binary.mk b/core/binary.mk index 79548bac4..c716b179d 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -179,6 +179,22 @@ ifdef LOCAL_IS_HOST_MODULE endif endif +my_cpp_std_version := -std=gnu++14 +ifdef LOCAL_SDK_VERSION + # The NDK handles this itself. + my_cpp_std_version := +endif + +ifdef LOCAL_IS_HOST_MODULE + ifneq ($(my_clang),true) + # The host GCC doesn't support C++14 (and is deprecated, so likely + # never will). Build these modules with C++11. + my_cpp_std_version := -std=gnu++11 + endif +endif + +my_cppflags := $(my_cpp_std_version) $(my_cppflags) + # Add option to make clang the default for device build ifeq ($(USE_CLANG_PLATFORM_BUILD),true) ifeq ($(my_clang),) diff --git a/core/config.mk b/core/config.mk index fec018bb1..876161b6c 100644 --- a/core/config.mk +++ b/core/config.mk @@ -114,7 +114,7 @@ hide := $(if $(SHOW_COMMANDS),,@) COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG -COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo -std=gnu++11 +COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS) GLOBAL_CFLAGS_NO_OVERRIDE := \