NuxiNL / flower

Label-based networking daemon
Other
22 stars 1 forks source link

Compiler warnings #3

Open mcandre opened 5 years ago

mcandre commented 5 years ago

Clang appears to emit some warnings about the flower source code:

$ cmake .
$ make
...
[ 31%] Linking CXX static library libflower_switchboard_lib.a
[ 31%] Built target flower_switchboard_lib
Scanning dependencies of target gtest_main
[ 34%] Building CXX object contrib/googletest-release-1.8.0/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[ 36%] Linking CXX static library libgtest_main.a
[ 36%] Built target gtest_main
Scanning dependencies of target flower_unittests
[ 38%] Building CXX object CMakeFiles/flower_unittests.dir/flower/switchboard/handle_test.cc.o
In file included from /flower/flower/switchboard/handle_test.cc:18:0:
/flower/flower/switchboard/worker_pool.h:19:7: warning: 'flower::switchboard::WorkerPool' has a field 'flower::switchboard::WorkerPool::logger_' whose type uses the anonymous namespace [-Wsubobject-linkage]
 class WorkerPool {
       ^~~~~~~~~~

Using Clang v4.0, on Ubuntu Bionic Beaver.

EdSchouten commented 5 years ago

I suspect that we need to do something like this:

diff --git a/flower/util/logger.h b/flower/util/logger.h
index ac153f7..15bc75f 100644
--- a/flower/util/logger.h
+++ b/flower/util/logger.h
@@ -13,7 +13,6 @@

 namespace flower {
 namespace util {
-namespace {

 // Log entry that is in the process of being written. This class
 // serializes output to the stream and also ensures all entries have a
@@ -51,7 +50,6 @@ class Logger {
   std::streambuf* streambuf_;
 };

-}  // namespace
 }  // namespace util
 }  // namespace flower

Can you confirm that this fixed the warning you're seeing?