diff --git a/.bazelrc b/.bazelrc index b7bd7b87950cd..ec8e9a2bfbbb4 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 @@ -243,6 +245,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/cel-cpp.patch b/bazel/cel-cpp.patch new file mode 100644 index 0000000000000..4511503966a22 --- /dev/null +++ b/bazel/cel-cpp.patch @@ -0,0 +1,1360 @@ +diff --git a/base/BUILD b/base/BUILD +index 2ddce9f..f6c1d58 100644 +--- a/base/BUILD ++++ b/base/BUILD +@@ -13,7 +13,7 @@ cc_library( + "statusor.h", + "statusor_internals.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/base:core_headers", + "@com_google_absl//absl/meta:type_traits", +@@ -26,5 +26,5 @@ cc_library( + hdrs = [ + "status_macros.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + ) +diff --git a/common/BUILD b/common/BUILD +index d561461..a08de81 100644 +--- a/common/BUILD ++++ b/common/BUILD +@@ -12,7 +12,7 @@ cc_library( + hdrs = [ + "macros.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [], + ) + +@@ -21,7 +21,7 @@ cc_library( + hdrs = [ + "id.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//internal:cel_printer", + "//internal:handle", +@@ -35,7 +35,7 @@ cc_library( + hdrs = [ + "type.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//internal:handle", + "@com_google_absl//absl/memory", +@@ -51,7 +51,7 @@ cc_library( + hdrs = [ + "enum.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":type", + "//internal:cel_printer", +@@ -66,7 +66,7 @@ cc_library( + hdrs = [ + "error.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//internal:cel_printer", + "//internal:hash_util", +@@ -84,7 +84,7 @@ cc_library( + hdrs = [ + "unknown.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":id", + ":macros", +@@ -100,7 +100,7 @@ cc_library( + hdrs = [ + "parent_ref.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//internal:ref_countable", + "@com_google_absl//absl/types:optional", +@@ -115,7 +115,7 @@ cc_library( + hdrs = [ + "custom_object.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":value", + ], +@@ -129,7 +129,7 @@ cc_library( + hdrs = [ + "operators.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/strings", + "@com_google_absl//absl/types:optional", +@@ -145,7 +145,7 @@ cc_library( + hdrs = [ + "escaping.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", +@@ -156,7 +156,7 @@ cc_library( + cc_test( + name = "escaping_test", + srcs = ["escaping_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":escaping", + "@com_github_google_googletest//:gtest_main", +@@ -171,7 +171,7 @@ cc_library( + hdrs = [ + "value.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":enum", + ":error", +@@ -202,7 +202,7 @@ cc_library( + cc_test( + name = "value_test", + srcs = ["value_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":custom_object", + ":value", +@@ -226,7 +226,7 @@ cc_library( + hdrs = [ + "converters.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":parent_ref", + ":value", +@@ -239,7 +239,7 @@ cc_library( + cc_test( + name = "converters_test", + srcs = ["converters_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":converters", + ":value", +diff --git a/conformance/BUILD b/conformance/BUILD +index 2aacf82..0e680ba 100644 +--- a/conformance/BUILD ++++ b/conformance/BUILD +@@ -31,7 +31,7 @@ cc_binary( + name = "server", + testonly = 1, + srcs = ["server.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//base:statusor", + "//eval/eval:container_backed_list_impl", +diff --git a/eval/compiler/BUILD b/eval/compiler/BUILD +index 93eaf84..456eb73 100644 +--- a/eval/compiler/BUILD ++++ b/eval/compiler/BUILD +@@ -14,7 +14,7 @@ cc_library( + hdrs = [ + "flat_expr_builder.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":constant_folding", + "//base:status_macros", +@@ -45,7 +45,7 @@ cc_test( + srcs = [ + "flat_expr_builder_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":flat_expr_builder", + "//base:status_macros", +@@ -71,7 +71,7 @@ cc_test( + srcs = [ + "flat_expr_builder_comprehensions_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":flat_expr_builder", + "//base:status_macros", +@@ -100,7 +100,7 @@ cc_library( + hdrs = [ + "constant_folding.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/eval:const_value_step", + "//eval/eval:container_backed_list_impl", +@@ -119,7 +119,7 @@ cc_test( + srcs = [ + "constant_folding_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":constant_folding", + "//base:status_macros", +diff --git a/eval/eval/BUILD b/eval/eval/BUILD +index 36df103..537f82a 100644 +--- a/eval/eval/BUILD ++++ b/eval/eval/BUILD +@@ -14,7 +14,7 @@ cc_library( + hdrs = [ + "evaluator_core.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":attribute_trail", + ":unknowns_utility", +@@ -37,7 +37,7 @@ cc_library( + hdrs = [ + "expression_step_base.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + "//eval/public:activation", +@@ -57,7 +57,7 @@ cc_library( + hdrs = [ + "const_value_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -78,7 +78,7 @@ cc_library( + hdrs = [ + "container_access_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -99,7 +99,7 @@ cc_library( + hdrs = [ + "ident_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -119,7 +119,7 @@ cc_library( + hdrs = [ + "function_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":attribute_trail", + ":evaluator_core", +@@ -149,7 +149,7 @@ cc_library( + hdrs = [ + "field_access.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/public:cel_value", + "//internal:proto_util", +@@ -166,7 +166,7 @@ cc_library( + hdrs = [ + "container_backed_list_impl.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/public:cel_value", + "@com_google_absl//absl/strings", +@@ -182,7 +182,7 @@ cc_library( + hdrs = [ + "container_backed_map_impl.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/public:cel_value", + "@com_google_absl//absl/container:node_hash_map", +@@ -198,7 +198,7 @@ cc_library( + hdrs = [ + "field_backed_list_impl.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":field_access", + "//eval/public:cel_value", +@@ -214,7 +214,7 @@ cc_library( + hdrs = [ + "field_backed_map_impl.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":field_access", + "//eval/public:cel_value", +@@ -231,7 +231,7 @@ cc_library( + hdrs = [ + "select_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -252,7 +252,7 @@ cc_library( + hdrs = [ + "create_list_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_backed_list_impl", + ":evaluator_core", +@@ -273,7 +273,7 @@ cc_library( + hdrs = [ + "create_struct_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_backed_map_impl", + ":evaluator_core", +@@ -294,7 +294,7 @@ cc_library( + hdrs = [ + "jump_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -313,7 +313,7 @@ cc_library( + hdrs = [ + "logic_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -334,7 +334,7 @@ cc_library( + hdrs = [ + "comprehension_step.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_step_base", +@@ -353,7 +353,7 @@ cc_test( + srcs = [ + "evaluator_core_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + "//base:status_macros", +@@ -372,7 +372,7 @@ cc_test( + srcs = [ + "const_value_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":const_value_step", + ":evaluator_core", +@@ -388,7 +388,7 @@ cc_test( + srcs = [ + "container_access_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_access_step", + ":container_backed_list_impl", +@@ -409,7 +409,7 @@ cc_test( + srcs = [ + "ident_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":ident_step", +@@ -425,7 +425,7 @@ cc_test( + srcs = [ + "function_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":expression_build_warning", +@@ -451,7 +451,7 @@ cc_test( + srcs = [ + "container_backed_map_impl_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_backed_map_impl", + "//eval/public:cel_value", +@@ -466,7 +466,7 @@ cc_test( + srcs = [ + "field_backed_list_impl_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":field_backed_list_impl", +@@ -482,7 +482,7 @@ cc_test( + srcs = [ + "field_backed_map_impl_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":evaluator_core", + ":field_backed_map_impl", +@@ -498,7 +498,7 @@ cc_test( + srcs = [ + "logic_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":ident_step", + ":logic_step", +@@ -515,7 +515,7 @@ cc_test( + srcs = [ + "select_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_backed_map_impl", + ":ident_step", +@@ -536,7 +536,7 @@ cc_test( + srcs = [ + "create_list_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":const_value_step", + ":create_list_step", +@@ -556,7 +556,7 @@ cc_test( + srcs = [ + "create_struct_step_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":container_backed_list_impl", + ":container_backed_map_impl", +@@ -579,7 +579,7 @@ cc_library( + hdrs = [ + "expression_build_warning.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/status", + ], +@@ -591,7 +591,7 @@ cc_test( + srcs = [ + "expression_build_warning_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":expression_build_warning", + "@com_github_google_googletest//:gtest_main", +@@ -603,7 +603,7 @@ cc_library( + name = "attribute_trail", + srcs = ["attribute_trail.cc"], + hdrs = ["attribute_trail.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//base:statusor", + "//eval/public:activation", +@@ -624,7 +624,7 @@ cc_test( + srcs = [ + "attribute_trail_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":attribute_trail", + "//eval/public:cel_attribute", +@@ -638,7 +638,7 @@ cc_library( + name = "unknowns_utility", + srcs = ["unknowns_utility.cc"], + hdrs = ["unknowns_utility.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":attribute_trail", + "//base:statusor", +@@ -661,7 +661,7 @@ cc_test( + srcs = [ + "unknowns_utility_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":unknowns_utility", + "//eval/public:cel_attribute", +diff --git a/eval/public/BUILD b/eval/public/BUILD +index 54ccfb5..266f49e 100644 +--- a/eval/public/BUILD ++++ b/eval/public/BUILD +@@ -9,7 +9,7 @@ cc_library( + hdrs = [ + "cel_value_internal.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/types:variant", + ], +@@ -23,7 +23,7 @@ cc_library( + hdrs = [ + "cel_value.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value_internal", + "//base:statusor", +@@ -44,7 +44,7 @@ cc_library( + hdrs = [ + "cel_attribute.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + ":cel_value_internal", +@@ -61,7 +61,7 @@ cc_library( + hdrs = [ + "cel_value_producer.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + "@com_google_absl//absl/strings", +@@ -75,7 +75,7 @@ cc_library( + hdrs = [ + "unknown_attribute_set.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_attribute", + "@com_google_absl//absl/container:flat_hash_set", +@@ -90,7 +90,7 @@ cc_library( + hdrs = [ + "activation.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_attribute", + ":cel_function", +@@ -111,7 +111,7 @@ cc_library( + hdrs = [ + "activation_bind_helper.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + "//eval/eval:field_access", +@@ -129,7 +129,7 @@ cc_library( + hdrs = [ + "cel_function.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + "@com_google_absl//absl/types:span", +@@ -144,7 +144,7 @@ cc_library( + hdrs = [ + "cel_function_adapter.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_registry", +@@ -163,7 +163,7 @@ cc_library( + hdrs = [ + "cel_function_provider.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + ":cel_function", +@@ -175,7 +175,7 @@ cc_library( + hdrs = [ + "cel_builtins.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ], + ) +@@ -188,7 +188,7 @@ cc_library( + hdrs = [ + "builtin_func_registrar.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_builtins", + ":cel_function", +@@ -211,7 +211,7 @@ cc_library( + hdrs = [ + "extension_func_registrar.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_adapter", +@@ -227,7 +227,7 @@ cc_library( + hdrs = [ + "cel_expression.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + ":cel_function", +@@ -242,7 +242,7 @@ cc_library( + name = "source_position", + srcs = ["source_position.cc"], + hdrs = ["source_position.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto", + "@com_google_protobuf//:protobuf_lite", +@@ -254,7 +254,7 @@ cc_library( + hdrs = [ + "ast_visitor.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":source_position", + "@com_google_absl//absl/strings", +@@ -267,7 +267,7 @@ cc_library( + hdrs = [ + "ast_visitor_base.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":ast_visitor", + "@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto", +@@ -282,7 +282,7 @@ cc_library( + hdrs = [ + "ast_traverse.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":ast_visitor", + ":source_position", +@@ -296,7 +296,7 @@ cc_library( + hdrs = [ + "cel_options.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_protobuf//:protobuf", + ], +@@ -310,7 +310,7 @@ cc_library( + hdrs = [ + "cel_expr_builder_factory.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_expression", + ":cel_options", +@@ -326,7 +326,7 @@ cc_library( + hdrs = [ + "value_export_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + "@com_google_absl//absl/status", +@@ -339,7 +339,7 @@ cc_library( + name = "cel_function_registry", + srcs = ["cel_function_registry.cc"], + hdrs = ["cel_function_registry.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_provider", +@@ -356,7 +356,7 @@ cc_test( + srcs = [ + "cel_value_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + ":unknown_attribute_set", +@@ -374,7 +374,7 @@ cc_test( + srcs = [ + "cel_attribute_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_attribute", + ":cel_value", +@@ -390,7 +390,7 @@ cc_test( + srcs = [ + "activation_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + ":cel_function", +@@ -404,7 +404,7 @@ cc_test( + srcs = [ + "ast_traverse_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":ast_traverse", + "@com_github_google_googletest//:gtest_main", +@@ -417,7 +417,7 @@ cc_test( + srcs = [ + "activation_bind_helper_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + ":activation_bind_helper", +@@ -434,7 +434,7 @@ cc_test( + srcs = [ + "cel_function_provider_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_provider", +@@ -448,7 +448,7 @@ cc_test( + srcs = [ + "cel_function_registry_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_provider", +@@ -464,7 +464,7 @@ cc_test( + srcs = [ + "cel_function_adapter_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_function_adapter", +@@ -480,7 +480,7 @@ cc_test( + srcs = [ + "builtin_func_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":activation", + ":builtin_func_registrar", +@@ -501,7 +501,7 @@ cc_test( + srcs = [ + "extension_func_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":builtin_func_registrar", + ":cel_function_registry", +@@ -520,7 +520,7 @@ cc_test( + srcs = [ + "source_position_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":source_position", + "@com_github_google_googletest//:gtest_main", +@@ -534,7 +534,7 @@ cc_test( + srcs = [ + "unknown_attribute_set_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_attribute", + ":cel_value", +@@ -549,7 +549,7 @@ cc_test( + srcs = [ + "value_export_util_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + ":value_export_util", +@@ -568,7 +568,7 @@ cc_library( + name = "unknown_function_result_set", + srcs = ["unknown_function_result_set.cc"], + hdrs = ["unknown_function_result_set.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_options", +@@ -585,7 +585,7 @@ cc_test( + srcs = [ + "unknown_function_result_set_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_function", + ":cel_value", +@@ -602,7 +602,7 @@ cc_test( + cc_library( + name = "unknown_set", + hdrs = ["unknown_set.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":unknown_attribute_set", + ":unknown_function_result_set", +@@ -612,7 +612,7 @@ cc_library( + cc_test( + name = "unknown_set_test", + srcs = ["unknown_set_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_attribute", + ":unknown_attribute_set", +@@ -628,7 +628,7 @@ cc_library( + name = "set_util", + srcs = ["set_util.cc"], + hdrs = ["set_util.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = ["//eval/public:cel_value"], + ) + +@@ -638,7 +638,7 @@ cc_test( + srcs = [ + "set_util_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_value", + ":set_util", +diff --git a/eval/tests/BUILD b/eval/tests/BUILD +index ce8a808..ab52c89 100644 +--- a/eval/tests/BUILD ++++ b/eval/tests/BUILD +@@ -14,7 +14,7 @@ cc_test( + srcs = [ + "benchmark_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + tags = ["manual"], + deps = [ + ":request_context_cc_proto", +@@ -39,7 +39,7 @@ cc_test( + srcs = [ + "end_to_end_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//base:status_macros", + "//eval/public:activation", +@@ -60,7 +60,7 @@ cc_test( + srcs = [ + "unknowns_end_to_end_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//base:status_macros", + "//eval/public:activation", +@@ -94,7 +94,7 @@ cc_library( + name = "mock_cel_expression", + testonly = 1, + hdrs = ["mock_cel_expression.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/public:activation", + "//eval/public:cel_expression", +diff --git a/internal/BUILD b/internal/BUILD +index c6d2c7f..05e29f6 100644 +--- a/internal/BUILD ++++ b/internal/BUILD +@@ -13,7 +13,7 @@ cc_library( + hdrs = [ + "ref_countable.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":holder", + ":specialize", +@@ -23,7 +23,7 @@ cc_library( + cc_test( + name = "ref_countable_test", + srcs = ["ref_countable_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":ref_countable", + "//testutil:util", +@@ -37,7 +37,7 @@ cc_library( + hdrs = [ + "handle.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":hash_util", + ":specialize", +@@ -47,7 +47,7 @@ cc_library( + cc_test( + name = "handle_test", + srcs = ["handle_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":handle", + "@com_github_google_googletest//:gtest_main", +@@ -60,7 +60,7 @@ cc_library( + hdrs = [ + "holder.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":port", + ":specialize", +@@ -72,7 +72,7 @@ cc_library( + cc_test( + name = "holder_test", + srcs = ["holder_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":holder", + ":types", +@@ -90,7 +90,7 @@ cc_library( + hdrs = [ + "hash_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":port", + ":specialize", +@@ -107,7 +107,7 @@ cc_library( + hdrs = [ + "status_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_google_absl//absl/strings", + "@com_google_googleapis//google/rpc:code_cc_proto", +@@ -120,7 +120,7 @@ cc_library( + hdrs = [ + "visitor_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":specialize", + ":types", +@@ -133,7 +133,7 @@ cc_library( + cc_test( + name = "visitor_util_test", + srcs = ["visitor_util_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":adapter_util", + ":visitor_util", +@@ -149,7 +149,7 @@ cc_library( + hdrs = [ + "adapter_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":visitor_util", + ], +@@ -161,7 +161,7 @@ cc_library( + hdrs = [ + "cel_printer.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":specialize", + ":types", +@@ -175,7 +175,7 @@ cc_library( + cc_test( + name = "cel_printer_test", + srcs = ["cel_printer_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cel_printer", + "@com_github_google_googletest//:gtest_main", +@@ -186,7 +186,7 @@ cc_library( + name = "proto_util", + srcs = ["proto_util.cc"], + hdrs = ["proto_util.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":status_util", + "//common:macros", +@@ -202,7 +202,7 @@ cc_library( + name = "map_impl", + srcs = ["map_impl.cc"], + hdrs = ["map_impl.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":status_util", + "//common:macros", +@@ -214,7 +214,7 @@ cc_library( + cc_library( + name = "list_impl", + hdrs = ["list_impl.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":holder", + "//common:macros", +@@ -225,7 +225,7 @@ cc_library( + cc_library( + name = "value_internal", + hdrs = ["value_internal.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":adapter_util", + ":cast", +@@ -244,7 +244,7 @@ cc_library( + cc_test( + name = "value_internal_test", + srcs = ["value_internal_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":value_internal", + "//testutil:util", +@@ -257,19 +257,19 @@ cc_test( + cc_library( + name = "port", + hdrs = ["port.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + ) + + cc_library( + name = "specialize", + hdrs = ["specialize.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + ) + + cc_library( + name = "cast", + hdrs = ["cast.h"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":port", + ":specialize", +@@ -282,7 +282,7 @@ cc_library( + cc_test( + name = "cast_test", + srcs = ["cast_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":cast", + "@com_github_google_googletest//:gtest_main", +@@ -294,7 +294,7 @@ cc_library( + hdrs = [ + "types.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":port", + ":specialize", +@@ -306,7 +306,7 @@ cc_library( + cc_test( + name = "types_test", + srcs = ["types_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":types", + "@com_github_google_googletest//:gtest_main", +diff --git a/parser/BUILD b/parser/BUILD +index c8516a8..dfd1593 100644 +--- a/parser/BUILD ++++ b/parser/BUILD +@@ -21,7 +21,7 @@ cc_library( + ], + copts = [ + "-fexceptions", +- "-std=c++14", ++ "-std=c++17", + ], + deps = [ + ":cel_cc_parser", +@@ -45,7 +45,7 @@ cc_library( + ], + copts = [ + "-fexceptions", +- "-std=c++14", ++ "-std=c++17", + ], + deps = [ + ":source_factory", +@@ -67,7 +67,7 @@ cc_library( + ], + copts = [ + "-fexceptions", +- "-std=c++14", ++ "-std=c++17", + ], + deps = [ + ":cel_cc_parser", +@@ -94,7 +94,7 @@ cc_library( + ], + copts = [ + "-fexceptions", +- "-std=c++14", ++ "-std=c++17", + ], + deps = [ + ":cel_cc_parser", +@@ -111,7 +111,7 @@ cc_library( + cc_test( + name = "parser_test", + srcs = ["parser_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":parser", + ":source_factory", +diff --git a/protoutil/BUILD b/protoutil/BUILD +index 0df1757..6993c8f 100644 +--- a/protoutil/BUILD ++++ b/protoutil/BUILD +@@ -13,7 +13,7 @@ cc_library( + hdrs = [ + "type_registry.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//common:macros", + "//common:parent_ref", +@@ -30,7 +30,7 @@ cc_library( + cc_test( + name = "type_registry_test", + srcs = ["type_registry_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":type_registry", + "//common:value", +@@ -50,7 +50,7 @@ cc_library( + hdrs = [ + "converters.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":type_registry", + "//common:macros", +@@ -73,7 +73,7 @@ cc_library( + cc_test( + name = "converters_test", + srcs = ["converters_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + data = [ + "@com_google_cel_spec//testdata", + ], +diff --git a/testutil/BUILD b/testutil/BUILD +index 0bf8e50..7305225 100644 +--- a/testutil/BUILD ++++ b/testutil/BUILD +@@ -15,7 +15,7 @@ cc_library( + hdrs = [ + "test_data_util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//common:type", + "//common:value", +@@ -44,7 +44,7 @@ cc_library( + hdrs = [ + "test_data_io.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//internal:status_util", + "@com_github_google_googletest//:gtest_main", +@@ -69,7 +69,7 @@ cc_binary( + srcs = [ + "test_data_gen.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + ":test_data_io", + ":test_data_util", +@@ -87,7 +87,7 @@ cc_binary( + cc_test( + name = "test_data_test", + srcs = ["test_data_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + data = [ + "@com_google_cel_spec//testdata", + ], +@@ -105,7 +105,7 @@ cc_library( + hdrs = [ + "util.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "@com_github_google_googletest//:gtest_main", + "@com_google_protobuf//:protobuf", +diff --git a/tools/BUILD b/tools/BUILD +index 212207e..8a131bd 100644 +--- a/tools/BUILD ++++ b/tools/BUILD +@@ -17,7 +17,7 @@ cc_library( + hdrs = [ + "flatbuffers_backed_impl.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//eval/public:cel_value", + "@com_github_google_flatbuffers//:flatbuffers", +@@ -36,7 +36,7 @@ cc_library( + name = "flatbuffers_test_cc", + srcs = [":flatbuffers_test"], + hdrs = [":flatbuffers_test"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + features = ["-parse_headers"], + linkstatic = True, + deps = ["@com_github_google_flatbuffers//:runtime_cc"], +@@ -48,7 +48,7 @@ cc_test( + srcs = [ + "flatbuffers_backed_impl_test.cc", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + data = [ + ":flatbuffers_reflection_out", + ], +diff --git a/v1beta1/BUILD b/v1beta1/BUILD +index 41c64d6..2480b94 100644 +--- a/v1beta1/BUILD ++++ b/v1beta1/BUILD +@@ -15,7 +15,7 @@ cc_library( + hdrs = [ + "converters.h", + ], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + deps = [ + "//common:converters", + "//common:macros", +@@ -37,7 +37,7 @@ cc_library( + cc_test( + name = "converters_test", + srcs = ["converters_test.cc"], +- copts = ["-std=c++14"], ++ copts = ["-std=c++17"], + data = [ + "@com_google_cel_spec//testdata", + ], \ No newline at end of file diff --git a/bazel/envoy_internal.bzl b/bazel/envoy_internal.bzl index 1603523e575c1..b2c669b5cd1ed 100644 --- a/bazel/envoy_internal.bzl +++ b/bazel/envoy_internal.bzl @@ -14,7 +14,7 @@ def envoy_copts(repository, test = False): "-Wformat", "-Wformat-security", "-Wvla", - "-std=c++14", + "-std=c++17", ] # Windows options for cleanest service compilation; @@ -25,7 +25,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 +33,10 @@ 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", + "/std:c++17", ] return select({ diff --git a/bazel/external/quiche.patch b/bazel/external/quiche.patch new file mode 100644 index 0000000000000..60ce77a1173ad --- /dev/null +++ b/bazel/external/quiche.patch @@ -0,0 +1,16 @@ +--- a/spdy/core/spdy_alt_svc_wire_format.cc ++++ b/spdy/core/spdy_alt_svc_wire_format.cc +@@ -196,9 +196,11 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue( + // hq=":443";quic=51303338 + // ... will be stored in |versions| as 0x51303338. + uint32_t quic_version; ++ ++ + if (!SpdyHexDecodeToUInt32( +- quiche::QuicheStringPiece(parameter_value_begin, +- c - parameter_value_begin), ++ quiche::QuicheStringPiece(&*parameter_value_begin, ++ &*c - &*parameter_value_begin), + &quic_version) || + quic_version == 0) { + return false; \ No newline at end of file diff --git a/bazel/genrule_repository.bzl b/bazel/genrule_repository.bzl index 28f37adfe55c7..4cf8f86d8b334 100644 --- a/bazel/genrule_repository.bzl +++ b/bazel/genrule_repository.bzl @@ -9,7 +9,7 @@ def _genrule_repository(ctx): for ii, patch in enumerate(ctx.attr.patches): patch_input = "patch-input-%d.patch" % (ii,) ctx.symlink(patch, patch_input) - patch_result = ctx.execute(["patch", "-p0", "--input", patch_input]) + patch_result = ctx.execute(["patch", "-p1", "--input", patch_input]) if patch_result.return_code != 0: fail("Failed to apply patch %r: %s" % (patch, patch_result.stderr)) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index baf22ea109dd2..65ee95833cb51 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -371,7 +371,11 @@ def _net_zlib(): ) def _com_google_cel_cpp(): - _repository_impl("com_google_cel_cpp") + _repository_impl( + name = "com_google_cel_cpp", + patch_args = ["-p1"], + patches = ["@envoy//bazel:cel-cpp.patch"], + ) def _com_github_nghttp2_nghttp2(): location = _get_location("com_github_nghttp2_nghttp2") @@ -667,6 +671,7 @@ def _com_googlesource_quiche(): name = "com_googlesource_quiche", urls = location["urls"], sha256 = location["sha256"], + patches = ["@envoy//bazel/external:quiche.patch"], genrule_cmd_file = "@envoy//bazel/external:quiche.genrule_cmd", build_file = "@envoy//bazel/external:quiche.BUILD", ) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 7b1221ed82e0a..c82d4774348d0 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -224,6 +224,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/common/formatter/substitution_formatter.cc b/source/common/formatter/substitution_formatter.cc index 4400ca3f65100..aedc72ad87e17 100644 --- a/source/common/formatter/substitution_formatter.cc +++ b/source/common/formatter/substitution_formatter.cc @@ -424,7 +424,7 @@ class StreamInfoDurationFieldExtractor : public StreamInfoFormatter::FieldExtrac } private: - absl::optional extractMillis(const StreamInfo::StreamInfo& stream_info) const { + absl::optional extractMillis(const StreamInfo::StreamInfo& stream_info) const { const auto time = field_extractor_(stream_info); if (time) { return std::chrono::duration_cast(time.value()).count(); diff --git a/source/common/grpc/google_async_client_impl.h b/source/common/grpc/google_async_client_impl.h index f2dc3eded14dc..75229bd5905fb 100644 --- a/source/common/grpc/google_async_client_impl.h +++ b/source/common/grpc/google_async_client_impl.h @@ -255,7 +255,7 @@ class GoogleAsyncStreamImpl : public RawAsyncStream, // End-of-stream with no additional message. PendingMessage() = default; - const absl::optional buf_; + const absl::optional buf_{}; const bool end_stream_{true}; }; diff --git a/source/common/upstream/outlier_detection_impl.h b/source/common/upstream/outlier_detection_impl.h index ff42473f3cc05..c51cb134bfbf9 100644 --- a/source/common/upstream/outlier_detection_impl.h +++ b/source/common/upstream/outlier_detection_impl.h @@ -41,7 +41,7 @@ class DetectorHostMonitorNullImpl : public DetectorHostMonitor { double successRate(SuccessRateMonitorType) const override { return -1; } private: - const absl::optional time_; + const absl::optional time_{}; }; /** diff --git a/source/extensions/common/aws/credentials_provider.h b/source/extensions/common/aws/credentials_provider.h index ed6bb312561cc..7e1da55fb1828 100644 --- a/source/extensions/common/aws/credentials_provider.h +++ b/source/extensions/common/aws/credentials_provider.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "envoy/common/pure.h" 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/source/extensions/filters/http/grpc_http1_reverse_bridge/filter.cc b/source/extensions/filters/http/grpc_http1_reverse_bridge/filter.cc index 955bf64168298..faa6ae4650c68 100644 --- a/source/extensions/filters/http/grpc_http1_reverse_bridge/filter.cc +++ b/source/extensions/filters/http/grpc_http1_reverse_bridge/filter.cc @@ -137,7 +137,7 @@ Http::FilterHeadersStatus Filter::encodeHeaders(Http::ResponseHeaderMap& headers headers.setGrpcStatus(Envoy::Grpc::Status::WellKnownGrpcStatus::Unknown); headers.setStatus(enumToInt(Http::Code::OK)); - if (content_type != nullptr) { + if (!content_type.empty()) { headers.setContentType(content_type_); } 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", ] diff --git a/tools/type_whisperer/api_type_db.h b/tools/type_whisperer/api_type_db.h index d5ee2dc7a3241..cec5627588ea3 100644 --- a/tools/type_whisperer/api_type_db.h +++ b/tools/type_whisperer/api_type_db.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include "absl/strings/string_view.h"