From: Arnaud Giersch Date: Wed, 3 Jul 2019 08:18:46 +0000 (+0200) Subject: [sonar] Move all #include directives before any code for C++ too. X-Git-Tag: v3.23.2~29 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/647b236abe6aacb7f3881369d4cb63e27b75aa8f?hp=f0b6b515efe437925562a02a60738d10cdeff63a [sonar] Move all #include directives before any code for C++ too. --- diff --git a/include/simgrid/plugins/file_system.h b/include/simgrid/plugins/file_system.h index 961331e8ad..099cf337fb 100644 --- a/include/simgrid/plugins/file_system.h +++ b/include/simgrid/plugins/file_system.h @@ -10,6 +10,14 @@ #include #include +#ifdef __cplusplus +#include + +#include +#include +#include +#endif + // C interface //////////////// typedef sg_file_t msg_file_t; // MSG backwards compatibility @@ -70,11 +78,6 @@ SG_END_DECL() ////////////////// #ifdef __cplusplus -#include - -#include -#include -#include namespace simgrid { namespace s4u { diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index c8a96e0baf..8332ad98e8 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -15,6 +15,10 @@ #include #include +#ifdef __cplusplus +#include +#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 - XBT_PUBLIC int smpi_is_shared(void* ptr, std::vector>& private_blocks, size_t* offset); std::vector> shift_and_frame_private_blocks(const std::vector>& vec, size_t offset, size_t buff_size); std::vector> merge_private_blocks(const std::vector>& src, const std::vector>& dst); - #endif #endif diff --git a/src/bindings/lua/simgrid_lua.hpp b/src/bindings/lua/simgrid_lua.hpp index c17b53b35c..21ddf1e913 100644 --- a/src/bindings/lua/simgrid_lua.hpp +++ b/src/bindings/lua/simgrid_lua.hpp @@ -6,13 +6,13 @@ #ifndef SIMGRID_LUA_HPP #define SIMGRID_LUA_HPP -extern "C" { -#include +#include /* ********************************************************************************* */ /* Plaftorm functions */ /* ********************************************************************************* */ +extern "C" { int console_open(lua_State* L); int console_close(lua_State* L); diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index be180ac81b..e2fec6dacf 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -12,10 +12,10 @@ #include /********************************* 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*); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 6638b9cf75..c7ab73e5bc 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -15,6 +15,8 @@ #include "xbt/config.hpp" #include +#include /* trim_right / trim_left */ +#include #include /* DBL_MAX */ #include #include /* intmax_t */ @@ -23,6 +25,14 @@ #include #include +#if SG_HAVE_SENDFILE +#include +#endif + +#if HAVE_PAPI +#include "papi.h" +#endif + #if not defined(__APPLE__) && not defined(__HAIKU__) #include #endif @@ -39,13 +49,7 @@ constexpr bool HAVE_WORKING_MMAP = false; constexpr bool HAVE_WORKING_MMAP = true; #endif -#if SG_HAVE_SENDFILE -#include -#endif - XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)"); -#include -#include /* 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 units2papi_setup; #endif