Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Easy Sonar smells.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 28 Jun 2022 12:37:59 +0000 (14:37 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 28 Jun 2022 14:18:44 +0000 (16:18 +0200)
examples/sthread/pthread-mutex-simple.c
examples/sthread/sthread-mutex-simple.c
src/sthread/sthread_impl.cpp
src/xbt/xbt_main.cpp
teshsuite/s4u/issue71/issue71.cpp

index abe582d..f0e29a6 100644 (file)
@@ -26,7 +26,8 @@ int main(int argc, char* argv[])
 
   pthread_mutex_init(&mutex, NULL);
 
-  pthread_t thread1, thread2;
+  pthread_t thread1;
+  pthread_t thread2;
   pthread_create(&thread1, NULL, thread1_fun, NULL);
   fprintf(stderr, "here\n");
   pthread_create(&thread2, NULL, thread2_fun, NULL);
index 213fca8..5b11395 100644 (file)
@@ -24,7 +24,8 @@ int main(int argc, char* argv[])
 {
   sthread_mutex_init(&mutex, NULL);
 
-  sthread_t thread1, thread2;
+  sthread_t thread1;
+  sthread_t thread2;
   sthread_create(&thread1, NULL, thread1_fun, NULL);
   sthread_create(&thread2, NULL, thread2_fun, NULL);
   // pthread_join(thread1, NULL);
index b7d8972..8062a5c 100644 (file)
@@ -23,7 +23,7 @@
 XBT_LOG_NEW_DEFAULT_CATEGORY(sthread, "pthread intercepter");
 namespace sg4 = simgrid::s4u;
 
-static sg4::Host* lilibeth = NULL;
+static sg4::Host* lilibeth = nullptr;
 
 int sthread_main(int argc, char** argv, char** envp, int (*raw_main)(int, char**, char**))
 {
@@ -62,7 +62,7 @@ static void thread_create_wrapper(void* (*user_function)(void*), void* param)
   sthread_disable();
 }
 
-int sthread_create(unsigned long int* thread, const /*pthread_attr_t*/ void* attr, void* (*start_routine)(void*),
+int sthread_create(unsigned long int* thread, const void* /*pthread_attr_t* attr*/, void* (*start_routine)(void*),
                    void* arg)
 {
   static int TID = 0;
@@ -81,7 +81,7 @@ int sthread_create(unsigned long int* thread, const /*pthread_attr_t*/ void* att
   *thread = reinterpret_cast<unsigned long>(actor.get());
   return 0;
 }
-int sthread_join(sthread_t thread, void** retval)
+int sthread_join(sthread_t thread, void** /*retval*/)
 {
   sg4::ActorPtr actor(reinterpret_cast<sg4::Actor*>(thread));
   actor->join();
@@ -90,7 +90,7 @@ int sthread_join(sthread_t thread, void** retval)
   return 0;
 }
 
-int sthread_mutex_init(sthread_mutex_t* mutex, const /*pthread_mutexattr_t*/ void* attr)
+int sthread_mutex_init(sthread_mutex_t* mutex, const void* /*pthread_mutexattr_t* attr*/)
 {
   auto m = sg4::Mutex::create();
   intrusive_ptr_add_ref(m.get());
index 9443d05..8ee72a4 100644 (file)
@@ -56,8 +56,12 @@ int xbt_pagebits = 0;
  */
 static void xbt_preinit() XBT_ATTRIB_CONSTRUCTOR(200);
 static void xbt_postexit();
-void sthread_enable() {}  // These symbols are used from ContextSwapped in any case, but they are only useful
-void sthread_disable() {} //  when libsthread is LD_PRELOADED. In this case, sthread's implem gets used instead.
+void sthread_enable()
+{ // These symbols are used from ContextSwapped in any case, but they are only useful
+}
+void sthread_disable()
+{ //  when libsthread is LD_PRELOADED. In this case, sthread's implem gets used instead.
+}
 
 #ifdef _WIN32
 #include <windows.h>
@@ -167,4 +171,4 @@ int SMPI_is_inited()
 {
   return false;
 }
-#endif
\ No newline at end of file
+#endif
index 3952bdc..6333844 100644 (file)
@@ -36,8 +36,7 @@ int main(int argc, char* argv[])
     e.load_platform(platform_file);
     simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner);
     e.run();
-  }
-  catch (simgrid::AssertionError& e) {
+  } catch (const simgrid::AssertionError& e) {
     std::cout << e.what() << "\n";
   }