From: Maksym Mamontov <madf@madf.info>
Date: Mon, 27 Jan 2025 15:03:04 +0000 (+0200)
Subject: Fix debug build, use separate clang-tidy config.
X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/9e321f1d39023f4ba86cd354eda0c347ac15fca2?ds=sidebyside;hp=-c

Fix debug build, use separate clang-tidy config.
---

9e321f1d39023f4ba86cd354eda0c347ac15fca2
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 00000000..1553c16e
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,16 @@
+Checks: "-*,
+         clang-analyzer-*,
+         misc-*,
+         modernize-*,
+         performance-*,
+         portability-*,
+         readability-*,
+         bugprone-*,
+         -misc-include-cleaner,
+         -modernize-avoid-bind,
+         -modernize-use-trailing-return-type,
+         -bugprone-easily-swappable-parameters,
+         -readability-braces-around-statements,
+         -readability-magic-numbers,
+         -readability-identifier-length,
+         -readability-suspicious-call-argument"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b039a00..a72d3e57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,21 +118,7 @@ if ( TIDY )
         message( STATUS "clang-tidy not found." )
     else ()
         message( STATUS "clang-tidy found: ${CLANG_TIDY_EXE}" )
-        set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}"
-             "-checks=-*,\
-clang-analyzer-*,\
-misc-*,\
-modernize-*,\
-performance-*,\
-portability-*,\
-readability-*,\
-bugprone-*,\
--modernize-avoid-bind,\
--modernize-use-trailing-return-type,\
--readability-braces-around-statements, \
--readability-magic-numbers, \
--readability-identifier-length, \
--bugprone-easily-swappable-parameters" )
+        set( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" )
     endif ()
 endif ()
 
@@ -149,6 +135,7 @@ endif ()
 enable_language (CXX)
 set (CMAKE_CXX_STANDARD 17)
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall -Wextra -Wshadow -Wno-long-long -Wold-style-cast -Wstrict-aliasing -pedantic")
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
 
 if ( CMAKE_COMPILER_IS_GNUCC )
     # GCC-specific
diff --git a/projects/stargazer/plugins/other/smux/sensors.h b/projects/stargazer/plugins/other/smux/sensors.h
index 559f051e..039aa530 100644
--- a/projects/stargazer/plugins/other/smux/sensors.h
+++ b/projects/stargazer/plugins/other/smux/sensors.h
@@ -41,7 +41,7 @@ class TotalUsersSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(users.Count(), res); return res; }
+        { return std::to_string(users.Count()); }
 #endif
 
     private:
@@ -172,7 +172,7 @@ class TotalTariffsSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(tariffs.Count(), res); return res; }
+        { return std::to_string(tariffs.Count()); }
 #endif
 
     private:
@@ -190,7 +190,7 @@ class TotalAdminsSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(admins.Count(), res); return res; }
+        { return std::to_string(admins.count()); }
 #endif
 
     private:
@@ -208,7 +208,7 @@ class TotalServicesSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(services.Count(), res); return res; }
+        { return std::to_string(services.Count()); }
 #endif
 
     private:
@@ -226,7 +226,7 @@ class TotalCorporationsSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(corporations.Count(), res); return res; }
+        { return std::to_string(corporations.Count()); }
 #endif
 
     private:
@@ -244,7 +244,7 @@ class TotalRulesSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(traffcounter.rulesCount(), res); return res; }
+        { return std::to_string(traffcounter.rulesCount()); }
 #endif
 
     private:
@@ -263,7 +263,7 @@ class ConstSensor : public Sensor {
 
 #ifdef DEBUG
         std::string ToString() const override
-        { std::string res; std::to_string(value, res); return res; }
+        { return std::to_string(value); }
 #endif
 
     private: