Nest all namespaces
The compiler supports this now. We can type less going forward.
No functional changes.
Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I29d6fa4f9aacc0e381f1a7637294db0392466995
diff --git a/aos/util/bitpacking_test.cc b/aos/util/bitpacking_test.cc
index 087c719..0f534a1 100644
--- a/aos/util/bitpacking_test.cc
+++ b/aos/util/bitpacking_test.cc
@@ -5,8 +5,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace testing {
+namespace aos::testing {
// Tests MaskOnes with small arguments.
TEST(MaskOnesTest, Small) {
@@ -384,5 +383,4 @@
EXPECT_EQ(0.75f, (IntToFloatLinear<2>(-1.0f, 1.0f, 3)));
}
-} // namespace testing
-} // namespace aos
+} // namespace aos::testing
diff --git a/aos/util/file.cc b/aos/util/file.cc
index 973ab3c..ef958c6 100644
--- a/aos/util/file.cc
+++ b/aos/util/file.cc
@@ -15,8 +15,7 @@
#include "aos/scoped/scoped_fd.h"
-namespace aos {
-namespace util {
+namespace aos::util {
std::string ReadFileToStringOrDie(const std::string_view filename) {
std::optional<std::string> r = MaybeReadFileToString(filename);
@@ -283,5 +282,4 @@
<< ": Failed to write " << bytes.size() << " bytes.";
}
-} // namespace util
-} // namespace aos
+} // namespace aos::util
diff --git a/aos/util/file_test.cc b/aos/util/file_test.cc
index 905a2cd..b3f1e66 100644
--- a/aos/util/file_test.cc
+++ b/aos/util/file_test.cc
@@ -10,9 +10,7 @@
#include "aos/realtime.h"
#include "aos/testing/tmpdir.h"
-namespace aos {
-namespace util {
-namespace testing {
+namespace aos::util::testing {
using ::testing::ElementsAre;
@@ -144,6 +142,4 @@
EXPECT_EQ("", ReadFileToStringOrDie(test_file));
}
-} // namespace testing
-} // namespace util
-} // namespace aos
+} // namespace aos::util::testing
diff --git a/aos/util/math_test.cc b/aos/util/math_test.cc
index a243e53..df68f00 100644
--- a/aos/util/math_test.cc
+++ b/aos/util/math_test.cc
@@ -2,9 +2,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace math {
-namespace testing {
+namespace aos::math::testing {
bool AngleEqual(double a1, double a2) {
double diff = a1 - a2;
@@ -84,6 +82,4 @@
EXPECT_FALSE(PointsAreCCW<double>(c, b, a));
}
-} // namespace testing
-} // namespace math
-} // namespace aos
+} // namespace aos::math::testing
diff --git a/aos/util/options_test.cc b/aos/util/options_test.cc
index ee228cb..f560fe6 100644
--- a/aos/util/options_test.cc
+++ b/aos/util/options_test.cc
@@ -2,8 +2,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace testing {
+namespace aos::testing {
class OptionsTest : public ::testing::Test {
public:
@@ -52,5 +51,4 @@
EXPECT_FALSE(one_three.AllSet(kOne | kTwo | kThree | kFour));
}
-} // namespace testing
-} // namespace aos
+} // namespace aos::testing
diff --git a/aos/util/phased_loop.cc b/aos/util/phased_loop.cc
index 1f61775..476cc3f 100644
--- a/aos/util/phased_loop.cc
+++ b/aos/util/phased_loop.cc
@@ -2,8 +2,7 @@
#include "glog/logging.h"
-namespace aos {
-namespace time {
+namespace aos::time {
PhasedLoop::PhasedLoop(const monotonic_clock::duration interval,
const monotonic_clock::time_point monotonic_now,
@@ -79,5 +78,4 @@
return result;
}
-} // namespace time
-} // namespace aos
+} // namespace aos::time
diff --git a/aos/util/phased_loop_test.cc b/aos/util/phased_loop_test.cc
index cfe0107..af33567 100644
--- a/aos/util/phased_loop_test.cc
+++ b/aos/util/phased_loop_test.cc
@@ -5,9 +5,7 @@
#include "aos/time/time.h"
-namespace aos {
-namespace time {
-namespace testing {
+namespace aos::time::testing {
using ::std::chrono::milliseconds;
using ::std::chrono::nanoseconds;
@@ -304,6 +302,4 @@
EXPECT_EQ(4, loop.Iterate((last_time - kOffset) + (kInterval * 4)));
}
-} // namespace testing
-} // namespace time
-} // namespace aos
+} // namespace aos::time::testing
diff --git a/aos/util/scoped_pipe_test.cc b/aos/util/scoped_pipe_test.cc
index 0e024c2..80059f8 100644
--- a/aos/util/scoped_pipe_test.cc
+++ b/aos/util/scoped_pipe_test.cc
@@ -7,9 +7,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace util {
-namespace testing {
+namespace aos::util::testing {
// Tests using uint32_t read/write methods on the ScopedPipe objects.
TEST(ScopedPipeTest, IntegerPipe) {
@@ -67,6 +65,4 @@
ASSERT_NE(0, fcntl(pipe.read->fd(), F_GETFD) & FD_CLOEXEC);
}
-} // namespace testing
-} // namespace util
-} // namespace aos
+} // namespace aos::util::testing
diff --git a/aos/util/threaded_consumer_test.cc b/aos/util/threaded_consumer_test.cc
index 96375f0..36f3121 100644
--- a/aos/util/threaded_consumer_test.cc
+++ b/aos/util/threaded_consumer_test.cc
@@ -2,8 +2,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace util {
+namespace aos::util {
// We expect it to be able to pass through everything we submit and recieves it
// in the order that we submitted it. It should also be able to take in more
@@ -140,5 +139,4 @@
EXPECT_EQ(counter, 1);
}
-} // namespace util
-} // namespace aos
+} // namespace aos::util
diff --git a/aos/util/trapezoid_profile.cc b/aos/util/trapezoid_profile.cc
index e74110f..938ca75 100644
--- a/aos/util/trapezoid_profile.cc
+++ b/aos/util/trapezoid_profile.cc
@@ -4,8 +4,7 @@
using ::Eigen::Matrix;
-namespace aos {
-namespace util {
+namespace aos::util {
TrapezoidProfile::TrapezoidProfile(::std::chrono::nanoseconds delta_time)
: maximum_acceleration_(0), maximum_velocity_(0), timestep_(delta_time) {
@@ -118,5 +117,4 @@
deceleration_time_ = (goal_velocity - top_velocity) / deceleration_;
}
-} // namespace util
-} // namespace aos
+} // namespace aos::util
diff --git a/aos/util/trapezoid_profile_test.cc b/aos/util/trapezoid_profile_test.cc
index afd64ea..92b9996 100644
--- a/aos/util/trapezoid_profile_test.cc
+++ b/aos/util/trapezoid_profile_test.cc
@@ -3,9 +3,7 @@
#include "Eigen/Dense"
#include "gtest/gtest.h"
-namespace aos {
-namespace util {
-namespace testing {
+namespace aos::util::testing {
class TrapezoidProfileTest : public ::testing::Test {
public:
@@ -120,6 +118,4 @@
EXPECT_EQ(position()(0), 1.0);
}
-} // namespace testing
-} // namespace util
-} // namespace aos
+} // namespace aos::util::testing
diff --git a/aos/util/wrapping_counter.cc b/aos/util/wrapping_counter.cc
index f98d7e3..ead4781 100644
--- a/aos/util/wrapping_counter.cc
+++ b/aos/util/wrapping_counter.cc
@@ -1,7 +1,6 @@
#include "aos/util/wrapping_counter.h"
-namespace aos {
-namespace util {
+namespace aos::util {
WrappingCounter::WrappingCounter(int32_t initial_count)
: count_(initial_count), last_count_(0) {}
@@ -15,5 +14,4 @@
return count_;
}
-} // namespace util
-} // namespace aos
+} // namespace aos::util
diff --git a/aos/util/wrapping_counter_test.cc b/aos/util/wrapping_counter_test.cc
index 3ef503b..17605a0 100644
--- a/aos/util/wrapping_counter_test.cc
+++ b/aos/util/wrapping_counter_test.cc
@@ -4,9 +4,7 @@
#include "gtest/gtest.h"
-namespace aos {
-namespace util {
-namespace testing {
+namespace aos::util::testing {
TEST(WrappingCounterTest, Basic) {
WrappingCounter test_counter;
@@ -53,6 +51,4 @@
test_wrapping(0, 255);
}
-} // namespace testing
-} // namespace util
-} // namespace aos
+} // namespace aos::util::testing