From 46b232357195e0ea140d62a07e48e4f172f9d91d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= <jgrad@icp.uni-stuttgart.de>
Date: Wed, 10 May 2023 16:21:03 +0200
Subject: [PATCH] Fix several Clang-Tidy diagnostics

* readability-isolate-declaration
* misc-unused-parameters
* performance-faster-string-find
---
 src/core/math/Uint.h         | 3 ++-
 src/core/timing/TimingNode.h | 4 ++--
 src/core/timing/TimingTree.h | 4 ++--
 src/core/uid/UIDGenerators.h | 8 +++++---
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/core/math/Uint.h b/src/core/math/Uint.h
index c5fc28d83..d15bc2f3d 100644
--- a/src/core/math/Uint.h
+++ b/src/core/math/Uint.h
@@ -168,7 +168,8 @@ template<> uint_t uintMSBPosition< uint64_t >( uint64_t value ); // -> Uint.cpp
 
 template<> inline uint_t uintMSBPosition< uint32_t >( uint32_t value ) {
 
-   uint32_t i, j;
+   uint32_t i;
+   uint32_t j;
 
    j = value >> 16;
    if( j != 0 ) {
diff --git a/src/core/timing/TimingNode.h b/src/core/timing/TimingNode.h
index a72c2f193..5b9c29aa2 100644
--- a/src/core/timing/TimingNode.h
+++ b/src/core/timing/TimingNode.h
@@ -120,7 +120,7 @@ void TimingNode<TP>::swap(TimingNode<TP>& tt)
 template< typename TP >  // Timing policy
 const Timer<TP>& findTimer( const TimingNode<TP>& tn, const std::string& name)
 {
-   auto pos = name.find_first_of(".");
+   auto pos = name.find_first_of('.');
    if (pos != std::string::npos)
    {
       WALBERLA_ASSERT_UNEQUAL( tn.tree_.find(name.substr(0, pos)), tn.tree_.end(), "Could not find timer: " << name.substr(0, pos) );
@@ -139,7 +139,7 @@ const Timer<TP>& findTimer( const TimingNode<TP>& tn, const std::string& name)
 template< typename TP >  // Timing policy
 bool timerExists( const TimingNode<TP>& tn, const std::string& name )
 {
-   auto pos = name.find_first_of(".");
+   auto pos = name.find_first_of('.');
    if (pos != std::string::npos)
    {
       if( tn.tree_.find(name.substr(0, pos)) != tn.tree_.end() )
diff --git a/src/core/timing/TimingTree.h b/src/core/timing/TimingTree.h
index 248dcdcce..63d85d243 100644
--- a/src/core/timing/TimingTree.h
+++ b/src/core/timing/TimingTree.h
@@ -144,7 +144,7 @@ void TimingTree<TP>::swap(TimingTree<TP>& tt)
 template< typename TP >  // Timing policy
 void TimingTree<TP>::start(const std::string& name)
 {
-   if (name.find_first_of(".") != std::string::npos)
+   if (name.find_first_of('.') != std::string::npos)
    {
       WALBERLA_LOG_WARNING("'.' not allowed in timer name!");
    }
@@ -158,7 +158,7 @@ void TimingTree<TP>::start(const std::string& name)
 template< typename TP >  // Timing policy
 void TimingTree<TP>::stop(const std::string& name)
 {
-   if (name.find_first_of(".") != std::string::npos)
+   if (name.find_first_of('.') != std::string::npos)
    {
       WALBERLA_LOG_WARNING("'.' not allowed in timer name!");
    }
diff --git a/src/core/uid/UIDGenerators.h b/src/core/uid/UIDGenerators.h
index 4d4a333f9..265beeaac 100644
--- a/src/core/uid/UIDGenerators.h
+++ b/src/core/uid/UIDGenerators.h
@@ -166,7 +166,8 @@ template< typename UINT > size_t logBase2( UINT value ); // 1000 -> 3, 0010 -> 1
 
 template<> inline size_t logBase2< uint64_t >( uint64_t value ) {
 
-   uint64_t i, j;
+   uint64_t i;
+   uint64_t j;
 
    i = value >> 32;
    if( i != 0 ) {
@@ -189,7 +190,8 @@ template<> inline size_t logBase2< uint64_t >( uint64_t value ) {
 
 template<> inline size_t logBase2< uint32_t >( uint32_t value ) {
 
-   uint32_t i, j;
+   uint32_t i;
+   uint32_t j;
 
    j = value >> 16;
    if( j != 0 ) {
@@ -273,7 +275,7 @@ public:
 
    static uint_type firstUID() { return 1; }
 
-   static uint_type nextUID( const uint_type uid ) { WALBERLA_ASSERT( false ); return 1; }
+   static uint_type nextUID( const uint_type /*uid*/ ) { WALBERLA_ASSERT( false ); return 1; }
 
    static uint_type toIndex( const uint_type uid ) { WALBERLA_ASSERT_EQUAL( uid, 1 ); return 0; }
 
-- 
GitLab