Skip to content

Commit

Permalink
Add end-of-namespace comments.
Browse files Browse the repository at this point in the history
Generated by clang-tidy llvm-namespace-comment.
  • Loading branch information
chenshuo committed Oct 17, 2018
1 parent 231f503 commit c72cb54
Show file tree
Hide file tree
Showing 94 changed files with 187 additions and 158 deletions.
15 changes: 15 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Only run one check for now.
Checks: '-clang-analyzer-*,llvm-namespace-comment'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
User: chenshuo
CheckOptions:
- key: llvm-namespace-comment.ShortNamespaceLines
value: '10'
- key: llvm-namespace-comment.SpacesBeforeComments
value: '2'
...

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.swp
compile_commands.json
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")

set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

Expand Down Expand Up @@ -96,7 +96,7 @@ message(STATUS "CXX_FLAGS = " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_${BUILD_T
add_subdirectory(muduo/base)
add_subdirectory(muduo/net)

if(NOT CMAKE_BUILD_NO_EXAMPLES)
if(NOT MUDUO_BUILD_NO_EXAMPLES)
add_subdirectory(contrib)
add_subdirectory(examples)
else()
Expand Down
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ BUILD_TYPE=${BUILD_TYPE:-release}
INSTALL_DIR=${INSTALL_DIR:-../${BUILD_TYPE}-install-cpp11}
BUILD_NO_EXAMPLES=${BUILD_NO_EXAMPLES:-0}

ln -sf $BUILD_DIR/$BUILD_TYPE-cpp11/compile_commands.json

mkdir -p $BUILD_DIR/$BUILD_TYPE-cpp11 \
&& cd $BUILD_DIR/$BUILD_TYPE-cpp11 \
&& cmake \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \
-DCMAKE_BUILD_NO_EXAMPLES=$BUILD_NO_EXAMPLES \
-DMUDUO_BUILD_NO_EXAMPLES=$BUILD_NO_EXAMPLES \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
$SOURCE_DIR \
&& make $*

Expand Down
3 changes: 1 addition & 2 deletions clang.diff
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
-set(CMAKE_CXX_COMPILER "g++")
+set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
-set(CMAKE_CXX_FLAGS_RELEASE "-O2 -finline-limit=1000 -DNDEBUG")
+set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

2 changes: 1 addition & 1 deletion contrib/hiredis/Hiredis.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ class Hiredis : public std::enable_shared_from_this<Hiredis>,
DisconnectCallback disconnectCb_;
};

}
} // namespace hiredis

#endif // MUDUO_EXAMPLES_HIREDIS_HIREDIS_H
2 changes: 1 addition & 1 deletion examples/ace/logging/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class LogClient : noncopyable
TcpConnectionPtr connection_ GUARDED_BY(mutex_);
};

}
} // namespace logging

int main(int argc, char* argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion examples/ace/logging/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class LogServer : noncopyable
TcpServer server_;
};

}
} // namespace logging

int main(int argc, char* argv[])
{
Expand Down
4 changes: 2 additions & 2 deletions examples/ace/ttcp/ttcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp time)
}
}

}
} // namespace trans

void transmit(const Options& opt)
{
Expand Down Expand Up @@ -197,7 +197,7 @@ void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp time)
}
}

}
} // namespace receiving

void receive(const Options& opt)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/cdns/Resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const char* getSocketType(int type)
}

const bool kDebug = false;
}
} // namespace

Resolver::Resolver(EventLoop* loop, Option opt)
: loop_(loop),
Expand Down
2 changes: 1 addition & 1 deletion examples/cdns/Resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ class Resolver : muduo::noncopyable
static int ares_sock_create_callback(int sockfd, int type, void* data);
static void ares_sock_state_callback(void* data, int sockfd, int read, int write);
};
}
} // namespace cdns

#endif
2 changes: 1 addition & 1 deletion examples/curl/Curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ class Curl : muduo::noncopyable
int prevRunningHandles_;
};

}
} // namespace curl

#endif
2 changes: 1 addition & 1 deletion examples/hub/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ParseResult parseMessage(muduo::net::Buffer* buf,
string* cmd,
string* topic,
string* content);
}
} // namespace pubsub

#endif // MUDUO_EXAMPLES_HUB_CODEC_H

2 changes: 1 addition & 1 deletion examples/hub/hub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class PubSubServer : noncopyable
std::map<string, Topic> topics_;
};

}
} // namespace pubsub

int main(int argc, char* argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion examples/hub/pubsub.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ class PubSubClient : muduo::noncopyable
ConnectionCallback connectionCallback_;
SubscribeCallback subscribeCallback_;
};
}
} // namespace pubsub

#endif // MUDUO_EXAMPLES_HUB_PUBSUB_H
2 changes: 1 addition & 1 deletion examples/protobuf/resolver/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ResolverServiceImpl : public ResolverService
cdns::Resolver resolver_;
};

}
} // namespace resolver

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/protobuf/rpc/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SudokuServiceImpl : public SudokuService
}
};

}
} // namespace sudoku

int main()
{
Expand Down
2 changes: 1 addition & 1 deletion examples/protobuf/rpcbench/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EchoServiceImpl : public EchoService
}
};

}
} // namespace echo

int main(int argc, char* argv[])
{
Expand Down
3 changes: 2 additions & 1 deletion muduo/base/AsyncLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ class AsyncLogging : noncopyable
BufferVector buffers_ GUARDED_BY(mutex_);
};

}
} // namespace muduo

#endif // MUDUO_BASE_ASYNCLOGGING_H
5 changes: 3 additions & 2 deletions muduo/base/Atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ class AtomicIntegerT : noncopyable
private:
volatile T value_;
};
}
} // namespace detail

