Skip to content

Commit

Permalink
Remove ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
Browse files Browse the repository at this point in the history
which is longer needed with the C++17 floor

PiperOrigin-RevId: 729365281
Change-Id: Ife5e778ead193bb37150b9799099e92f53252cb4
  • Loading branch information
derekmauro authored and copybara-github committed Feb 21, 2025
1 parent 019273c commit feb3d27
Show file tree
Hide file tree
Showing 32 changed files with 0 additions and 292 deletions.
2 changes: 0 additions & 2 deletions CMake/AbseilDll.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ set(ABSL_INTERNAL_DLL_FILES
"log/initialize.cc"
"log/initialize.h"
"log/log.h"
"log/log_entry.cc"
"log/log_entry.h"
"log/log_sink.cc"
"log/log_sink.h"
Expand Down Expand Up @@ -285,7 +284,6 @@ set(ABSL_INTERNAL_DLL_FILES
"strings/cord.h"
"strings/cord_analysis.cc"
"strings/cord_analysis.h"
"strings/cord_buffer.cc"
"strings/cord_buffer.h"
"strings/escaping.cc"
"strings/escaping.h"
Expand Down
23 changes: 0 additions & 23 deletions absl/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,29 +821,6 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
#define ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1
#endif

// ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
//
// Prior to C++17, static constexpr variables defined in classes required a
// separate definition outside of the class body, for example:
//
// class Foo {
// static constexpr int kBar = 0;
// };
// constexpr int Foo::kBar;
//
// In C++17, these variables defined in classes are considered inline variables,
// and the extra declaration is redundant. Since some compilers warn on the
// extra declarations, ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL can be used
// conditionally ignore them:
//
// #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
// constexpr int Foo::kBar;
// #endif
#if defined(ABSL_INTERNAL_CPLUSPLUS_LANG) && \
ABSL_INTERNAL_CPLUSPLUS_LANG < 201703L
#define ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1
#endif

// `ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with
// RTTI support.
#ifdef ABSL_INTERNAL_HAS_RTTI
Expand Down
4 changes: 0 additions & 4 deletions absl/base/exception_safety_testing_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -705,10 +705,6 @@ struct BasicGuaranteeWithExtraContracts : public NonNegative {
static constexpr int kExceptionSentinel = 9999;
};

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr int BasicGuaranteeWithExtraContracts::kExceptionSentinel;
#endif

TEST(ExceptionCheckTest, BasicGuaranteeWithExtraContracts) {
auto tester_with_val =
tester.WithInitialValue(BasicGuaranteeWithExtraContracts{});
Expand Down
5 changes: 0 additions & 5 deletions absl/base/internal/cycleclock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ namespace base_internal {

#if ABSL_USE_UNSCALED_CYCLECLOCK

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr int32_t CycleClock::kShift;
constexpr double CycleClock::kFrequencyScale;
#endif

ABSL_CONST_INIT std::atomic<CycleClockSourceFunc>
CycleClock::cycle_clock_source_{nullptr};

Expand Down
5 changes: 0 additions & 5 deletions absl/base/internal/fast_type_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ struct FastTypeTag {
constexpr static char dummy_var = 0;
};

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
template <typename Type>
constexpr char FastTypeTag<Type>::dummy_var;
#endif

// FastTypeId<Type>() evaluates at compile/link-time to a unique pointer for the
// passed-in type. These are meant to be good match for keys into maps or
// straight up comparisons.
Expand Down
9 changes: 0 additions & 9 deletions absl/base/internal/spinlock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ void RegisterSpinLockProfiler(void (*fn)(const void *contendedlock,
submit_profile_data.Store(fn);
}

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
// Static member variable definitions.
constexpr uint32_t SpinLock::kSpinLockHeld;
constexpr uint32_t SpinLock::kSpinLockCooperative;
constexpr uint32_t SpinLock::kSpinLockDisabledScheduling;
constexpr uint32_t SpinLock::kSpinLockSleeper;
constexpr uint32_t SpinLock::kWaitTimeMask;
#endif

// Uncommon constructors.
SpinLock::SpinLock(base_internal::SchedulingMode mode)
: lockword_(IsCooperative(mode) ? kSpinLockCooperative : 0) {
Expand Down
9 changes: 0 additions & 9 deletions absl/container/fixed_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,6 @@ class ABSL_ATTRIBUTE_WARN_UNUSED FixedArray {
Storage storage_;
};

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
template <typename T, size_t N, typename A>
constexpr size_t FixedArray<T, N, A>::kInlineBytesDefault;

template <typename T, size_t N, typename A>
constexpr typename FixedArray<T, N, A>::size_type
FixedArray<T, N, A>::inline_elements;
#endif

template <typename T, size_t N, typename A>
void FixedArray<T, N, A>::NonEmptyInlinedStorage::AnnotateConstruct(
typename FixedArray<T, N, A>::size_type n) {
Expand Down
4 changes: 0 additions & 4 deletions absl/container/internal/hashtablez_sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ namespace absl {
ABSL_NAMESPACE_BEGIN
namespace container_internal {

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr int HashtablezInfo::kMaxStackDepth;
#endif

namespace {
ABSL_CONST_INIT std::atomic<bool> g_hashtablez_enabled{
false
Expand Down
4 changes: 0 additions & 4 deletions absl/container/internal/raw_hash_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ ABSL_CONST_INIT ABSL_DLL const ctrl_t kSooControl[17] = {
static_assert(NumControlBytes(SooCapacity()) <= 17,
"kSooControl capacity too small");

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr size_t Group::kWidth;
#endif

namespace {

// Returns "random" seed.
Expand Down
18 changes: 0 additions & 18 deletions absl/crc/internal/crc_x86_arm_combined.cc
Original file line number Diff line number Diff line change
Expand Up @@ -345,24 +345,6 @@ class CRC32AcceleratedX86ARMCombinedMultipleStreamsBase
static constexpr size_t kMaxStreams = 3;
};

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
alignas(16) constexpr uint64_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::k1k2[2];
alignas(16) constexpr uint64_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::k3k4[2];
alignas(16) constexpr uint64_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::k5k6[2];
alignas(16) constexpr uint64_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::k7k0[2];
alignas(16) constexpr uint64_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::kPoly[2];
alignas(16) constexpr uint32_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::kMask[4];
constexpr size_t
CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::kGroupsSmall;
constexpr size_t CRC32AcceleratedX86ARMCombinedMultipleStreamsBase::kMaxStreams;
#endif // ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL

template <size_t num_crc_streams, size_t num_pclmul_streams,
CutoffStrategy strategy>
class CRC32AcceleratedX86ARMCombinedMultipleStreams
Expand Down
4 changes: 0 additions & 4 deletions absl/hash/internal/hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ uint64_t MixingHashState::CombineLargeContiguousImpl64(

ABSL_CONST_INIT const void* const MixingHashState::kSeed = &kSeed;

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr uint64_t MixingHashState::kStaticRandomData[];
#endif

uint64_t MixingHashState::LowLevelHashImpl(const unsigned char* data,
size_t len) {
return LowLevelHashLenGt16(data, len, Seed(), &kStaticRandomData[0]);
Expand Down
1 change: 0 additions & 1 deletion absl/log/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ cc_library(

cc_library(
name = "log_entry",
srcs = ["log_entry.cc"],
hdrs = ["log_entry.h"],
copts = ABSL_DEFAULT_COPTS,
linkopts = ABSL_DEFAULT_LINKOPTS,
Expand Down
2 changes: 0 additions & 2 deletions absl/log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,6 @@ absl_cc_library(
absl_cc_library(
NAME
log_entry
SRCS
"log_entry.cc"
HDRS
"log_entry.h"
COPTS
Expand Down
41 changes: 0 additions & 41 deletions absl/log/log_entry.cc

This file was deleted.

52 changes: 0 additions & 52 deletions absl/numeric/int128.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,55 +342,3 @@ std::ostream& operator<<(std::ostream& os, int128 v) {

ABSL_NAMESPACE_END
} // namespace absl

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
namespace std {
constexpr bool numeric_limits<absl::uint128>::is_specialized;
constexpr bool numeric_limits<absl::uint128>::is_signed;
constexpr bool numeric_limits<absl::uint128>::is_integer;
constexpr bool numeric_limits<absl::uint128>::is_exact;
constexpr bool numeric_limits<absl::uint128>::has_infinity;
constexpr bool numeric_limits<absl::uint128>::has_quiet_NaN;
constexpr bool numeric_limits<absl::uint128>::has_signaling_NaN;
constexpr float_denorm_style numeric_limits<absl::uint128>::has_denorm;
constexpr bool numeric_limits<absl::uint128>::has_denorm_loss;
constexpr float_round_style numeric_limits<absl::uint128>::round_style;
constexpr bool numeric_limits<absl::uint128>::is_iec559;
constexpr bool numeric_limits<absl::uint128>::is_bounded;
constexpr bool numeric_limits<absl::uint128>::is_modulo;
constexpr int numeric_limits<absl::uint128>::digits;
constexpr int numeric_limits<absl::uint128>::digits10;
constexpr int numeric_limits<absl::uint128>::max_digits10;
constexpr int numeric_limits<absl::uint128>::radix;
constexpr int numeric_limits<absl::uint128>::min_exponent;
constexpr int numeric_limits<absl::uint128>::min_exponent10;
constexpr int numeric_limits<absl::uint128>::max_exponent;
constexpr int numeric_limits<absl::uint128>::max_exponent10;
constexpr bool numeric_limits<absl::uint128>::traps;
constexpr bool numeric_limits<absl::uint128>::tinyness_before;

constexpr bool numeric_limits<absl::int128>::is_specialized;
constexpr bool numeric_limits<absl::int128>::is_signed;
constexpr bool numeric_limits<absl::int128>::is_integer;
constexpr bool numeric_limits<absl::int128>::is_exact;
constexpr bool numeric_limits<absl::int128>::has_infinity;
constexpr bool numeric_limits<absl::int128>::has_quiet_NaN;
constexpr bool numeric_limits<absl::int128>::has_signaling_NaN;
constexpr float_denorm_style numeric_limits<absl::int128>::has_denorm;
constexpr bool numeric_limits<absl::int128>::has_denorm_loss;
constexpr float_round_style numeric_limits<absl::int128>::round_style;
constexpr bool numeric_limits<absl::int128>::is_iec559;
constexpr bool numeric_limits<absl::int128>::is_bounded;
constexpr bool numeric_limits<absl::int128>::is_modulo;
constexpr int numeric_limits<absl::int128>::digits;
constexpr int numeric_limits<absl::int128>::digits10;
constexpr int numeric_limits<absl::int128>::max_digits10;
constexpr int numeric_limits<absl::int128>::radix;
constexpr int numeric_limits<absl::int128>::min_exponent;
constexpr int numeric_limits<absl::int128>::min_exponent10;
constexpr int numeric_limits<absl::int128>::max_exponent;
constexpr int numeric_limits<absl::int128>::max_exponent10;
constexpr bool numeric_limits<absl::int128>::traps;
constexpr bool numeric_limits<absl::int128>::tinyness_before;
} // namespace std
#endif
4 changes: 0 additions & 4 deletions absl/status/status.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ absl::Nonnull<const std::string*> Status::EmptyString() {
return kEmpty.get();
}

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr const char Status::kMovedFromString[];
#endif

absl::Nonnull<const std::string*> Status::MovedFromString() {
static const absl::NoDestructor<std::string> kMovedFrom(kMovedFromString);
return kMovedFrom.get();
Expand Down
1 change: 0 additions & 1 deletion absl/strings/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ cc_library(
"cord.cc",
"cord_analysis.cc",
"cord_analysis.h",
"cord_buffer.cc",
],
hdrs = [
"cord.h",
Expand Down
1 change: 0 additions & 1 deletion absl/strings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,6 @@ absl_cc_library(
"cord.cc"
"cord_analysis.cc"
"cord_analysis.h"
"cord_buffer.cc"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
Expand Down
4 changes: 0 additions & 4 deletions absl/strings/cord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ static absl::Nonnull<CordRep*> CordRepFromString(std::string&& src) {
// --------------------------------------------------------------------
// Cord::InlineRep functions

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr unsigned char Cord::InlineRep::kMaxInline;
#endif

inline void Cord::InlineRep::set_data(absl::Nonnull<const char*> data,
size_t n) {
static_assert(kMaxInline == 15, "set_data is hard-coded for a length of 15");
Expand Down
30 changes: 0 additions & 30 deletions absl/strings/cord_buffer.cc

This file was deleted.

4 changes: 0 additions & 4 deletions absl/strings/internal/cord_rep_btree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ namespace absl {
ABSL_NAMESPACE_BEGIN
namespace cord_internal {

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr size_t CordRepBtree::kMaxCapacity;
#endif

namespace {

using NodeStack = CordRepBtree * [CordRepBtree::kMaxDepth];
Expand Down
4 changes: 0 additions & 4 deletions absl/strings/internal/cordz_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ namespace absl {
ABSL_NAMESPACE_BEGIN
namespace cord_internal {

#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr size_t CordzInfo::kMaxStackDepth;
#endif

ABSL_CONST_INIT CordzInfo::List CordzInfo::global_list_{absl::kConstInit};

namespace {
Expand Down
Loading

0 comments on commit feb3d27

Please sign in to comment.