A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/protocolbuffers/protobuf/commit/aa5410dd95b9bceeca78e308481a46032ae79cd9 below:

Remove fast-path check for non-clang compilers in MessageCreator. · protocolbuffers/protobuf@aa5410d · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+10

-17

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+10

-17

lines changed Original file line number Diff line number Diff line change

@@ -128,11 +128,11 @@ class MessageCreator {

128 128

func_(func) {}

129 129 130 130

// Template for testing.

131 -

template <bool test_call = false, typename MessageLite>

131 +

template <typename MessageLite>

132 132

MessageLite* New(const MessageLite* prototype_for_func,

133 133

const MessageLite* prototype_for_copy, Arena* arena) const;

134 134 135 -

template <bool test_call = false, typename MessageLite>

135 +

template <typename MessageLite>

136 136

MessageLite* PlacementNew(const MessageLite* prototype_for_func,

137 137

const MessageLite* prototype_for_copy, void* mem,

138 138

Arena* arena) const;

@@ -1244,19 +1244,15 @@ T* OnShutdownDelete(T* p) {

1244 1244

return p;

1245 1245

}

1246 1246 1247 -

template <bool test_call, typename MessageLite>

1247 +

template <typename MessageLite>

1248 1248

PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::PlacementNew(

1249 1249

const MessageLite* prototype_for_func,

1250 1250

const MessageLite* prototype_for_copy, void* mem, Arena* arena) const {

1251 1251

ABSL_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) % alignment_, 0u);

1252 1252

const Tag as_tag = tag();

1253 -

// When the feature is not enabled we skip the `as_tag` check since it is

1254 -

// unnecessary. Except for testing, where we want to test the copy logic even

1255 -

// when we can't use it for real messages.

1256 -

constexpr bool kMustBeFunc = !test_call && !internal::EnableCustomNew();

1257 1253

static_assert(kFunc < 0 && !(kZeroInit < 0) && !(kMemcpy < 0),

1258 1254

"Only kFunc must be the only negative value");

1259 -

if (ABSL_PREDICT_FALSE(kMustBeFunc || (int8_t)as_tag < 0)) {

1255 +

if (ABSL_PREDICT_FALSE(static_cast<int8_t>(as_tag) < 0)) {

1260 1256

PROTOBUF_DEBUG_COUNTER("MessageCreator.Func").Inc();

1261 1257

return static_cast<MessageLite*>(func_(prototype_for_func, mem, arena));

1262 1258

}

@@ -1345,15 +1341,15 @@ PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::PlacementNew(

1345 1341

return Launder(reinterpret_cast<MessageLite*>(mem));

1346 1342

}

1347 1343 1348 -

template <bool test_call, typename MessageLite>

1344 +

template <typename MessageLite>

1349 1345

PROTOBUF_ALWAYS_INLINE MessageLite* MessageCreator::New(

1350 1346

const MessageLite* prototype_for_func,

1351 1347

const MessageLite* prototype_for_copy, Arena* arena) const {

1352 -

return PlacementNew<test_call>(prototype_for_func, prototype_for_copy,

1353 -

arena != nullptr

1354 -

? arena->AllocateAligned(allocation_size_)

1355 -

: ::operator new(allocation_size_),

1356 -

arena);

1348 +

return PlacementNew(prototype_for_func, prototype_for_copy,

1349 +

arena != nullptr

1350 +

? arena->AllocateAligned(allocation_size_)

1351 +

: ::operator new(allocation_size_),

1352 +

arena);

1357 1353

}

1358 1354 1359 1355

} // namespace internal

Original file line number Diff line number Diff line change

@@ -454,19 +454,16 @@ constexpr T* Launder(T* p) {

454 454

}

455 455 456 456

#if defined(PROTOBUF_CUSTOM_VTABLE)

457 -

constexpr bool EnableCustomNew() { return true; }

458 457

template <typename T>

459 458

constexpr bool EnableCustomNewFor() {

460 459

return true;

461 460

}

462 461

#elif ABSL_HAVE_BUILTIN(__is_bitwise_cloneable)

463 -

constexpr bool EnableCustomNew() { return true; }

464 462

template <typename T>

465 463

constexpr bool EnableCustomNewFor() {

466 464

return __is_bitwise_cloneable(T);

467 465

}

468 466

#else

469 -

constexpr bool EnableCustomNew() { return false; }

470 467

template <typename T>

471 468

constexpr bool EnableCustomNewFor() {

472 469

return false;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4