Skip to content

Commit b7a37e2

Browse files
Remove dead code.
PiperOrigin-RevId: 588828678
1 parent 2b45018 commit b7a37e2

File tree

3 files changed

+0
-53
lines changed

3 files changed

+0
-53
lines changed

src/google/protobuf/map.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,18 +454,6 @@ size_t SpaceUsedInValues(const Map* map) {
454454
return size;
455455
}
456456

457-
// Multiply two numbers where overflow is expected.
458-
template <typename N>
459-
N MultiplyWithOverflow(N a, N b) {
460-
#if defined(PROTOBUF_HAS_BUILTIN_MUL_OVERFLOW)
461-
N res;
462-
(void)__builtin_mul_overflow(a, b, &res);
463-
return res;
464-
#else
465-
return a * b;
466-
#endif
467-
}
468-
469457
inline size_t SpaceUsedInValues(const void*) { return 0; }
470458

471459
class UntypedMapBase;

src/google/protobuf/port_def.inc

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@
6767
// - MSVC: https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-history
6868
// https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-history
6969

70-
// Portable fallback for Clang's __has_warning macro:
71-
#ifndef __has_warning
72-
#define __has_warning(x) 0
73-
#define PROTOBUF_has_warning_DEFINED_
74-
#endif
75-
7670
// Portable PROTOBUF_BUILTIN_BSWAPxx definitions
7771
// Code must check for availability, e.g.: `defined(PROTOBUF_BUILTIN_BSWAP32)`
7872
#ifdef PROTOBUF_BUILTIN_BSWAP16
@@ -94,11 +88,6 @@
9488
#define PROTOBUF_BUILTIN_BSWAP64(x) __builtin_bswap64(x)
9589
#endif
9690

97-
// Portable check for __builtin_mul_overflow.
98-
#if ABSL_HAVE_BUILTIN(__builtin_mul_overflow)
99-
#define PROTOBUF_HAS_BUILTIN_MUL_OVERFLOW 1
100-
#endif
101-
10291
// Portable check for gcc-style atomic built-ins
10392
#if ABSL_HAVE_BUILTIN(__atomic_load_n)
10493
#define PROTOBUF_BUILTIN_ATOMIC 1
@@ -512,11 +501,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
512501
#define PROTOBUF_ALIGNAS(byte_alignment) alignas(byte_alignment)
513502
#endif
514503

515-
#ifdef PROTOBUF_FINAL
516-
#error PROTOBUF_FINAL was previously defined
517-
#endif
518-
#define PROTOBUF_FINAL final
519-
520504
#ifdef PROTOBUF_THREAD_LOCAL
521505
#error PROTOBUF_THREAD_LOCAL was previously defined
522506
#endif
@@ -579,21 +563,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
579563
#define PROTOBUF_ATTRIBUTE_NO_DESTROY
580564
#endif
581565

582-
// Force clang to always emit complete debug info for a type.
583-
// Clang uses constructor homing to determine when to emit debug info for a
584-
// type. If the constructor of a type is never used, which can happen in some
585-
// cases where member variables are constructed in place for optimization
586-
// purposes (see b/208803175 for an example), the type will have incomplete
587-
// debug info unless this attribute is used.
588-
#ifdef PROTOBUF_ATTRIBUTE_STANDALONE_DEBUG
589-
#error PROTOBUF_ATTRIBUTE_STANDALONE_DEBUG was previously defined
590-
#endif
591-
#if ABSL_HAVE_CPP_ATTRIBUTE(clang::standalone_debug)
592-
#define PROTOBUF_ATTRIBUTE_STANDALONE_DEBUG [[clang::standalone_debug]]
593-
#else
594-
#define PROTOBUF_ATTRIBUTE_STANDALONE_DEBUG
595-
#endif
596-
597566
// Protobuf extensions and reflection require registration of the protos linked
598567
// in the binary. Not until everything is registered does the runtime have a
599568
// complete view on all protos. When code is using reflection or extensions
@@ -1070,10 +1039,3 @@ namespace internal {
10701039
#endif // !NDEBUG
10711040
#endif // has_builtin(__builtin_assume)
10721041

1073-
// We don't want code outside port_def doing complex testing, so
1074-
// remove our portable condition test macros to nudge folks away from
1075-
// using it themselves.
1076-
#ifdef PROTOBUF_has_warning_DEFINED_
1077-
# undef __has_warning
1078-
# undef PROTOBUF_has_warning_DEFINED_
1079-
#endif

src/google/protobuf/port_undef.inc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#undef PROTOBUF_BUILTIN_BSWAP16
2020
#undef PROTOBUF_BUILTIN_BSWAP32
2121
#undef PROTOBUF_BUILTIN_BSWAP64
22-
#undef PROTOBUF_HAS_BUILTIN_MUL_OVERFLOW
2322
#undef PROTOBUF_BUILTIN_ATOMIC
2423
#undef PROTOBUF_GNUC_MIN
2524
#undef PROTOBUF_CLANG_MIN
@@ -58,15 +57,13 @@
5857
#undef PROTOBUF_EXPORT_TEMPLATE_DECLARE
5958
#undef PROTOBUF_EXPORT_TEMPLATE_DEFINE
6059
#undef PROTOBUF_ALIGNAS
61-
#undef PROTOBUF_FINAL
6260
#undef PROTOBUF_THREAD_LOCAL
6361
#undef PROTOBUF_CONSTINIT
6462
#undef PROTOBUF_CONSTEXPR
6563
#undef PROTOBUF_CONSTINIT_DEFAULT_INSTANCES
6664
#undef PROTOBUF_ATTRIBUTE_WEAK
6765
#undef PROTOBUF_HAVE_ATTRIBUTE_WEAK
6866
#undef PROTOBUF_ATTRIBUTE_NO_DESTROY
69-
#undef PROTOBUF_ATTRIBUTE_STANDALONE_DEBUG
7067
#undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY1
7168
#undef PROTOBUF_ATTRIBUTE_INIT_PRIORITY2
7269
#undef PROTOBUF_PRAGMA_INIT_SEG

0 commit comments

Comments
 (0)