Remove anon namespaces (not needed with visibility=hidden)

This commit is contained in:
2024-01-22 13:15:09 -08:00
parent be712796f2
commit bcc9195cdb

View File

@@ -93,7 +93,6 @@ Arena::Arena(int initialSize) : impl(nullptr) {
}
}
namespace {
void onDestroy(Arena::ArenaImpl *impl) {
while (impl) {
auto *prev = impl->prev;
@@ -101,7 +100,6 @@ void onDestroy(Arena::ArenaImpl *impl) {
impl = prev;
}
}
} // namespace
Arena::Arena(Arena &&other) noexcept
: impl(std::exchange(other.impl, nullptr)) {}
@@ -429,6 +427,36 @@ uint32_t Arbitrary::bounded(uint32_t s) {
// ==================== END ARBITRARY IMPL ====================
// ==================== BEGIN UTILITIES IMPL ====================
// Call Stepwise::step for each element of remaining until it returns true.
// Applies a permutation to `remaining` as a side effect.
template <class Stepwise> void runInterleaved(std::span<Stepwise> remaining) {
while (remaining.size() > 0) {
for (int i = 0; i < int(remaining.size());) {
bool done = remaining[i].step();
if (done) {
if (i != int(remaining.size()) - 1) {
using std::swap;
swap(remaining[i], remaining.back());
}
remaining = remaining.subspan(0, remaining.size() - 1);
} else {
++i;
}
}
}
};
template <class Stepwise> void runSequential(std::span<Stepwise> remaining) {
for (auto &r : remaining) {
while (!r.step()) {
}
}
}
// ==================== END UTILITIES IMPL ====================
#define SHOW_PRIORITY 0
#define DEBUG 0
@@ -440,7 +468,6 @@ static auto operator<=>(const Key &lhs, const Key &rhs) {
return c != 0 ? c <=> 0 : lhs.len <=> rhs.len;
}
namespace {
// A node in the tree representing write conflict history. This tree maintains
// several invariants:
@@ -519,32 +546,6 @@ struct Iterator {
int cmp;
};
// Call Stepwise::step for each element of remaining until it returns true.
// Applies a permutation to `remaining` as a side effect.
template <class Stepwise> void runInterleaved(std::span<Stepwise> remaining) {
while (remaining.size() > 0) {
for (int i = 0; i < int(remaining.size());) {
bool done = remaining[i].step();
if (done) {
if (i != int(remaining.size()) - 1) {
using std::swap;
swap(remaining[i], remaining.back());
}
remaining = remaining.subspan(0, remaining.size() - 1);
} else {
++i;
}
}
}
};
template <class Stepwise> void runSequential(std::span<Stepwise> remaining) {
for (auto &r : remaining) {
while (!r.step()) {
}
}
}
struct StepwiseLastLeq {
Node *current;
Node *result;
@@ -878,8 +879,6 @@ bool checkCorrectness(Node *node, ReferenceImpl &refImpl) {
return success;
}
} // namespace
struct __attribute__((__visibility__("hidden"))) ConflictSet::Impl {
Random rand;
Node *root;
@@ -1134,7 +1133,6 @@ namespace std {
void __throw_length_error(const char *) { __builtin_unreachable(); }
} // namespace std
namespace {
struct ReferenceImpl {
explicit ReferenceImpl(int64_t oldestVersion) : oldestVersion(oldestVersion) {
writeVersionMap[""] = oldestVersion;
@@ -1201,7 +1199,6 @@ struct ReferenceImpl {
int64_t oldestVersion;
std::map<std::string, int64_t> writeVersionMap;
};
} // namespace
#ifdef ENABLE_TESTS
int main(void) {