Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Add attribute "noreturn" to non-returning functions.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 May 2019 09:44:35 +0000 (11:44 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 May 2019 12:27:39 +0000 (14:27 +0200)
include/simgrid/Exception.hpp
src/mc/ModelChecker.hpp
src/mc/remote/Client.hpp
src/simix/smx_global.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
src/surf/xml/simgrid_dtd.h
teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp
tools/cmake/MaintainerMode.cmake

index 08ccf09..0012ee0 100644 (file)
@@ -196,7 +196,7 @@ public:
   ~ForcefulKillException();
   const char* what() const noexcept { return msg_.c_str(); }
 
-  static void do_throw();
+  XBT_ATTRIB_NORETURN static void do_throw();
   static bool try_n_catch(const std::function<void()>& try_block);
 
 private:
index e68ce22..d4de670 100644 (file)
@@ -66,7 +66,7 @@ public:
   void handle_events(int fd, short events);
   void wait_for_requests();
   void handle_simcall(Transition const& transition);
-  void exit(int status);
+  XBT_ATTRIB_NORETURN void exit(int status);
 
   bool checkDeadlock();
 
index d28987d..ddbdb97 100644 (file)
@@ -37,7 +37,7 @@ private:
 public:
   Channel const& getChannel() const { return channel_; }
   Channel& getChannel() { return channel_; }
-  void mainLoop();
+  XBT_ATTRIB_NORETURN void mainLoop();
   void reportAssertionFailure();
   void ignoreMemory(void* addr, std::size_t size);
   void ignoreHeap(void* addr, std::size_t size);
index 461b844..cca99ec 100644 (file)
@@ -33,7 +33,7 @@ std::unique_ptr<simgrid::simix::Global> simix_global;
 void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr) = nullptr;
 
 bool _sg_do_verbose_exit = true;
-static void inthandler(int)
+XBT_ATTRIB_NORETURN static void inthandler(int)
 {
   if ( _sg_do_verbose_exit ) {
      XBT_INFO("CTRL-C pressed. The current status will be displayed before exit (disable that behavior with option 'verbose-exit').");
index 2838ee6..dc56933 100644 (file)
@@ -7,7 +7,6 @@
 #include "mc/mc.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/sg_config.hpp"
-#include "src/internal_config.h"
 #include "src/simgrid/version.h"
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/xml/platf.hpp"
index 82ca23e..cd88f89 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SURF_MODEL_H_
 #define SURF_MODEL_H_
 
+#include "src/internal_config.h"
 #include "src/surf/surf_private.hpp"
 
 #include <cmath>
@@ -72,6 +73,9 @@ XBT_PUBLIC void surf_cpu_model_init_Cas01();
  *
  *  @see surf_host_model_init_SMPI()
  */
+#if !HAVE_SMPI
+XBT_ATTRIB_NORETURN
+#endif
 XBT_PUBLIC void surf_network_model_init_SMPI();
 
 /** @ingroup SURF_models
@@ -82,6 +86,9 @@ XBT_PUBLIC void surf_network_model_init_SMPI();
  *
  *  @see surf_host_model_init_IB()
  */
+#if !HAVE_SMPI
+XBT_ATTRIB_NORETURN
+#endif
 XBT_PUBLIC void surf_network_model_init_IB();
 
 /** @ingroup SURF_models
@@ -121,6 +128,9 @@ XBT_PUBLIC void surf_network_model_init_CM02();
  *
  *  @see surf_host_model_init_NS3()
  */
+#if !SIMGRID_HAVE_NS3
+XBT_ATTRIB_NORETURN
+#endif
 XBT_PUBLIC void surf_network_model_init_NS3();
 
 /** @ingroup SURF_models
index 20f21d8..15ee454 100644 (file)
@@ -74,7 +74,7 @@ XBT_PUBLIC void STag_surfxml_host(void);
 XBT_PUBLIC void ETag_surfxml_host(void);
 XBT_PUBLIC void STag_surfxml_host___link(void);
 XBT_PUBLIC void ETag_surfxml_host___link(void);
-XBT_PUBLIC void STag_surfxml_include(void);
+XBT_ATTRIB_NORETURN XBT_PUBLIC void STag_surfxml_include(void);
 XBT_PUBLIC void ETag_surfxml_include(void);
 XBT_PUBLIC void STag_surfxml_link(void);
 XBT_PUBLIC void ETag_surfxml_link(void);
index 756efd7..8c21ecc 100644 (file)
@@ -16,7 +16,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
 
-static void usage(const char* binaryName, const char* defaultSend, const char* defaultRecv)
+XBT_ATTRIB_NORETURN static void usage(const char* binaryName, const char* defaultSend, const char* defaultRecv)
 {
   std::fprintf(stderr, "Usage: %s examples/platforms/cluster_backbone.xml <send_spec> <recv_spec>\n"
                        "where spec is a list of letters giving the kind of tests you want to see.\n"
index 4765bd4..000cc6f 100644 (file)
@@ -162,6 +162,7 @@ if(enable_maintainer_mode AND NOT WIN32)
 
     set(string1  "'s/extern /XBT_PUBLIC_DATA /'")
     set(string2  "'s/XBT_PUBLIC_DATA \\([^(]*\\)(/XBT_PUBLIC \\1(/'")
+    set(string3  "'s/XBT_PUBLIC void STag_surfxml_include/XBT_ATTRIB_NORETURN &/'") # remove with v5 of the dtd
     set(string5  "'s/SET(DOCTYPE)/SET(ROOT_dax__adag)/'")
     set(string9  "'s/#include <unistd.h>/#if defined(_WIN32)\\n#  ifndef __STRICT_ANSI__\\n#    include <io.h>\\n#    include <process.h>\\n#  endif\\n#else\\n#  include <unistd.h>\\n#endif/g'")
     set(string14 "'\\!^ \\* Generated [0-9/]\\{10\\} [0-9:]\\{8\\}\\.$$!d'")
@@ -193,6 +194,7 @@ if(enable_maintainer_mode AND NOT WIN32)
       COMMAND ${FLEXML_EXE} --root-tags platform -P surfxml --sysid=https://simgrid.org/simgrid.dtd -H src/surf/xml/simgrid_dtd.h -L src/surf/xml/simgrid.dtd
       COMMAND ${SED_EXE} -i ${string1} src/surf/xml/simgrid_dtd.h
       COMMAND ${SED_EXE} -i ${string2} src/surf/xml/simgrid_dtd.h
+      COMMAND ${SED_EXE} -i ${string3} src/surf/xml/simgrid_dtd.h
       COMMAND ${SED_EXE} -i ${string14} src/surf/xml/simgrid_dtd.h
       COMMAND ${CMAKE_COMMAND} -E echo "       Generated src/surf/xml/simgrid_dtd.h"