typedef detail::AtomicIntegerT<int32_t> AtomicInt32;
typedef detail::AtomicIntegerT<int64_t> AtomicInt64;
}

} // namespace muduo

#endif // MUDUO_BASE_ATOMIC_H
2 changes: 1 addition & 1 deletion muduo/base/BlockingQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ class BlockingQueue : noncopyable
std::deque<T> queue_ GUARDED_BY(mutex_);
};

}
} // namespace muduo

#endif // MUDUO_BASE_BLOCKINGQUEUE_H
2 changes: 1 addition & 1 deletion muduo/base/BoundedBlockingQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ class BoundedBlockingQueue : noncopyable
boost::circular_buffer<T> queue_ GUARDED_BY(mutex_);
};

}
} // namespace muduo

#endif // MUDUO_BASE_BOUNDEDBLOCKINGQUEUE_H
3 changes: 2 additions & 1 deletion muduo/base/Condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ class Condition : noncopyable
pthread_cond_t pcond_;
};

}
} // namespace muduo

#endif // MUDUO_BASE_CONDITION_H
2 changes: 1 addition & 1 deletion muduo/base/CountDownLatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ class CountDownLatch : noncopyable
int count_ GUARDED_BY(mutex_);
};

}
} // namespace muduo
#endif // MUDUO_BASE_COUNTDOWNLATCH_H
4 changes: 2 additions & 2 deletions muduo/base/CurrentThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace CurrentThread
bool isMainThread();

void sleepUsec(int64_t usec);
}
}
} // namespace CurrentThread
} // namespace muduo

#endif
4 changes: 2 additions & 2 deletions muduo/base/Date.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ struct Date::YearMonthDay getYearMonthDay(int julianDayNumber)
ymd.year = b * 100 + d - 4800 + (m / 10);
return ymd;
}
}
} // namespace detail
const int Date::kJulianDayOf1970_01_01 = detail::getJulianDayNumber(1970, 1, 1);
}
} // namespace muduo

using namespace muduo;
using namespace muduo::detail;
Expand Down
3 changes: 2 additions & 1 deletion muduo/base/Date.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ inline bool operator==(Date x, Date y)
return x.julianDayNumber() == y.julianDayNumber();
}

}
} // namespace muduo

#endif // MUDUO_BASE_DATE_H
2 changes: 1 addition & 1 deletion muduo/base/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ class Exception : public std::exception
string stack_;
};

}
} // namespace muduo

#endif // MUDUO_BASE_EXCEPTION_H
5 changes: 2 additions & 3 deletions muduo/base/FileUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

namespace muduo
{

namespace FileUtil
{

Expand Down Expand Up @@ -84,9 +83,9 @@ class AppendFile : noncopyable
char buffer_[64*1024];
off_t writtenBytes_;
};
}

}
} // namespace FileUtil
} // namespace muduo

#endif // MUDUO_BASE_FILEUTIL_H

2 changes: 1 addition & 1 deletion muduo/base/GzipFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ class GzipFile : noncopyable
gzFile file_;
};

}
} // namespace muduo
2 changes: 1 addition & 1 deletion muduo/base/LogFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ class LogFile : noncopyable
const static int kRollPerSeconds_ = 60*60*24;
};

}
} // namespace muduo
#endif // MUDUO_BASE_LOGFILE_H
4 changes: 2 additions & 2 deletions muduo/base/LogStream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ size_t convertHex(char buf[], uintptr_t value)
template class FixedBuffer<kSmallBuffer>;
template class FixedBuffer<kLargeBuffer>;

}
}
} // namespace detail
} // namespace muduo

template<int SIZE>
const char* FixedBuffer<SIZE>::debugString()
Expand Down
6 changes: 3 additions & 3 deletions muduo/base/LogStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FixedBuffer : noncopyable
char* cur_;
};

}
} // namespace detail

class LogStream : noncopyable
{
Expand Down Expand Up @@ -193,6 +193,6 @@ inline LogStream& operator<<(LogStream& s, const Fmt& fmt)
return s;
}

}
#endif // MUDUO_BASE_LOGSTREAM_H
} // namespace muduo

#endif // MUDUO_BASE_LOGSTREAM_H
2 changes: 1 addition & 1 deletion muduo/base/Logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Logger::OutputFunc g_output = defaultOutput;
Logger::FlushFunc g_flush = defaultFlush;
TimeZone g_logTimeZone;

}
} // namespace muduo

using namespace muduo;

Expand Down
2 changes: 1 addition & 1 deletion muduo/base/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ T* CheckNotNull(Logger::SourceFile file, int line, const char *names, T* ptr)
return ptr;
}

}
} // namespace muduo

#endif // MUDUO_BASE_LOGGING_H
2 changes: 1 addition & 1 deletion muduo/base/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class SCOPED_CAPABILITY MutexLockGuard : noncopyable
MutexLock& mutex_;
};

}
} // namespace muduo

// Prevent misuse like:
// MutexLockGuard(mutex_);
Expand Down
4 changes: 2 additions & 2 deletions muduo/base/ProcessInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ Timestamp g_startTime = Timestamp::now();
// assume those won't change during the life time of a process.
int g_clockTicks = static_cast<int>(::sysconf(_SC_CLK_TCK));
int g_pageSize = static_cast<int>(::sysconf(_SC_PAGE_SIZE));
}
}
} // namespace detail
} // namespace muduo

using namespace muduo;
using namespace muduo::detail;
Expand Down
4 changes: 2 additions & 2 deletions muduo/base/ProcessInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ namespace ProcessInfo

int numThreads();
std::vector<pid_t> threads();
}
} // namespace ProcessInfo

}
} // namespace muduo

#endif // MUDUO_BASE_PROCESSINFO_H
Loading

0 comments on commit c72cb54

Please sign in to comment.