FreeBSD Bugzilla – Attachment 242793 Details for
Bug 272013
www/node16: fix build with clang 16
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
www/node16: fix build with clang 16
www__node16-fix-clang16-build-1.diff (text/plain), 6.70 KB, created by
Dimitry Andric
on 2023-06-15 16:26:20 UTC
(
hide
)
Description:
www/node16: fix build with clang 16
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2023-06-15 16:26:20 UTC
Size:
6.70 KB
patch
obsolete
>commit da028f2aec1b437ebb8d8a0f4a812e01c8885e56 >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2023-06-13 13:52:37 +0200 > > www/node16: fix build with clang 16 > > Clang 16 has a new error about integer values being outside the valid > range for enum types, which shows up when building www/node16: > > ../deps/v8/src/base/bit-field.h:43:29: error: integer value 7 is outside the valid range of values [0, 3] for this enumeration type [-Wenum-constexpr-conversion] > static constexpr T kMax = static_cast<T>(kNumValues - 1); > ^ > > Upstream fixed most of these errors in > <https://chromium.googlesource.com/v8/v8.git/+/d15d49b09d>, so add a > backported version of it, with a few additions, to fix them. > >diff --git a/www/node16/files/patch-commit-d15d49b09dc b/www/node16/files/patch-commit-d15d49b09dc >new file mode 100644 >index 000000000000..c161cb32e724 >--- /dev/null >+++ b/www/node16/files/patch-commit-d15d49b09dc >@@ -0,0 +1,128 @@ >+commit d15d49b09dc7aef9edcc4cf6a0cb2b77a0db203f >+Author: Nico Weber <thakis@chromium.org> >+Date: 2022-07-29 20:07:40 -0400 >+ >+ Make bitfields only as wide as necessary for enums >+ >+ clang now complains when a BitField for an enum is too wide. >+ We could suppress this, but it seems kind of useful from an >+ uninformed distance, so I made a few bitfields smaller instead. >+ >+ (For AddressingMode, since its size is target-dependent, I added >+ an explicit underlying type to the enum instead, which suppresses >+ the diag on a per-enum basis.) >+ >+ This is without any understanding of the code I'm touching. >+ Especially the change in v8-internal.h feels a bit risky to me. >+ >+ Bug: chromium:1348574 >+ Change-Id: I73395de593045036b72dadf4e3147b5f7e13c958 >+ Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3794708 >+ Commit-Queue: Nico Weber <thakis@chromium.org> >+ Reviewed-by: Leszek Swirski <leszeks@chromium.org> >+ Reviewed-by: Hannes Payer <hpayer@chromium.org> >+ Auto-Submit: Nico Weber <thakis@chromium.org> >+ Cr-Commit-Position: refs/heads/main@{#82109} >+ >+--- deps/v8/include/v8-internal.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/include/v8-internal.h >+@@ -253,7 +253,7 @@ class Internals { >+ >+ static const int kNodeClassIdOffset = 1 * kApiSystemPointerSize; >+ static const int kNodeFlagsOffset = 1 * kApiSystemPointerSize + 3; >+- static const int kNodeStateMask = 0x7; >++ static const int kNodeStateMask = 0x3; >+ static const int kNodeStateIsWeakValue = 2; >+ static const int kNodeStateIsPendingValue = 3; >+ >+--- deps/v8/src/ast/ast.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/ast/ast.h >+@@ -998,7 +998,7 @@ class Literal final : public Expression { >+ friend class AstNodeFactory; >+ friend Zone; >+ >+- using TypeField = Expression::NextBitField<Type, 4>; >++ using TypeField = Expression::NextBitField<Type, 3>; >+ >+ Literal(int smi, int position) : Expression(position, kLiteral), smi_(smi) { >+ bit_field_ = TypeField::update(bit_field_, kSmi); >+--- deps/v8/src/base/bit-field.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/base/bit-field.h >+@@ -40,6 +40,11 @@ class BitField final { >+ static constexpr U kNumValues = U{1} << kSize; >+ >+ // Value for the field with all bits set. >++ // If clang complains >++ // "constexpr variable 'kMax' must be initialized by a constant expression" >++ // on this line, then you're creating a BitField for an enum with more bits >++ // than needed for the enum values. Either reduce the BitField size, >++ // or give the enum an explicit underlying type. >+ static constexpr T kMax = static_cast<T>(kNumValues - 1); >+ >+ template <class T2, int size2> >+--- deps/v8/src/compiler/backend/instruction-codes.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/compiler/backend/instruction-codes.h >+@@ -191,7 +191,7 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostrea >+ V(None) \ >+ TARGET_ADDRESSING_MODE_LIST(V) >+ >+-enum AddressingMode { >++enum AddressingMode : uint8_t { >+ #define DECLARE_ADDRESSING_MODE(Name) kMode_##Name, >+ ADDRESSING_MODE_LIST(DECLARE_ADDRESSING_MODE) >+ #undef DECLARE_ADDRESSING_MODE >+@@ -282,7 +282,7 @@ using LaneSizeField = base::BitField<int, 22, 8>; >+ // LaneSizeField and AccessModeField are helper types to encode/decode a lane >+ // size, an access mode, or both inside the overlapping MiscField. >+ using LaneSizeField = base::BitField<int, 22, 8>; >+-using AccessModeField = base::BitField<MemoryAccessMode, 30, 2>; >++using AccessModeField = base::BitField<MemoryAccessMode, 30, 1>; >+ using MiscField = base::BitField<int, 22, 10>; >+ >+ } // namespace compiler >+--- deps/v8/src/compiler/backend/instruction.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/compiler/backend/instruction.h >+@@ -584,8 +584,8 @@ class LocationOperand : public InstructionOperand { >+ } >+ >+ STATIC_ASSERT(KindField::kSize == 3); >+- using LocationKindField = base::BitField64<LocationKind, 3, 2>; >+- using RepresentationField = base::BitField64<MachineRepresentation, 5, 8>; >++ using LocationKindField = base::BitField64<LocationKind, 3, 1>; >++ using RepresentationField = LocationKindField::Next<MachineRepresentation, 8>; >+ using IndexField = base::BitField64<int32_t, 35, 29>; >+ }; >+ >+--- deps/v8/src/handles/global-handles.cc.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/handles/global-handles.cc >+@@ -618,7 +618,7 @@ class GlobalHandles::Node final : public NodeBase<Glob >+ >+ // This stores three flags (independent, partially_dependent and >+ // in_young_list) and a State. >+- using NodeState = base::BitField8<State, 0, 3>; >++ using NodeState = base::BitField8<State, 0, 2>; >+ using IsInYoungList = NodeState::Next<bool, 1>; >+ using NodeWeaknessType = IsInYoungList::Next<WeaknessType, 2>; >+ >+--- deps/v8/src/profiler/profile-generator.h.orig 2023-03-28 23:14:19 UTC >++++ deps/v8/src/profiler/profile-generator.h >+@@ -224,7 +224,7 @@ class CodeEntry { >+ return ref_count_; >+ } >+ >+- using TagField = base::BitField<CodeEventListener::LogEventsAndTags, 0, 8>; >++ using TagField = base::BitField<CodeEventListener::LogEventsAndTags, 0, 5>; >+ using BuiltinField = base::BitField<Builtin, 8, 20>; >+ static_assert(Builtins::kBuiltinCount <= BuiltinField::kNumValues, >+ "builtin_count exceeds size of bitfield"); >+--- deps/v8/src/wasm/wasm-code-manager.h.orig 2023-03-28 21:14:19 UTC >++++ deps/v8/src/wasm/wasm-code-manager.h >+@@ -440,7 +440,7 @@ class V8_EXPORT_PRIVATE WasmCode final { >+ int trap_handler_index_ = -1; >+ >+ // Bits encoded in {flags_}: >+- using KindField = base::BitField8<Kind, 0, 3>; >++ using KindField = base::BitField8<Kind, 0, 2>; >+ using ExecutionTierField = KindField::Next<ExecutionTier, 2>; >+ using ForDebuggingField = ExecutionTierField::Next<ForDebugging, 2>; >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 272013
: 242793