A RetroSearch Logo

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

Search Query:

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

Remove fast-path check for non-clang compilers in MessageCreator. (#2… · protocolbuffers/protobuf@69cca9b · 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

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

119 119

func_(func) {}

120 120 121 121

// Template for testing.

122 -

template <bool test_call = false, typename MessageLite>

122 +

template <typename MessageLite>

123 123

MessageLite* New(const MessageLite* prototype_for_func,

124 124

const MessageLite* prototype_for_copy, Arena* arena) const;

125 125 126 -

template <bool test_call = false, typename MessageLite>

126 +

template <typename MessageLite>

127 127

MessageLite* PlacementNew(const MessageLite* prototype_for_func,

128 128

const MessageLite* prototype_for_copy, void* mem,

129 129

Arena* arena) const;

@@ -1187,19 +1187,15 @@ inline void AssertDownCast(const MessageLite& from, const MessageLite& to) {

1187 1187

<< "Cannot downcast " << from.GetTypeName() << " to " << to.GetTypeName();

1188 1188

}

1189 1189 1190 -

template <bool test_call, typename MessageLite>

1190 +

template <typename MessageLite>

1191 1191

PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew(

1192 1192

const MessageLite* prototype_for_func,

1193 1193

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

1194 1194

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

1195 1195

const Tag as_tag = tag();

1196 -

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

1197 -

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

1198 -

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

1199 -

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

1200 1196

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

1201 1197

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

1202 -

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

1198 +

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

1203 1199

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

1204 1200

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

1205 1201

}

@@ -1293,15 +1289,15 @@ PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::PlacementNew(

1293 1289

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

1294 1290

}

1295 1291 1296 -

template <bool test_call, typename MessageLite>

1292 +

template <typename MessageLite>

1297 1293

PROTOBUF_ALWAYS_INLINE inline MessageLite* MessageCreator::New(

1298 1294

const MessageLite* prototype_for_func,

1299 1295

const MessageLite* prototype_for_copy, Arena* arena) const {

1300 -

return PlacementNew<test_call>(prototype_for_func, prototype_for_copy,

1301 -

arena != nullptr

1302 -

? arena->AllocateAligned(allocation_size_)

1303 -

: ::operator new(allocation_size_),

1304 -

arena);

1296 +

return PlacementNew(prototype_for_func, prototype_for_copy,

1297 +

arena != nullptr

1298 +

? arena->AllocateAligned(allocation_size_)

1299 +

: ::operator new(allocation_size_),

1300 +

arena);

1305 1301

}

1306 1302 1307 1303

} // namespace internal

Original file line number Diff line number Diff line change

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

384 384

}

385 385 386 386

#if defined(PROTOBUF_CUSTOM_VTABLE)

387 -

constexpr bool EnableCustomNew() { return true; }

388 387

template <typename T>

389 388

constexpr bool EnableCustomNewFor() {

390 389

return true;

391 390

}

392 391

#elif ABSL_HAVE_BUILTIN(__is_bitwise_cloneable)

393 -

constexpr bool EnableCustomNew() { return true; }

394 392

template <typename T>

395 393

constexpr bool EnableCustomNewFor() {

396 394

return __is_bitwise_cloneable(T);

397 395

}

398 396

#else

399 -

constexpr bool EnableCustomNew() { return false; }

400 397

template <typename T>

401 398

constexpr bool EnableCustomNewFor() {

402 399

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