Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add some "explicit" keyword (sonar, codacy).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 25 Oct 2017 20:56:11 +0000 (22:56 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 25 Oct 2017 21:35:23 +0000 (23:35 +0200)
include/xbt/Extendable.hpp
include/xbt/exception.hpp
include/xbt/range.hpp
include/xbt/string.hpp
src/mc/DwarfExpression.hpp
src/mc/LocationList.hpp
src/mc/mc_dwarf.cpp
src/mc/mc_state.hpp

index 1da9b31..785e337 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015. The SimGrid Team.
+/* Copyright (c) 2015, 2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@ class Extension {
   static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
   std::size_t id_;
   friend class Extendable<T>;
   static const std::size_t INVALID_ID = std::numeric_limits<std::size_t>::max();
   std::size_t id_;
   friend class Extendable<T>;
-  constexpr Extension(std::size_t id) : id_(id) {}
+  explicit constexpr Extension(std::size_t id) : id_(id) {}
 public:
   explicit constexpr Extension() : id_(INVALID_ID) {}
   std::size_t id() const { return id_; }
 public:
   explicit constexpr Extension() : id_(INVALID_ID) {}
   std::size_t id() const { return id_; }
@@ -64,7 +64,7 @@ public:
   template<class U> static
   Extension<T,U> extension_create()
   {
   template<class U> static
   Extension<T,U> extension_create()
   {
-    return extension_create([](void* p){ delete static_cast<U*>(p); });
+    return Extension<T, U>(extension_create([](void* p) { delete static_cast<U*>(p); }));
   }
   Extendable() : extensions_(deleters_.size(), nullptr) {}
   ~Extendable()
   }
   Extendable() : extensions_(deleters_.size(), nullptr) {}
   ~Extendable()
index 7c826cd..3d648a1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005-2016. The SimGrid Team.All rights reserved. */
+/* Copyright (c) 2005-2017. 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. */
 
 /* 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. */
@@ -99,8 +99,7 @@ class WithContext : public E, public WithContextException
 public:
   static_assert(not std::is_base_of<WithContextException, E>::value, "Trying to appli WithContext twice");
 
 public:
   static_assert(not std::is_base_of<WithContextException, E>::value, "Trying to appli WithContext twice");
 
-  WithContext(E exception) :
-    E(std::move(exception)) {}
+  explicit WithContext(E exception) : E(std::move(exception)) {}
   WithContext(E exception, ThrowPoint throwpoint, Backtrace backtrace) :
     E(std::move(exception)),
     WithContextException(throwpoint, std::move(backtrace)) {}
   WithContext(E exception, ThrowPoint throwpoint, Backtrace backtrace) :
     E(std::move(exception)),
     WithContextException(throwpoint, std::move(backtrace)) {}
index 5c20a9c..be1e7e8 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016. The SimGrid Team.
+/* Copyright (c) 2016-2017. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -17,7 +17,7 @@ template<class T> class Range {
 public:
   Range()               : begin_(), end_() {}
   Range(T begin, T end) : begin_(std::move(begin)), end_(std::move(end)) {}
 public:
   Range()               : begin_(), end_() {}
   Range(T begin, T end) : begin_(std::move(begin)), end_(std::move(end)) {}
-  Range(T value) : begin_(value), end_(value + 1) {}
+  explicit Range(T value) : begin_(value), end_(value + 1) {}
   T& begin()             { return begin_; }
   T& end()               { return end_; }
   const T& begin() const { return begin_; }
   T& begin()             { return begin_; }
   T& end()               { return end_; }
   const T& begin() const { return begin_; }
index ae6728c..e610b81 100644 (file)
@@ -98,7 +98,7 @@ public:
     s.string_data::len = 0;
     s.string_data::data = &NUL;
   }
     s.string_data::len = 0;
     s.string_data::data = &NUL;
   }
-  string(std::string const& s) : string(s.c_str(), s.size()) {}
+  explicit string(std::string const& s) : string(s.c_str(), s.size()) {}
 
   // Assign
   void assign(const char* s, size_t size)
 
   // Assign
   void assign(const char* s, size_t size)
index defb89c..38bcbca 100644 (file)
@@ -58,7 +58,7 @@ public:
 /** When an error happens in the execution of a DWARF expression */
 class evaluation_error : std::runtime_error {
 public:
 /** When an error happens in the execution of a DWARF expression */
 class evaluation_error : std::runtime_error {
 public:
-  evaluation_error(const char* what): std::runtime_error(what) {}
+  explicit evaluation_error(const char* what) : std::runtime_error(what) {}
 };
 
 /** A stack for evaluating a DWARF expression
 };
 
 /** A stack for evaluating a DWARF expression
index 8e4aee3..807291e 100644 (file)
@@ -37,7 +37,9 @@ public:
   LocationListEntry(DwarfExpression expression, range_type range)
     : expression_(std::move(expression)), range_(range)
   {}
   LocationListEntry(DwarfExpression expression, range_type range)
     : expression_(std::move(expression)), range_(range)
   {}
-  LocationListEntry(DwarfExpression expression) : expression_(std::move(expression)), range_({0, UINT64_MAX}) {}
+  explicit LocationListEntry(DwarfExpression expression) : expression_(std::move(expression)), range_({0, UINT64_MAX})
+  {
+  }
 
   DwarfExpression& expression()
   {
 
   DwarfExpression& expression()
   {
index 88e1369..5e95580 100644 (file)
@@ -776,7 +776,7 @@ static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
         variable->address = (void *) (base + offset);
       } else
         variable->location_list = {
         variable->address = (void *) (base + offset);
       } else
         variable->location_list = {
-          simgrid::dwarf::DwarfExpression(expr, expr + len) };
+            simgrid::dwarf::LocationListEntry(simgrid::dwarf::DwarfExpression(expr, expr + len))};
 
       break;
     }
 
       break;
     }
index edef946..d14e7fd 100644 (file)
@@ -125,7 +125,7 @@ public:
   std::vector<std::vector<simgrid::mc::PatternCommunication>> incomplete_comm_pattern;
   std::vector<unsigned> communicationIndices;
 
   std::vector<std::vector<simgrid::mc::PatternCommunication>> incomplete_comm_pattern;
   std::vector<unsigned> communicationIndices;
 
-  State(unsigned long state_number);
+  explicit State(unsigned long state_number);
 
   std::size_t interleaveSize() const;
   void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid].consider(); }
 
   std::size_t interleaveSize() const;
   void addInterleavingSet(smx_actor_t actor) { this->actorStates[actor->pid].consider(); }