[gwp_asan] Use anonymous namespace for test helper code (#157205)

Tests can be at top-level or inside an anonymous namespace,
doesn't matter.  But putting their helper code inside anonymous
namespaces both makes the code compatible with compiling using
-Wmissing-declarations and might let the compiler optimize the
test good a bit better.

GitOrigin-RevId: 1f39435567b35a6797d92cd9a24e503e6b0302fd
diff --git a/tests/compression.cpp b/tests/compression.cpp
index 2423c86..91b0977 100644
--- a/tests/compression.cpp
+++ b/tests/compression.cpp
@@ -11,6 +11,7 @@
 
 namespace gwp_asan {
 namespace compression {
+namespace {
 
 TEST(GwpAsanCompressionTest, SingleByteVarInt) {
   uint8_t Compressed[1];
@@ -263,5 +264,7 @@
   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 6u), 5u);
   EXPECT_EQ(pack(Uncompressed, 3u, Compressed, 3 * kBytesForLargestVarInt), 5u);
 }
+
+} // namespace
 } // namespace compression
 } // namespace gwp_asan
diff --git a/tests/slot_reuse.cpp b/tests/slot_reuse.cpp
index f2a77b0..010d29a 100644
--- a/tests/slot_reuse.cpp
+++ b/tests/slot_reuse.cpp
@@ -6,9 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include <set>
+
 #include "gwp_asan/tests/harness.h"
 
-#include <set>
+namespace {
 
 void singleByteGoodAllocDealloc(gwp_asan::GuardedPoolAllocator *GPA) {
   void *Ptr = GPA->allocate(1);
@@ -72,3 +74,5 @@
   InitNumSlots(kPoolSize);
   runNoReuseBeforeNecessary(&GPA, kPoolSize);
 }
+
+} // namespace
diff --git a/tests/thread_contention.cpp b/tests/thread_contention.cpp
index 26ccd8e..311d0c0 100644
--- a/tests/thread_contention.cpp
+++ b/tests/thread_contention.cpp
@@ -15,6 +15,8 @@
 #include <thread>
 #include <vector>
 
+namespace {
+
 void asyncTask(gwp_asan::GuardedPoolAllocator *GPA,
                std::atomic<bool> *StartingGun, unsigned NumIterations) {
   while (!*StartingGun) {
@@ -63,3 +65,5 @@
   InitNumSlots(NumThreads);
   runThreadContentionTest(NumThreads, NumIterations, &GPA);
 }
+
+} // namespace