Module: check_mk
Branch: master
Commit: 3ef1c189c2ceca1f842c3b7662bc95cc94705e16
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3ef1c189c2ceca…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Dec 8 13:56:38 2017 +0100
Fix for google-build-using-namespace.
Change-Id: I2a9efbde10fb4eaf3903465b4a092318ecd6aea9
---
.clang-tidy | 3 +--
livestatus/src/ChronoUtils.h | 15 ++++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/.clang-tidy b/.clang-tidy
index 6996c81..124bc8f 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -33,7 +33,6 @@
# * temporarily disabled:
# * clang-analyzer-optin.performance.Padding
# * cppcoreguidelines-special-member-functions
-# * google-build-using-namespace
# * google-readability-todo
# * hicpp-explicit-conversions
# * hicpp-use-equals-delete
@@ -44,7 +43,7 @@
# * performance-unnecessary-value-param
# * readability-named-parameter
#
-Checks:
'*,-android-cloexec-fopen,-android-cloexec-open,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-alpha*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-google-runtime-int,-google-runtime-references,-hicpp-member-init,-hicpp-no-assembler,-llvm-header-guard,-llvm-include-order,-modernize-use-bool-literals,-clang-analyzer-optin.performance.Padding,-cppcoreguidelines-special-member-functions,-google-build-using-namespace,-google-readability-todo,-hicpp-explicit-conversions,-hicpp-use-equals-delete,-hicpp-special-member-functions,-modernize-pass-by-value,-modernize-use-default-member-init,-modernize-use-equals-delete,-performance-unnecessary-value-param,-readability-named-parameter'
+Checks:
'*,-android-cloexec-fopen,-android-cloexec-open,-cert-env33-c,-cert-err34-c,-cert-err58-cpp,-clang-analyzer-alpha*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-type-vararg,-google-runtime-int,-google-runtime-references,-hicpp-member-init,-hicpp-no-assembler,-llvm-header-guard,-llvm-include-order,-modernize-use-bool-literals,-clang-analyzer-optin.performance.Padding,-cppcoreguidelines-special-member-functions,-google-readability-todo,-hicpp-explicit-conversions,-hicpp-use-equals-delete,-hicpp-special-member-functions,-modernize-pass-by-value,-modernize-use-default-member-init,-modernize-use-equals-delete,-performance-unnecessary-value-param,-readability-named-parameter'
CheckOptions:
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '1'
diff --git a/livestatus/src/ChronoUtils.h b/livestatus/src/ChronoUtils.h
index 58e2e91..95f7727 100644
--- a/livestatus/src/ChronoUtils.h
+++ b/livestatus/src/ChronoUtils.h
@@ -36,9 +36,9 @@
using minutes_d = std::chrono::duration<double, std::ratio<60>>;
inline double elapsed_ms_since(std::chrono::steady_clock::time_point then) {
- using namespace std::chrono;
- return duration_cast<duration<double, std::milli>>(steady_clock::now() -
- then)
+ return std::chrono::duration_cast<
+ std::chrono::duration<double, std::milli>>(
+ std::chrono::steady_clock::now() - then)
.count();
}
@@ -79,17 +79,18 @@ inline std::chrono::system_clock::time_point from_tm(tm tp) {
template <typename Rep, typename Period>
inline timeval to_timeval(std::chrono::duration<Rep, Period> dur) {
- using namespace std::chrono;
timeval tv;
// NOTE: The static_casts below are needed to avoid warning on e.g. some
// 32bit platforms, because the underlying types might be larger than the
// timeval fields. We can't use the correct POSIX types time_t and
// suseconds_t because of the broken MinGW cross compiler, so we revert to
// decltype.
- tv.tv_sec =
-
static_cast<decltype(tv.tv_sec)>(duration_cast<seconds>(dur).count());
+ tv.tv_sec = static_cast<decltype(tv.tv_sec)>(
+ std::chrono::duration_cast<std::chrono::seconds>(dur).count());
tv.tv_usec = static_cast<decltype(tv.tv_usec)>(
- duration_cast<microseconds>(dur % seconds(1)).count());
+ std::chrono::duration_cast<std::chrono::microseconds>(
+ dur % std::chrono::seconds(1))
+ .count());
return tv;
}