Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sonar: don't use auto for pointers, but auto*
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 16 Feb 2018 12:33:44 +0000 (13:33 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 16 Feb 2018 12:56:48 +0000 (13:56 +0100)
src/bindings/java/jmsg_vm.cpp
src/simix/ActorImpl.cpp
src/simix/smx_network.cpp
src/surf/sg_platf.cpp
src/xbt/exception.cpp

index 06814bf..9055739 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions related to the Virtual Machines.                               */
 
-/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2012-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -143,7 +143,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_destroy(JNIEnv* env, jobject jvm)
   msg_vm_t vm = jvm_get_native(env, jvm);
   if (vm) {
     MSG_vm_destroy(vm);
-    auto vmList = &simgrid::vm::VirtualMachineImpl::allVms_;
+    auto* vmList = &simgrid::vm::VirtualMachineImpl::allVms_;
     vmList->erase(std::remove(vmList->begin(), vmList->end(), vm), vmList->end());
   }
 }
index e546a66..a4a974f 100644 (file)
@@ -409,7 +409,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   /* Tracing the process creation */
   TRACE_msg_process_create(process->getName(), process->pid, process->host);
 
-  auto context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
+  auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
   if (not context)
     xbt_die("Not a suitable context");
 
@@ -419,7 +419,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
 
 void SIMIX_process_detach()
 {
-  auto context = dynamic_cast<simgrid::kernel::context::AttachContext*>(SIMIX_context_self());
+  auto* context = dynamic_cast<simgrid::kernel::context::AttachContext*>(SIMIX_context_self());
   if (not context)
     xbt_die("Not a suitable context");
 
index 68798b9..8708df0 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2017. The SimGrid Team.  All rights reserved.         */
+/* Copyright (c) 2009-2018. The SimGrid Team.  All rights reserved.         */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -603,7 +603,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
         }
         else if (simcall->call == SIMCALL_COMM_TESTANY) {
           e.value = -1;
-          auto comms = simcall_comm_testany__get__comms(simcall);
+          auto* comms  = simcall_comm_testany__get__comms(simcall);
           auto count = simcall_comm_testany__get__count(simcall);
           auto element = std::find(comms, comms + count, synchro);
           if (element == comms + count)
index da32afa..4635150 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -227,7 +227,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
       linkUp   = simgrid::surf::LinkImpl::byName(tmp_link);
       linkDown = simgrid::surf::LinkImpl::byName(tmp_link);
 
-      auto as_cluster = static_cast<ClusterZone*>(current_as);
+      auto* as_cluster = static_cast<ClusterZone*>(current_as);
       as_cluster->privateLinks_.insert({as_cluster->nodePosition(rankId), {linkUp, linkDown}});
     }
 
@@ -654,7 +654,7 @@ void sg_platf_new_hostlink(HostLinkCreationArgs* hostlink)
   xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up.c_str());
   xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down.c_str());
 
-  auto as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
+  auto* as_cluster = static_cast<simgrid::kernel::routing::ClusterZone*>(current_routing);
 
   if (as_cluster->privateLinks_.find(netpoint->id()) != as_cluster->privateLinks_.end())
     surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
index a1c6d0b..1455134 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2005-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2005-2018. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -38,8 +37,7 @@ void logException(
   try {
     auto name = simgrid::xbt::demangle(typeid(exception).name());
 
-    auto with_context =
-      dynamic_cast<const simgrid::xbt::WithContextException*>(&exception);
+    auto* with_context = dynamic_cast<const simgrid::xbt::WithContextException*>(&exception);
     if (with_context != nullptr)
       XBT_LOG(prio, "%s %s by %s/%d: %s",
         context, name.get(),
@@ -57,7 +55,7 @@ void logException(
     }
 
     // Do we have a nested exception?
-    auto with_nested = dynamic_cast<const std::nested_exception*>(&exception);
+    auto* with_nested = dynamic_cast<const std::nested_exception*>(&exception);
     if (with_nested == nullptr ||  with_nested->nested_ptr() == nullptr)
       return;
     try {