|
| 1 | +# TODO(dio): Consider to remove compiler specific part of this patch when we solely compile the |
| 2 | +# project using clang-cl. Tracked in https://github.com/envoyproxy/envoy/issues/11974. |
| 3 | + |
| 4 | +diff --git a/base/compiler_specific.h b/base/compiler_specific.h |
| 5 | +index 0174b6d..fb5b80d 100644 |
| 6 | +--- a/base/compiler_specific.h |
| 7 | ++++ b/base/compiler_specific.h |
| 8 | +@@ -7,10 +7,6 @@ |
| 9 | + |
| 10 | + #include "build/build_config.h" |
| 11 | + |
| 12 | +-#if defined(COMPILER_MSVC) && !defined(__clang__) |
| 13 | +-#error "Only clang-cl is supported on Windows, see https://crbug.com/988071" |
| 14 | +-#endif |
| 15 | +- |
| 16 | + // This is a wrapper around `__has_cpp_attribute`, which can be used to test for |
| 17 | + // the presence of an attribute. In case the compiler does not support this |
| 18 | + // macro it will simply evaluate to 0. |
| 19 | +@@ -398,7 +394,7 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) { |
| 20 | + #define CONSTINIT |
| 21 | + #endif |
| 22 | + |
| 23 | +-#if defined(__clang__) |
| 24 | ++#if defined(__clang__) && HAS_CPP_ATTRIBUTE(gsl::Pointer) |
| 25 | + #define GSL_OWNER [[gsl::Owner]] |
| 26 | + #define GSL_POINTER [[gsl::Pointer]] |
| 27 | + #else |
| 28 | +diff --git a/base/containers/checked_iterators.h b/base/containers/checked_iterators.h |
| 29 | +index dc8d2ba..9306697 100644 |
| 30 | +--- a/base/containers/checked_iterators.h |
| 31 | ++++ b/base/containers/checked_iterators.h |
| 32 | +@@ -237,9 +237,32 @@ using CheckedContiguousConstIterator = CheckedContiguousIterator<const T>; |
| 33 | + // [3] https://wg21.link/pointer.traits.optmem |
| 34 | +-namespace std { |
| 35 | + |
| 36 | ++#ifdef SUPPORTS_CPP_17_CONTIGUOUS_ITERATOR |
| 37 | ++#if defined(_LIBCPP_VERSION) |
| 38 | ++ |
| 39 | ++// TODO(crbug.com/1284275): Remove when C++20 is on by default, as the use |
| 40 | ++// of `iterator_concept` above should suffice. |
| 41 | ++_LIBCPP_BEGIN_NAMESPACE_STD |
| 42 | ++ |
| 43 | ++// TODO(crbug.com/1449299): https://reviews.llvm.org/D150801 renamed this from |
| 44 | ++// `__is_cpp17_contiguous_iterator` to `__libcpp_is_contiguous_iterator`. Clean |
| 45 | ++// up the old spelling after libc++ rolls. |
| 46 | ++template <typename T> |
| 47 | ++struct __is_cpp17_contiguous_iterator; |
| 48 | + template <typename T> |
| 49 | + struct __is_cpp17_contiguous_iterator<::gurl_base::CheckedContiguousIterator<T>> |
| 50 | + : true_type {}; |
| 51 | ++template <typename T> |
| 52 | ++struct __libcpp_is_contiguous_iterator; |
| 53 | ++template <typename T> |
| 54 | ++struct __libcpp_is_contiguous_iterator<::gurl_base::CheckedContiguousIterator<T>> |
| 55 | ++ : true_type {}; |
| 56 | ++ |
| 57 | ++_LIBCPP_END_NAMESPACE_STD |
| 58 | ++ |
| 59 | ++#endif |
| 60 | ++#endif |
| 61 | ++ |
| 62 | ++namespace std { |
| 63 | + |
| 64 | + template <typename T> |
| 65 | + struct pointer_traits<::gurl_base::CheckedContiguousIterator<T>> { |
| 66 | + |
| 67 | +# TODO(keith): Remove unused parameter workarounds when https://quiche-review.googlesource.com/c/googleurl/+/11180 lands |
| 68 | + |
| 69 | +diff --git a/base/numerics/clamped_math_impl.h b/base/numerics/clamped_math_impl.h |
| 70 | +index 10023f0..783f5da 100644 |
| 71 | +--- a/base/numerics/clamped_math_impl.h |
| 72 | ++++ b/base/numerics/clamped_math_impl.h |
| 73 | +@@ -36,6 +36,7 @@ template <typename T, |
| 74 | + typename std::enable_if<std::is_integral<T>::value && |
| 75 | + !std::is_signed<T>::value>::type* = nullptr> |
| 76 | + constexpr T SaturatedNegWrapper(T value) { |
| 77 | ++ (void)value; // unused |
| 78 | + return T(0); |
| 79 | + } |
| 80 | + |
| 81 | +diff --git a/base/numerics/safe_conversions.h b/base/numerics/safe_conversions.h |
| 82 | +index 4a9494e..ba44fa0 100644 |
| 83 | +--- a/base/numerics/safe_conversions.h |
| 84 | ++++ b/base/numerics/safe_conversions.h |
| 85 | +@@ -45,6 +45,7 @@ template <typename Dst, typename Src, typename Enable = void> |
| 86 | + struct IsValueInRangeFastOp { |
| 87 | + static constexpr bool is_supported = false; |
| 88 | + static constexpr bool Do(Src value) { |
| 89 | ++ (void)value; // unused |
| 90 | + // Force a compile failure if instantiated. |
| 91 | + return CheckOnFailure::template HandleFailure<bool>(); |
| 92 | + } |
| 93 | +@@ -164,6 +165,7 @@ template <typename Dst, typename Src, typename Enable = void> |
| 94 | + struct SaturateFastOp { |
| 95 | + static constexpr bool is_supported = false; |
| 96 | + static constexpr Dst Do(Src value) { |
| 97 | ++ (void)value; // unused |
| 98 | + // Force a compile failure if instantiated. |
| 99 | + return CheckOnFailure::template HandleFailure<Dst>(); |
| 100 | + } |
| 101 | +diff --git a/base/containers/span.h b/base/containers/span.h |
| 102 | +index 40e325f..c66c183 100644 |
| 103 | +--- a/base/containers/span.h |
| 104 | ++++ b/base/containers/span.h |
| 105 | +@@ -125,7 +125,7 @@ using EnableIfSpanCompatibleContainerAndSpanIsDynamic = |
| 106 | + template <size_t Extent> |
| 107 | + class ExtentStorage { |
| 108 | + public: |
| 109 | +- constexpr explicit ExtentStorage(size_t size) noexcept {} |
| 110 | ++ constexpr explicit ExtentStorage(size_t /*size*/) noexcept {} |
| 111 | + constexpr size_t size() const noexcept { return Extent; } |
| 112 | + }; |
| 113 | + |
| 114 | +diff --git a/polyfills/third_party/perfetto/include/perfetto/tracing/traced_value.h b/polyfills/third_party/perfetto/include/perfetto/tracing/traced_value.h |
| 115 | +index 6d059f7..6339fa5 100644 |
| 116 | +--- a/polyfills/third_party/perfetto/include/perfetto/tracing/traced_value.h |
| 117 | ++++ b/polyfills/third_party/perfetto/include/perfetto/tracing/traced_value.h |
| 118 | +@@ -13,7 +13,7 @@ class TracedValue { |
| 119 | + }; |
| 120 | + |
| 121 | + template <typename T> |
| 122 | +-void WriteIntoTracedValue(TracedValue context, T&& value) {} |
| 123 | ++void WriteIntoTracedValue(TracedValue /*context*/, T&& /*value*/) {} |
| 124 | + |
| 125 | + template <typename T, typename ResultType = void, class = void> |
| 126 | + struct check_traced_value_support { |
| 127 | +diff --git a/build_config/build_config.bzl b/build_config/build_config.bzl |
| 128 | +index 5960d2a..08295ff 100644 |
| 129 | +--- a/build_config/build_config.bzl |
| 130 | ++++ b/build_config/build_config.bzl |
| 131 | +@@ -7,6 +7,7 @@ _default_copts = select({ |
| 132 | + "//conditions:default": [ |
| 133 | + "-std=c++17", |
| 134 | + "-fno-strict-aliasing", |
| 135 | ++ "-Wno-unused-parameter", |
| 136 | + ], |
| 137 | + }) |
| 138 | + |
| 139 | +diff --git a/url/url_canon_internal.h b/url/url_canon_internal.h |
| 140 | +index 58ae144..467da0b 100644 |
| 141 | +--- a/url/url_canon_internal.h |
| 142 | ++++ b/url/url_canon_internal.h |
| 143 | +@@ -305,6 +305,7 @@ inline bool AppendUTF8EscapedChar(const char* str, |
| 144 | + // through it will point to the next character to be considered. On failure, |
| 145 | + // |*begin| will be unchanged. |
| 146 | + inline bool Is8BitChar(char c) { |
| 147 | ++ (void)c; // unused |
| 148 | + return true; // this case is specialized to avoid a warning |
| 149 | + } |
| 150 | + inline bool Is8BitChar(char16_t c) { |
| 151 | + |
| 152 | +# TODO(keith): Remove when https://quiche-review.googlesource.com/c/googleurl/+/11200 lands |
| 153 | + |
| 154 | +diff --git a/base/memory/raw_ptr_exclusion.h b/base/memory/raw_ptr_exclusion.h |
| 155 | +index f881c04..4e4f7df 100644 |
| 156 | +--- a/base/memory/raw_ptr_exclusion.h |
| 157 | ++++ b/base/memory/raw_ptr_exclusion.h |
| 158 | +@@ -8,7 +8,7 @@ |
| 159 | + #include "polyfills/base/allocator/buildflags.h" |
| 160 | + #include "build/build_config.h" |
| 161 | + |
| 162 | +-#if defined(OFFICIAL_BUILD) && !BUILDFLAG(FORCE_ENABLE_RAW_PTR_EXCLUSION) |
| 163 | ++#if !defined(__clang__) || (defined(OFFICIAL_BUILD) && !BUILDFLAG(FORCE_ENABLE_RAW_PTR_EXCLUSION)) |
| 164 | + // The annotation changed compiler output and increased binary size so disable |
| 165 | + // for official builds. |
| 166 | + // TODO(crbug.com/1320670): Remove when issue is resolved. |
| 167 | + |
| 168 | +# TODO(keith): Remove when https://quiche-review.googlesource.com/c/googleurl/+/11300/1 lands |
| 169 | + |
| 170 | +diff --git a/build_config/BUILD b/build_config/BUILD |
| 171 | +index 78ac01d..eeef238 100644 |
| 172 | +--- a/build_config/BUILD |
| 173 | ++++ b/build_config/BUILD |
| 174 | +@@ -5,11 +5,13 @@ |
| 175 | + config_setting( |
| 176 | + name = "windows_x86_64", |
| 177 | + values = {"cpu": "x64_windows"}, |
| 178 | ++ visibility = ["//visibility:public"], |
| 179 | + ) |
| 180 | + |
| 181 | + bool_flag( |
| 182 | + name = "system_icu", |
| 183 | + build_setting_default = True, |
| 184 | ++ visibility = ["//visibility:public"], |
| 185 | + ) |
| 186 | + |
| 187 | + config_setting( |
| 188 | +@@ -17,4 +19,5 @@ |
| 189 | + flag_values = { |
| 190 | + ":system_icu": "True", |
| 191 | + }, |
| 192 | ++ visibility = ["//visibility:public"], |
| 193 | + ) |
0 commit comments