Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http, utility: Fix unicode URL parsing #12324

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 40 additions & 13 deletions bazel/external/googleurl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# clang-cl. Tracked in https://github.com/envoyproxy/envoy/issues/11974.

diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 2962537..6193b56 100644
index 0cd36dc..8c4cbd4 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -7,10 +7,6 @@
Expand All @@ -16,7 +16,21 @@ index 2962537..6193b56 100644
// Annotate a variable indicating it's ok if the variable is not used.
// (Typically used to silence a compiler warning when the assignment
// is important for some other reason.)
@@ -212,7 +208,9 @@
@@ -55,8 +51,12 @@
// prevent code folding, see gurl_base::debug::Alias.
// Use like:
// void NOT_TAIL_CALLED FooBar();
-#if defined(__clang__) && __has_attribute(not_tail_called)
+#if defined(__clang__)
+#if defined(__has_attribute)
+#if __has_attribute(not_tail_called)
#define NOT_TAIL_CALLED __attribute__((not_tail_called))
+#endif
+#endif
#else
#define NOT_TAIL_CALLED
#endif
@@ -226,7 +226,9 @@
#endif
#endif

Expand All @@ -27,7 +41,7 @@ index 2962537..6193b56 100644
// Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for
// the specified variable.
// Library-wide alternative is
@@ -243,6 +241,8 @@
@@ -257,6 +259,8 @@
// E.g. platform, bot, benchmark or test name in patch description or next to
// the attribute.
#define STACK_UNINITIALIZED __attribute__((uninitialized))
Expand All @@ -37,10 +51,10 @@ index 2962537..6193b56 100644
#define STACK_UNINITIALIZED
#endif
diff --git a/base/strings/BUILD b/base/strings/BUILD
index 7a06170..7c86a5f 100644
index 604cc81..87fe7ce 100644
--- a/base/strings/BUILD
+++ b/base/strings/BUILD
@@ -6,23 +6,21 @@ load("//:build_config.bzl", "build_config")
@@ -6,13 +6,12 @@ load("//build_config:build_config.bzl", "build_config")
cc_library(
name = "strings",
srcs = [
Expand All @@ -55,9 +69,10 @@ index 7a06170..7c86a5f 100644
hdrs = [
"char_traits.h",
"string16.h",
"string_piece.h",
@@ -20,10 +19,9 @@ cc_library(
"string_piece_forward.h",
"string_util.h",
"string_util_internal.h",
- "string_util_posix.h",
"utf_string_conversion_utils.h",
"utf_string_conversions.h",
Expand All @@ -66,11 +81,11 @@ index 7a06170..7c86a5f 100644
copts = build_config.default_copts,
visibility = ["//visibility:public"],
deps = [
diff --git a/build_config.bzl b/build_config.bzl
index d5fca65..fc0d7e5 100644
diff --git a/build_config/build_config.bzl b/build_config/build_config.bzl
index d5fca65..0d6cc11 100644
--- a/build_config/build_config.bzl
+++ b/build_config/build_config.bzl
@@ -1,8 +1,25 @@
@@ -1,8 +1,28 @@
-_default_copts = [
- "-std=c++14",
- "-fno-strict-aliasing",
Expand All @@ -94,17 +109,29 @@ index d5fca65..fc0d7e5 100644
+ "@envoy//bazel:windows_x86_64": ["string_util_win.h"],
+ "//conditions:default": ["string_util_posix.h"],
+})
+
+_icuuc_deps = ["@org_unicode_icuuc//:common"]

build_config = struct(
default_copts = _default_copts,
+ strings_srcs = _strings_srcs,
+ strings_hdrs = _strings_hdrs,
+ icuuc_deps = _icuuc_deps,
)
diff --git a/url/BUILD b/url/BUILD
index 0126bdc..5d1a171 100644
index e9081d9..9d5929f 100644
--- a/url/BUILD
+++ b/url/BUILD
@@ -43,11 +43,11 @@ cc_library(
@@ -1,6 +1,8 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+load("@rules_cc//cc:defs.bzl", "cc_library")
+
load("//build_config:build_config.bzl", "build_config")

cc_library(
@@ -43,11 +45,10 @@ cc_library(
"url_util.h",
],
copts = build_config.default_copts,
Expand All @@ -114,6 +141,6 @@ index 0126bdc..5d1a171 100644
"//base",
"//base/strings",
"//polyfills",
+ "@org_unicode_icuuc//:common",
],
- ],
+ ] + build_config.icuuc_deps
)
34 changes: 22 additions & 12 deletions bazel/external/icuuc.BUILD → bazel/external/icu/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
licenses(["notice"]) # Apache 2

exports_files([
"icu4c/LICENSE",
"icu4j/main/shared/licenses/LICENSE",
"LICENSE",
])

icuuc_copts = [
Expand All @@ -31,29 +30,40 @@ icuuc_copts = [

cc_library(
name = "headers",
hdrs = glob(["icu4c/source/common/unicode/*.h"]),
includes = ["icu4c/source/common"],
hdrs = glob([
"source/common/unicode/*.h",
]),
includes = ["source/common"],
visibility = ["//visibility:public"],
)

cc_library(
name = "common",
hdrs = glob(["icu4c/source/common/unicode/*.h"]),
includes = ["icu4c/source/common"],
hdrs = glob(["source/common/unicode/*.h"]),
includes = ["source/common"],
visibility = ["//visibility:public"],
deps = [":icuuc"],
deps = [
":data",
":icuuc",
],
)

cc_library(
name = "icuuc",
srcs = glob([
"icu4c/source/common/*.c",
"icu4c/source/common/*.cpp",
"icu4c/source/stubdata/*.cpp",
"source/common/**/*.c",
"source/common/**/*.cpp",
"source/stubdata/*.cpp",
]),
hdrs = glob(["icu4c/source/common/*.h"]),
hdrs = glob(["source/common/*.h"]),
copts = icuuc_copts,
tags = ["requires-rtti"],
visibility = ["//visibility:private"],
deps = [":headers"],
)

cc_library(
name = "data",
srcs = ["@envoy//bazel/external/icu/data:generated"],
deps = [":headers"],
alwayslink = 1,
)
13 changes: 13 additions & 0 deletions bazel/external/icu/data/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package(
default_visibility = ["//visibility:public"],
)

licenses(["notice"]) # Apache 2.0

exports_files(["LICENSE"])

# Currently, the ICU data is manually generated using tools/icu/generate_data.sh.
filegroup(
name = "generated",
srcs = ["data.c"],
)
Loading