diff --git a/CMakeLists.txt b/CMakeLists.txt index 54bb787bb45..95b711256d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,12 +222,12 @@ if (NOT DEFINED CMAKE_C_STANDARD) set(CMAKE_C_STANDARD 99) endif() -# Add c++11 flags +# Add c++14 flags if (NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) else() - if (CMAKE_CXX_STANDARD LESS 11) - message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, please specify at least SET(CMAKE_CXX_STANDARD 11)") + if (CMAKE_CXX_STANDARD LESS 14) + message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 14, please specify at least SET(CMAKE_CXX_STANDARD 14)") endif() endif() if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) diff --git a/Makefile b/Makefile index 4fa95082abf..bae84705a77 100644 --- a/Makefile +++ b/Makefile @@ -309,7 +309,7 @@ else TMPOUT = `mktemp /tmp/test-out-XXXXXX` endif -CHECK_NO_CXX14_COMPAT_WORKS_CMD = $(CC) -std=c++11 -Werror -Wno-c++14-compat -o $(TMPOUT) -c test/build/no-c++14-compat.cc +CHECK_NO_CXX14_COMPAT_WORKS_CMD = $(CC) -std=c++14 -Werror -Wno-c++14-compat -o $(TMPOUT) -c test/build/no-c++14-compat.cc HAS_WORKING_NO_CXX14_COMPAT = $(shell $(CHECK_NO_CXX14_COMPAT_WORKS_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_WORKING_NO_CXX14_COMPAT),true) W_NO_CXX14_COMPAT=-Wno-c++14-compat @@ -357,7 +357,7 @@ HOST_LD ?= $(LD) HOST_LDXX ?= $(LDXX) CFLAGS += -std=c99 $(W_EXTRA_SEMI) -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation diff --git a/Package.swift b/Package.swift index 0567b76c85b..406b433ff69 100644 --- a/Package.swift +++ b/Package.swift @@ -129,5 +129,5 @@ let package = Package( ), ], cLanguageStandard: .gnu11, - cxxLanguageStandard: .cxx11 + cxxLanguageStandard: .cxx14 ) diff --git a/Rakefile b/Rakefile index e313627e319..efd89e1e50c 100755 --- a/Rakefile +++ b/Rakefile @@ -101,7 +101,7 @@ task 'dlls', [:plat] do |t, args| env = 'CPPFLAGS="-D_WIN32_WINNT=0x600 -DNTDDI_VERSION=0x06000000 -DUNICODE -D_UNICODE -Wno-unused-variable -Wno-unused-result -DCARES_STATICLIB -Wno-error=conversion -Wno-sign-compare -Wno-parentheses -Wno-format -DWIN32_LEAN_AND_MEAN" ' env += 'CFLAGS="-Wno-incompatible-pointer-types" ' - env += 'CXXFLAGS="-std=c++11 -fno-exceptions" ' + env += 'CXXFLAGS="-std=c++14 -fno-exceptions" ' env += 'LDFLAGS=-static ' env += 'SYSTEM=MINGW32 ' env += 'EMBED_ZLIB=true ' diff --git a/config.m4 b/config.m4 index 1baaeec0d73..df036077eb8 100644 --- a/config.m4 +++ b/config.m4 @@ -19,7 +19,7 @@ if test "$PHP_GRPC" != "no"; then LIBS="-lpthread $LIBS" CFLAGS="-std=c11 -g -O2" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2" + CXXFLAGS="-std=c++14 -fno-exceptions -fno-rtti -g -O2" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/examples/android/helloworld/app/CMakeLists.txt b/examples/android/helloworld/app/CMakeLists.txt index 160eb845d99..0312f49a341 100644 --- a/examples/android/helloworld/app/CMakeLists.txt +++ b/examples/android/helloworld/app/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4.1) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") # https://github.com/abseil/abseil-cpp/issues/626 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DABSL_NO_XRAY_ATTRIBUTES=1") diff --git a/examples/cpp/cmake/common.cmake b/examples/cpp/cmake/common.cmake index 6650ff892aa..3e12e2d6d4d 100644 --- a/examples/cpp/cmake/common.cmake +++ b/examples/cpp/cmake/common.cmake @@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.5.1) -set (CMAKE_CXX_STANDARD 11) +set (CMAKE_CXX_STANDARD 14) if(MSVC) add_definitions(-D_WIN32_WINNT=0x600) diff --git a/examples/cpp/compression/Makefile b/examples/cpp/compression/Makefile index 4adbbb543ef..566e2d06566 100644 --- a/examples/cpp/compression/Makefile +++ b/examples/cpp/compression/Makefile @@ -18,7 +18,7 @@ HOST_SYSTEM = $(shell uname | cut -f 1 -d_) SYSTEM ?= $(HOST_SYSTEM) CXX = g++ CPPFLAGS += `pkg-config --cflags protobuf grpc` -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\ -lgrpc++_reflection\ diff --git a/examples/cpp/helloworld/Makefile b/examples/cpp/helloworld/Makefile index b5eb41c0d8a..694c68ba82c 100644 --- a/examples/cpp/helloworld/Makefile +++ b/examples/cpp/helloworld/Makefile @@ -18,7 +18,7 @@ HOST_SYSTEM = $(shell uname | cut -f 1 -d_) SYSTEM ?= $(HOST_SYSTEM) CXX = g++ CPPFLAGS += `pkg-config --cflags protobuf grpc` -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\ -pthread\ diff --git a/examples/cpp/load_balancing/Makefile b/examples/cpp/load_balancing/Makefile index 71f780e260b..3faaf714d3f 100644 --- a/examples/cpp/load_balancing/Makefile +++ b/examples/cpp/load_balancing/Makefile @@ -18,7 +18,7 @@ HOST_SYSTEM = $(shell uname | cut -f 1 -d_) SYSTEM ?= $(HOST_SYSTEM) CXX = g++ CPPFLAGS += `pkg-config --cflags protobuf grpc` -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\ -lgrpc++_reflection\ diff --git a/examples/cpp/metadata/Makefile b/examples/cpp/metadata/Makefile index 36fd554b907..1a2c5a31e47 100644 --- a/examples/cpp/metadata/Makefile +++ b/examples/cpp/metadata/Makefile @@ -17,7 +17,7 @@ SYSTEM ?= $(HOST_SYSTEM) CXX = g++ CPPFLAGS += `pkg-config --cflags protobuf grpc` -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\ -lgrpc++_reflection\ diff --git a/examples/cpp/route_guide/Makefile b/examples/cpp/route_guide/Makefile index 17d2820cc43..193f128a908 100644 --- a/examples/cpp/route_guide/Makefile +++ b/examples/cpp/route_guide/Makefile @@ -18,7 +18,7 @@ HOST_SYSTEM = $(shell uname | cut -f 1 -d_) SYSTEM ?= $(HOST_SYSTEM) CXX = g++ CPPFLAGS += `pkg-config --cflags protobuf grpc` -CXXFLAGS += -std=c++11 +CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++`\ -pthread\ diff --git a/examples/objective-c/auth_sample/AuthSample.xcodeproj/project.pbxproj b/examples/objective-c/auth_sample/AuthSample.xcodeproj/project.pbxproj index 7a82f6785c9..621b8d6cebc 100644 --- a/examples/objective-c/auth_sample/AuthSample.xcodeproj/project.pbxproj +++ b/examples/objective-c/auth_sample/AuthSample.xcodeproj/project.pbxproj @@ -255,7 +255,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -299,7 +299,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/examples/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj b/examples/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj index 6e2f1f324db..18a31c9a5d2 100644 --- a/examples/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj +++ b/examples/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj @@ -244,7 +244,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -286,7 +286,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/examples/objective-c/route_guide/RouteGuideClient.xcodeproj/project.pbxproj b/examples/objective-c/route_guide/RouteGuideClient.xcodeproj/project.pbxproj index 1ed66e9da68..2ef90b1b332 100644 --- a/examples/objective-c/route_guide/RouteGuideClient.xcodeproj/project.pbxproj +++ b/examples/objective-c/route_guide/RouteGuideClient.xcodeproj/project.pbxproj @@ -255,7 +255,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -299,7 +299,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/grpc.gyp b/grpc.gyp index f7152949331..f0c0f2527b7 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -71,7 +71,7 @@ ], 'cflags_cc': [ '-Werror', - '-std=c++11', + '-std=c++14', ], 'include_dirs': [ '.', @@ -154,7 +154,7 @@ '-Isrc/core/ext/upbdefs-generated', '-Ithird_party/xxhash', '-stdlib=libc++', - '-std=c++11', + '-std=c++14', '-Wno-error=deprecated-declarations', ], }, diff --git a/setup.py b/setup.py index 5ac221ad46b..aa7bb354d09 100644 --- a/setup.py +++ b/setup.py @@ -201,7 +201,7 @@ def check_linker_need_libatomic(): code_test = (b'#include \n' + b'int main() { return std::atomic{}; }') cxx = shlex.split(os.environ.get('CXX', 'c++')) - cpp_test = subprocess.Popen(cxx + ['-x', 'c++', '-std=c++11', '-'], + cpp_test = subprocess.Popen(cxx + ['-x', 'c++', '-std=c++14', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -211,7 +211,7 @@ def check_linker_need_libatomic(): # Double-check to see if -latomic actually can solve the problem. # https://github.com/grpc/grpc/issues/22491 cpp_test = subprocess.Popen( - [cxx, '-x', 'c++', '-std=c++11', '-', '-latomic'], + [cxx, '-x', 'c++', '-std=c++14', '-', '-latomic'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -229,7 +229,7 @@ def check_linker_need_libatomic(): EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None) EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) if EXTRA_ENV_COMPILE_ARGS is None: - EXTRA_ENV_COMPILE_ARGS = ' -std=c++11' + EXTRA_ENV_COMPILE_ARGS = ' -std=c++14' if 'win32' in sys.platform: if sys.version_info < (3, 5): EXTRA_ENV_COMPILE_ARGS += ' -D_hypot=hypot' diff --git a/src/android/test/interop/app/CMakeLists.txt b/src/android/test/interop/app/CMakeLists.txt index 53fbe594499..51ce106f181 100644 --- a/src/android/test/interop/app/CMakeLists.txt +++ b/src/android/test/interop/app/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4.1) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") # https://github.com/abseil/abseil-cpp/issues/626 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DABSL_NO_XRAY_ATTRIBUTES=1") diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj index 1d58117ef1e..9c08cc10cbb 100644 --- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -244,7 +244,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -287,7 +287,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj index dded999a7b3..b80d98ab73d 100644 --- a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj @@ -255,7 +255,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -302,7 +302,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 0397cdfc726..86e14111f10 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1254,7 +1254,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -1593,7 +1593,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -1640,7 +1640,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -1682,7 +1682,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index d1a756e1852..d93b6c70395 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -228,7 +228,7 @@ class BuildExt(build_ext.build_ext): """ try: # TODO(lidiz) Remove the generated a.out for success tests. - cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], + cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++14', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index fa001849ba0..0518372efee 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -268,12 +268,12 @@ set(CMAKE_C_STANDARD 99) endif() - # Add c++11 flags + # Add c++14 flags if (NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD 14) else() - if (CMAKE_CXX_STANDARD LESS 11) - message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 11, please specify at least SET(CMAKE_CXX_STANDARD 11)") + if (CMAKE_CXX_STANDARD LESS 14) + message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 14, please specify at least SET(CMAKE_CXX_STANDARD 14)") endif() endif() if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) diff --git a/templates/Makefile.template b/templates/Makefile.template index 335fd47f638..4d470cc2731 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -196,7 +196,7 @@ TMPOUT = `mktemp /tmp/test-out-XXXXXX` endif - CHECK_NO_CXX14_COMPAT_WORKS_CMD = $(CC) -std=c++11 -Werror -Wno-c++14-compat -o $(TMPOUT) -c test/build/no-c++14-compat.cc + CHECK_NO_CXX14_COMPAT_WORKS_CMD = $(CC) -std=c++14 -Werror -Wno-c++14-compat -o $(TMPOUT) -c test/build/no-c++14-compat.cc HAS_WORKING_NO_CXX14_COMPAT = $(shell $(CHECK_NO_CXX14_COMPAT_WORKS_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_WORKING_NO_CXX14_COMPAT),true) W_NO_CXX14_COMPAT=-Wno-c++14-compat @@ -222,7 +222,7 @@ HOST_LDXX ?= $(LDXX) CFLAGS += -std=c99 ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)} - CXXFLAGS += -std=c++11 + CXXFLAGS += -std=c++14 ifeq ($(SYSTEM),Darwin) CXXFLAGS += -stdlib=libc++ LDFLAGS += -framework CoreFoundation diff --git a/templates/config.m4.template b/templates/config.m4.template index 2618fb8e7fa..0f7447c33d5 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -21,7 +21,7 @@ LIBS="-lpthread $LIBS" CFLAGS="-std=c11 -g -O2" - CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2" + CXXFLAGS="-std=c++14 -fno-exceptions -fno-rtti -g -O2" GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD" PHP_REQUIRE_CXX() PHP_ADD_LIBRARY(pthread) diff --git a/templates/grpc.gyp.template b/templates/grpc.gyp.template index 3437c178c3b..b35507d6abd 100644 --- a/templates/grpc.gyp.template +++ b/templates/grpc.gyp.template @@ -67,7 +67,7 @@ ], 'cflags_cc': [ '-Werror', - '-std=c++11', + '-std=c++14', ], 'include_dirs': [ '.', @@ -129,7 +129,7 @@ '${item}', % endfor '-stdlib=libc++', - '-std=c++11', + '-std=c++14', '-Wno-error=deprecated-declarations', ], % endif diff --git a/test/cpp/ios/Tests.xcodeproj/project.pbxproj b/test/cpp/ios/Tests.xcodeproj/project.pbxproj index 71ad3a1dcb2..0708457384e 100644 --- a/test/cpp/ios/Tests.xcodeproj/project.pbxproj +++ b/test/cpp/ios/Tests.xcodeproj/project.pbxproj @@ -243,7 +243,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -441,7 +441,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -485,7 +485,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -527,7 +527,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/tools/bazel.rc b/tools/bazel.rc index 5312865afe3..9bc87274f97 100644 --- a/tools/bazel.rc +++ b/tools/bazel.rc @@ -2,6 +2,7 @@ build --client_env=CC=clang build --copt=-DGRPC_BAZEL_BUILD +build --cxxopt='-std=c++14' build --action_env=GRPC_BAZEL_RUNTIME=1 build --define=use_fast_cpp_protos=true diff --git a/tools/distrib/gen_compilation_database.py b/tools/distrib/gen_compilation_database.py index 88f9538e532..5cda6d69e35 100755 --- a/tools/distrib/gen_compilation_database.py +++ b/tools/distrib/gen_compilation_database.py @@ -85,10 +85,10 @@ def isCompileTarget(target, args): def modifyCompileCommand(target, args): cc, options = target["command"].split(" ", 1) - # Workaround for bazel added C++11 options, those doesn't affect build itself but + # Workaround for bazel added C++14 options, those doesn't affect build itself but # clang-tidy will misinterpret them. options = options.replace("-std=c++0x ", "") - options = options.replace("-std=c++11 ", "") + options = options.replace("-std=c++14 ", "") if args.vscode: # Visual Studio Code doesn't seem to like "-iquote". Replace it with @@ -103,8 +103,8 @@ def modifyCompileCommand(target, args): options += " -Wno-pragma-once-outside-header -Wno-unused-const-variable" options += " -Wno-unused-function" if not target["file"].startswith("external/"): - # *.h file is treated as C header by default while our headers files are all C++11. - options = "-x c++ -std=c++11 -fexceptions " + options + # *.h file is treated as C header by default while our headers files are all C++14. + options = "-x c++ -std=c++14 -fexceptions " + options target["command"] = " ".join([cc, options]) return target diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index ed43a663a3f..cc53e79f2f1 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -88,7 +88,7 @@ def check_linker_need_libatomic(): code_test = (b'#include \n' + b'int main() { return std::atomic{}; }') cxx = os.environ.get('CXX', 'c++') - cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'], + cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++14', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -98,7 +98,7 @@ def check_linker_need_libatomic(): # Double-check to see if -latomic actually can solve the problem. # https://github.com/grpc/grpc/issues/22491 cpp_test = subprocess.Popen( - [cxx, '-x', 'c++', '-std=c++11', '-', '-latomic'], + [cxx, '-x', 'c++', '-std=c++14', '-', '-latomic'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -134,7 +134,7 @@ class BuildExt(build_ext.build_ext): EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None) EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) if EXTRA_ENV_COMPILE_ARGS is None: - EXTRA_ENV_COMPILE_ARGS = '-std=c++11' + EXTRA_ENV_COMPILE_ARGS = '-std=c++14' if 'win32' in sys.platform: if sys.version_info < (3, 5): # We use define flags here and don't directly add to DEFINE_MACROS below to diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 048fe25c96d..2f91787d97f 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -378,7 +378,7 @@ class ProtocArtifact: environ=environ) else: environ[ - 'CXXFLAGS'] += ' -std=c++11 -stdlib=libc++ %s' % _MACOS_COMPAT_FLAG + 'CXXFLAGS'] += ' -std=c++14 -stdlib=libc++ %s' % _MACOS_COMPAT_FLAG return create_jobspec( self.name, ['tools/run_tests/artifacts/build_artifact_protoc.sh'],