From 0d98fca8e1006006daacc8746c5eccd1837f3b2c Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 17 Oct 2020 21:34:15 +0200 Subject: [PATCH] Don't include when it's not needed. This aims to reduce the need for C++14 in user codes. --- include/simgrid/s4u/Actor.hpp | 1 - include/simgrid/s4u/Engine.hpp | 2 -- include/simgrid/simix.h | 2 +- src/bindings/lua/lua_host.cpp | 1 + src/instr/instr_paje_events.hpp | 1 + src/kernel/routing/NetPoint.cpp | 1 + src/plugins/link_energy.cpp | 2 ++ src/s4u/s4u_Disk.cpp | 1 + src/s4u/s4u_Host.cpp | 1 + src/s4u/s4u_Netzone.cpp | 1 + src/s4u/s4u_Storage.cpp | 1 + src/simix/popping_generated.cpp | 1 + src/simix/simcalls.py | 1 + teshsuite/simdag/flatifier/flatifier.cpp | 1 + teshsuite/smpi/gh-139/gh-139.c | 2 +- teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp | 1 + 16 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 10538605d7..b72b576f1c 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/include/simgrid/s4u/Engine.hpp b/include/simgrid/s4u/Engine.hpp index 086849f43a..141cd5d02a 100644 --- a/include/simgrid/s4u/Engine.hpp +++ b/include/simgrid/s4u/Engine.hpp @@ -7,10 +7,8 @@ #define SIMGRID_S4U_ENGINE_HPP #include -#include #include -#include #include diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 749b0a7188..c9045ad713 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -7,7 +7,7 @@ #define SIMGRID_SIMIX_H #include -#include +#include #include #include #ifdef __cplusplus diff --git a/src/bindings/lua/lua_host.cpp b/src/bindings/lua/lua_host.cpp index 05baee23a8..66861f2768 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -8,6 +8,7 @@ #include "lua_private.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" +#include "xbt/asserts.h" #include constexpr char HOST_MODULE_NAME[] = "simgrid.host"; diff --git a/src/instr/instr_paje_events.hpp b/src/instr/instr_paje_events.hpp index 74e63799d5..2527bd7266 100644 --- a/src/instr/instr_paje_events.hpp +++ b/src/instr/instr_paje_events.hpp @@ -8,6 +8,7 @@ #include "src/instr/instr_private.hpp" #include "src/internal_config.h" +#include #include #include diff --git a/src/kernel/routing/NetPoint.cpp b/src/kernel/routing/NetPoint.cpp index 6ff888d333..77433ff7d8 100644 --- a/src/kernel/routing/NetPoint.cpp +++ b/src/kernel/routing/NetPoint.cpp @@ -6,6 +6,7 @@ #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" +#include "xbt/log.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf"); diff --git a/src/plugins/link_energy.cpp b/src/plugins/link_energy.cpp index 23c4dde639..a16cd8363c 100644 --- a/src/plugins/link_energy.cpp +++ b/src/plugins/link_energy.cpp @@ -4,8 +4,10 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/Exception.hpp" +#include "simgrid/host.h" #include "simgrid/plugins/energy.h" #include "simgrid/s4u/Engine.hpp" +#include "simgrid/simix.hpp" #include "src/surf/network_interface.hpp" #include "src/surf/surf_interface.hpp" #include "surf/surf.hpp" diff --git a/src/s4u/s4u_Disk.cpp b/src/s4u/s4u_Disk.cpp index d75db46246..e2fdecfaf7 100644 --- a/src/s4u/s4u_Disk.cpp +++ b/src/s4u/s4u_Disk.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Io.hpp" +#include "simgrid/simix.hpp" #include "src/kernel/resource/DiskImpl.hpp" namespace simgrid { diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 846790fadf..ef68c79974 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -3,6 +3,7 @@ /* 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. */ +#include "simgrid/host.h" #include "simgrid/kernel/routing/NetPoint.hpp" #include "simgrid/s4u/Actor.hpp" #include "simgrid/s4u/Engine.hpp" diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 6109f66430..8ab5462637 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/NetZone.hpp" +#include "simgrid/simix.hpp" #include "simgrid/zone.h" namespace simgrid { diff --git a/src/s4u/s4u_Storage.cpp b/src/s4u/s4u_Storage.cpp index dfd02fd22d..0727b79881 100644 --- a/src/s4u/s4u_Storage.cpp +++ b/src/s4u/s4u_Storage.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/Io.hpp" #include "simgrid/s4u/Storage.hpp" +#include "simgrid/simix.hpp" #include "simgrid/storage.h" #include "src/surf/StorageImpl.hpp" diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 6d37c91957..179e262659 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -15,6 +15,7 @@ */ #include "smx_private.hpp" +#include #include #if SIMGRID_HAVE_MC #include "src/mc/mc_forward.hpp" diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index a0803c9be8..77add25b63 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -314,6 +314,7 @@ if __name__ == '__main__': fd = header("popping_generated.cpp") fd.write('#include "smx_private.hpp"\n') + fd.write('#include \n') fd.write('#include \n') fd.write('#if SIMGRID_HAVE_MC\n') fd.write('#include "src/mc/mc_forward.hpp"\n') diff --git a/teshsuite/simdag/flatifier/flatifier.cpp b/teshsuite/simdag/flatifier/flatifier.cpp index 757d5ed212..0c02db1011 100644 --- a/teshsuite/simdag/flatifier/flatifier.cpp +++ b/teshsuite/simdag/flatifier/flatifier.cpp @@ -12,6 +12,7 @@ #include "src/surf/network_interface.hpp" #include +#include XBT_LOG_NEW_DEFAULT_CATEGORY(flatifier, "Logging specific to this platform parsing tool"); diff --git a/teshsuite/smpi/gh-139/gh-139.c b/teshsuite/smpi/gh-139/gh-139.c index 4f504340e3..645fad60f7 100644 --- a/teshsuite/smpi/gh-139/gh-139.c +++ b/teshsuite/smpi/gh-139/gh-139.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include XBT_LOG_NEW_DEFAULT_CATEGORY(smpi_test, "Messages specific for this SMPI example"); diff --git a/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp b/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp index 6a0af88302..eeb5d4de88 100644 --- a/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp +++ b/teshsuite/xbt/parallel_log_crashtest/parallel_log_crashtest.cpp @@ -6,6 +6,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/s4u/Engine.hpp" +#include "xbt/log.h" #include #include -- 2.20.1