Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Please sonar.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 6 Mar 2020 14:51:03 +0000 (15:51 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 9 Mar 2020 09:14:45 +0000 (10:14 +0100)
Since PTH_STACKGROWPTH if a compile-time constant, it warned for:
- "code will never be executed", and
- "identical sub-expressions on both sides of operator '=='"

src/kernel/context/ContextSwapped.cpp

index 7b25012..5a54a95 100644 (file)
@@ -170,7 +170,11 @@ SwappedContext::~SwappedContext()
 unsigned char* SwappedContext::get_stack_bottom() const
 {
   // Depending on the stack direction, its bottom (that make_fcontext needs) may be the lower or higher end
-  return PTH_STACKGROWTH == -1 ? stack_ + get_actor()->get_stacksize() : stack_;
+#if PTH_STACKGROWTH == 1
+  return stack_;
+#else
+  return stack_ + get_actor()->get_stacksize();
+#endif
 }
 
 void SwappedContext::stop()