diff --git a/.bazelrc b/.bazelrc index 71f457fb5e4a5..bc65a8355b8ed 100644 --- a/.bazelrc +++ b/.bazelrc @@ -22,6 +22,7 @@ build --enable_platform_specific_config # Enable position independent code, this option is not supported on Windows and default on on macOS. build:linux --copt=-fPIC +build:linux --cxxopt=-std=c++17 # We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace. build --define absl=1 @@ -65,6 +66,7 @@ build:clang-asan --config=asan build:clang-asan --linkopt -fuse-ld=lld # macOS ASAN/UBSAN +build:macos --cxxopt=-std=c++17 build:macos-asan --config=asan # Workaround, see https://github.com/bazelbuild/bazel/issues/6932 build:macos-asan --copt -Wno-macro-redefined @@ -263,6 +265,7 @@ build:windows --define manual_stamp=manual_stamp build:windows --copt="-DCARES_STATICLIB" build:windows --copt="-DNGHTTP2_STATICLIB" build:windows --copt="-DCURL_STATICLIB" +build:windows --cxxopt="/std:c++17" # Required to work around build defects on Windows MSVC cl # Unguarded gcc pragmas in quiche are not recognized by MSVC diff --git a/bazel/envoy_internal.bzl b/bazel/envoy_internal.bzl index 6c9d125e199ee..07dad501e5a40 100644 --- a/bazel/envoy_internal.bzl +++ b/bazel/envoy_internal.bzl @@ -14,7 +14,6 @@ def envoy_copts(repository, test = False): "-Wformat", "-Wformat-security", "-Wvla", - "-std=c++14", ] # Windows options for cleanest service compilation; @@ -25,7 +24,6 @@ def envoy_copts(repository, test = False): msvc_options = [ "-WX", "-Zc:__cplusplus", - "-std:c++14", "-DWIN32", "-D_WIN32_WINNT=0x0A00", # _WIN32_WINNT_WIN10 "-DNTDDI_VERSION=0x0A000000", # NTDDI_WIN10 @@ -34,6 +32,9 @@ def envoy_copts(repository, test = False): "-DNOMCX", "-DNOIME", "-DNOCRYPT", + # this is to silence the incorrect MSVC compiler warning when trying to convert between + # std::optional data types while conversions between primitive types are producing no error + "-wd4244", ] return select({ diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 40b6ed7d33e71..3453074b7fdb2 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -425,10 +425,10 @@ DEPENDENCY_REPOSITORIES = dict( cpe = "N/A", ), com_google_cel_cpp = dict( - sha256 = "1b283f93619b130504880d2f400bd449de9ab6be94ef26ecd2bb96921f48dd6c", - strip_prefix = "cel-cpp-50196761917300bbd47b59bd162e84817b67b7ab", - # 2020-06-08 - urls = ["https://github.com/google/cel-cpp/archive/50196761917300bbd47b59bd162e84817b67b7ab.tar.gz"], + sha256 = "cad7d01139947d78e413d112cb8f7431fbb33cf66b0adf9c280824803fc2a72e", + strip_prefix = "cel-cpp-b9453a09b28a1531c4917e8792b3ea61f6b1a447", + # 2020-07-14 + urls = ["https://github.com/google/cel-cpp/archive/b9453a09b28a1531c4917e8792b3ea61f6b1a447.tar.gz"], use_category = ["dataplane"], cpe = "N/A", ), diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 55718a63b00f7..d13c7be545bdd 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -220,6 +220,7 @@ elif [[ "$CI_TARGET" == "bazel.compile_time_options" ]]; then --define quiche=enabled \ --define path_normalization_by_default=true \ --define deprecated_features=disabled \ + --define --cxxopt=-std=c++14 \ " ENVOY_STDLIB="${ENVOY_STDLIB:-libstdc++}" setup_clang_toolchain diff --git a/source/extensions/filters/http/cache/http_cache_utils.cc b/source/extensions/filters/http/cache/http_cache_utils.cc index 43dd624d8563f..b93ed5f2f3a77 100644 --- a/source/extensions/filters/http/cache/http_cache_utils.cc +++ b/source/extensions/filters/http/cache/http_cache_utils.cc @@ -89,7 +89,7 @@ SystemTime::duration HttpCacheUtils::eatLeadingDuration(absl::string_view& s) { if (digits_length == 0) { return SystemTime::duration::zero(); } - const absl::string_view digits(s.begin(), digits_length); + const absl::string_view digits(s.data(), digits_length); s.remove_prefix(digits_length); uint64_t num; return absl::SimpleAtoi(digits, &num) ? std::chrono::seconds(num) : SystemTime::duration::max(); diff --git a/test/common/json/json_loader_test.cc b/test/common/json/json_loader_test.cc index 1201a3668d104..884caf5b0d0c1 100644 --- a/test/common/json/json_loader_test.cc +++ b/test/common/json/json_loader_test.cc @@ -198,7 +198,7 @@ TEST_F(JsonLoaderTest, Basic) { { ObjectSharedPtr json = Factory::loadFromString("{}"); - EXPECT_THROW(json->getObjectArray("hello").empty(), Exception); + EXPECT_THROW((void)json->getObjectArray("hello").empty(), Exception); } { diff --git a/test/extensions/filters/network/kafka/serialization_test.cc b/test/extensions/filters/network/kafka/serialization_test.cc index 3d8a5af14e53b..2cc656926d645 100644 --- a/test/extensions/filters/network/kafka/serialization_test.cc +++ b/test/extensions/filters/network/kafka/serialization_test.cc @@ -323,7 +323,8 @@ TEST(NullableBytesDeserializer, ShouldDeserialize) { } TEST(NullableBytesDeserializer, ShouldDeserializeEmptyBytes) { - const NullableBytes value{{}}; + // gcc refuses to initialize optional with empty vector with value{{}} + const NullableBytes value = {{}}; serializeThenDeserializeAndCheckEquality(value); } diff --git a/tools/clang_tools/support/clang_tools.bzl b/tools/clang_tools/support/clang_tools.bzl index 949903aaff055..398b80330b663 100644 --- a/tools/clang_tools/support/clang_tools.bzl +++ b/tools/clang_tools/support/clang_tools.bzl @@ -1,7 +1,6 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test") _clang_tools_copts = [ - "-std=c++14", "-fno-exceptions", "-fno-rtti", ]