Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Move all #include directives before any code for C++ too.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 3 Jul 2019 08:18:46 +0000 (10:18 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 3 Jul 2019 08:38:22 +0000 (10:38 +0200)
include/simgrid/plugins/file_system.h
include/smpi/smpi.h
src/bindings/lua/simgrid_lua.hpp
src/simix/popping_private.hpp
src/smpi/internals/smpi_global.cpp

index 961331e..099cf33 100644 (file)
 #include <xbt/base.h>
 #include <xbt/dict.h>
 
+#ifdef __cplusplus
+#include <xbt/Extendable.hpp>
+
+#include <map>
+#include <memory>
+#include <string>
+#endif
+
 // C interface
 ////////////////
 typedef sg_file_t msg_file_t; // MSG backwards compatibility
@@ -70,11 +78,6 @@ SG_END_DECL()
 //////////////////
 
 #ifdef __cplusplus
-#include <xbt/Extendable.hpp>
-
-#include <map>
-#include <memory>
-#include <string>
 
 namespace simgrid {
 namespace s4u {
index c8a96e0..8332ad9 100644 (file)
 #include <unistd.h>
 #include <xbt/misc.h>
 
+#ifdef __cplusplus
+#include <vector>
+#endif
+
 #ifdef _WIN32
 #define MPI_CALL(type, name, args)                                                                                     \
   type name args;                                                                                                      \
@@ -1052,15 +1056,12 @@ SG_END_DECL()
 
 /* C++ declarations for shared_malloc */
 #ifdef __cplusplus
-#include <vector>
-
 XBT_PUBLIC int smpi_is_shared(void* ptr, std::vector<std::pair<size_t, size_t>>& private_blocks, size_t* offset);
 
 std::vector<std::pair<size_t, size_t>> shift_and_frame_private_blocks(const std::vector<std::pair<size_t, size_t>>& vec,
                                                                       size_t offset, size_t buff_size);
 std::vector<std::pair<size_t, size_t>> merge_private_blocks(const std::vector<std::pair<size_t, size_t>>& src,
                                                             const std::vector<std::pair<size_t, size_t>>& dst);
-
 #endif
 
 #endif 
index c17b53b..21ddf1e 100644 (file)
@@ -6,13 +6,13 @@
 #ifndef SIMGRID_LUA_HPP
 #define SIMGRID_LUA_HPP
 
-extern "C" {
-#include <lua.h>
+#include <lua.hpp>
 
 /* ********************************************************************************* */
 /*                           Plaftorm functions                                      */
 /* ********************************************************************************* */
 
+extern "C" {
 int console_open(lua_State* L);
 int console_close(lua_State* L);
 
index be180ac..e2fec6d 100644 (file)
 #include <boost/intrusive_ptr.hpp>
 
 /********************************* Simcalls *********************************/
-XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */
-
 #include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
 
+XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */
+
 typedef int (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
 typedef void (*simix_copy_data_func_t)(simgrid::kernel::activity::CommImpl*, void*, size_t);
 typedef void (*simix_clean_func_t)(void*);
index 6638b9c..c7ab73e 100644 (file)
@@ -15,6 +15,8 @@
 #include "xbt/config.hpp"
 
 #include <algorithm>
+#include <boost/algorithm/string.hpp> /* trim_right / trim_left */
+#include <boost/tokenizer.hpp>
 #include <cfloat> /* DBL_MAX */
 #include <cinttypes>
 #include <cstdint> /* intmax_t */
 #include <fstream>
 #include <sys/stat.h>
 
+#if SG_HAVE_SENDFILE
+#include <sys/sendfile.h>
+#endif
+
+#if HAVE_PAPI
+#include "papi.h"
+#endif
+
 #if not defined(__APPLE__) && not defined(__HAIKU__)
 #include <link.h>
 #endif
@@ -39,13 +49,7 @@ constexpr bool HAVE_WORKING_MMAP = false;
 constexpr bool HAVE_WORKING_MMAP = true;
 #endif
 
-#if SG_HAVE_SENDFILE
-#include <sys/sendfile.h>
-#endif
-
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)");
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp> /* trim_right / trim_left */
 
 #if SMPI_IFORT
   extern "C" void for_rtl_init_ (int *, char **);
@@ -68,7 +72,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke
 #endif
 
 #if HAVE_PAPI
-#include "papi.h"
 std::string papi_default_config_name = "default";
 std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
 #endif