From 3ba1bd7a72e4572ac25f6a6271be8cb29ed538de Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 10 May 2020 22:17:19 +0200 Subject: [PATCH] sonar: also ignore S5271 for the examples in C++ Plus fix some other warnings reported by sonar. --- sonar-project.properties | 8 +++++--- src/kernel/activity/ActivityImpl.hpp | 2 +- teshsuite/s4u/actor-suspend/actor-suspend.cpp | 4 ---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 7033c24cb5..66edad6df0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -14,7 +14,7 @@ sonar.sources=src,examples,include,teshsuite # Disable some rules on some files -sonar.issue.ignore.multicriteria=j1,j2,j3,j4,j5,jni1,jni2,c1,c2a,c2b,c3,c5a,c5b,c6a,c6b,c7,c8a,c8b,c9,c10a,c10b,c10c,cex1a,cex1b,cex2,cex3,cex4,f1,p1,s1,s2,s3,s4,s5 +sonar.issue.ignore.multicriteria=j1,j2,j3,j4,j5,jni1,jni2,c1,c2a,c2b,c3,c5a,c5b,c6a,c6b,c7,c8a,c8b,c9,c10a,c10b,c10c,cex1a,cex1b,cex2a,cex2b,cex3,cex4,f1,p1,s1,s2,s3,s4,s5 # The Object.finalize() method should not be overridden # But we need to clean the native memory with JNI @@ -119,8 +119,10 @@ sonar.issue.ignore.multicriteria.cex1b.resourceKey=examples/**/*.hpp # Functions which do not return should be declared as "noreturn" # But examples are intended to remain small and simple -sonar.issue.ignore.multicriteria.cex2.ruleKey=c:S5271 -sonar.issue.ignore.multicriteria.cex2.resourceKey=examples/**/*.c +sonar.issue.ignore.multicriteria.cex2a.ruleKey=c:S5271 +sonar.issue.ignore.multicriteria.cex2a.resourceKey=examples/**/*.c +sonar.issue.ignore.multicriteria.cex2b.ruleKey=cpp:S5271 +sonar.issue.ignore.multicriteria.cex2b.resourceKey=examples/**/*.cpp # Unused function parameters should be removed, but not in examples sonar.issue.ignore.multicriteria.cex3.ruleKey=c:S1172 diff --git a/src/kernel/activity/ActivityImpl.hpp b/src/kernel/activity/ActivityImpl.hpp index 7cf2c0b442..fcda3304ff 100644 --- a/src/kernel/activity/ActivityImpl.hpp +++ b/src/kernel/activity/ActivityImpl.hpp @@ -89,7 +89,7 @@ private: std::string tracing_category_ = ""; public: - AnyActivityImpl& set_name(const std::string& name) + AnyActivityImpl& set_name(const std::string& name) /* Hides the function in the ancestor class */ { ActivityImpl::set_name(name); return static_cast(*this); diff --git a/teshsuite/s4u/actor-suspend/actor-suspend.cpp b/teshsuite/s4u/actor-suspend/actor-suspend.cpp index a75cc86ed5..7db50455f6 100644 --- a/teshsuite/s4u/actor-suspend/actor-suspend.cpp +++ b/teshsuite/s4u/actor-suspend/actor-suspend.cpp @@ -33,10 +33,6 @@ class Suspender { public: void operator()() { - - // If we sleep a bit here, this MWE works because the suspender is not trying to suspend someone executed later in - // the same scheduling round simgrid::s4u::this_actor::sleep_for(0.01); - XBT_INFO("Suspend the receiver..."); receiver->suspend(); XBT_INFO("Resume the receiver..."); -- 2.20.1