From 35303514b55be4471a85d8ea9ee43575f5479461 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Wed, 15 Jun 2016 15:37:48 +0100
Subject: [PATCH] Roll-back the introducion of forward declaration where
 unnecessary

---
 src/cell.h        |  4 +++-
 src/common_io.h   |  8 +++-----
 src/parallel_io.h |  9 ++++-----
 src/scheduler.h   |  9 +++------
 src/serial_io.h   |  9 ++++-----
 src/single_io.h   |  9 ++++-----
 src/space.h       | 13 +++++++++----
 src/tools.h       | 12 +++++++-----
 8 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/src/cell.h b/src/cell.h
index ebdfc8ec5d..ad39354c6c 100644
--- a/src/cell.h
+++ b/src/cell.h
@@ -26,8 +26,10 @@
 /* Includes. */
 #include "lock.h"
 #include "multipole.h"
+#include "part.h"
+#include "task.h"
 
-/* Forward declaration of space, needed for cell_unpack. */
+/* Avoid cyclic inclusions */
 struct space;
 
 /* Max tag size set to 2^29 to take into account some MPI implementations
diff --git a/src/common_io.h b/src/common_io.h
index 08b4e4f22d..fa6811a266 100644
--- a/src/common_io.h
+++ b/src/common_io.h
@@ -25,10 +25,8 @@
 
 #if defined(HAVE_HDF5)
 
-/* Forward-declare stuff to avoid cyclic includes. */
-struct UnitSystem;
-struct part;
-struct gpart;
+#include "part.h"
+#include "units.h"
 
 /**
  * @brief The different types of data used in the GADGET IC files.
@@ -107,6 +105,6 @@ void writeXMFline(FILE* xmfFile, char* fileName, char* partTypeGroupName,
 void writeCodeDescription(hid_t h_file);
 void writeUnitSystem(hid_t h_file, struct UnitSystem* us);
 
-#endif
+#endif /* defined HDF5 */
 
 #endif /* SWIFT_COMMON_IO_H */
diff --git a/src/parallel_io.h b/src/parallel_io.h
index 5e85e09482..26757cb679 100644
--- a/src/parallel_io.h
+++ b/src/parallel_io.h
@@ -27,11 +27,10 @@
 #include <mpi.h>
 #endif
 
-/* Forward-declare stuff to avoid cyclic includes. */
-struct engine;
-struct gpart;
-struct part;
-struct UnitSystem;
+/* Includes. */
+#include "engine.h"
+#include "part.h"
+#include "units.h"
 
 #if defined(HAVE_HDF5) && defined(WITH_MPI) && defined(HAVE_PARALLEL_HDF5)
 
diff --git a/src/scheduler.h b/src/scheduler.h
index f6b358b158..62af23152e 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -32,13 +32,10 @@
 #include <pthread.h>
 
 /* Includes. */
+#include "cell.h"
 #include "lock.h"
-
-/* Forward-declare stuff to avoid cyclic includes. */
-struct cell;
-struct queue;
-struct space;
-struct task;
+#include "queue.h"
+#include "task.h"
 
 /* Some constants. */
 #define scheduler_maxwait 3
diff --git a/src/serial_io.h b/src/serial_io.h
index f3b6d7ab98..6b64624772 100644
--- a/src/serial_io.h
+++ b/src/serial_io.h
@@ -27,11 +27,10 @@
 #include <mpi.h>
 #endif
 
-/* Forward-declare stuff to avoid cyclic includes. */
-struct engine;
-struct gpart;
-struct part;
-struct UnitSystem;
+/* Includes. */
+#include "engine.h"
+#include "part.h"
+#include "units.h"
 
 #if defined(HAVE_HDF5) && defined(WITH_MPI) && !defined(HAVE_PARALLEL_HDF5)
 
diff --git a/src/single_io.h b/src/single_io.h
index ae176ce37f..d2c87655e1 100644
--- a/src/single_io.h
+++ b/src/single_io.h
@@ -22,11 +22,10 @@
 /* Config parameters. */
 #include "../config.h"
 
-/* Forward-declare stuff to avoid cyclic includes. */
-struct engine;
-struct gpart;
-struct part;
-struct UnitSystem;
+/* Includes. */
+#include "engine.h"
+#include "part.h"
+#include "units.h"
 
 #if defined(HAVE_HDF5) && !defined(WITH_MPI)
 
diff --git a/src/space.h b/src/space.h
index fec25a3593..5cfb2cb836 100644
--- a/src/space.h
+++ b/src/space.h
@@ -23,13 +23,18 @@
 #ifndef SWIFT_SPACE_H
 #define SWIFT_SPACE_H
 
-/* Includes. */
+/* Config parameters. */
+#include "../config.h"
+
+/* Some standard headers. */
 #include <stddef.h>
 
+/* Includes. */
+#include "cell.h"
 #include "lock.h"
-
-/* Forward-declare stuff to avoid cyclic includes. */
-struct swift_params;
+#include "parser.h"
+#include "part.h"
+#include "space.h"
 
 /* Some constants. */
 #define space_maxdepth 10
diff --git a/src/tools.h b/src/tools.h
index ea8eddf43f..2a4462f274 100644
--- a/src/tools.h
+++ b/src/tools.h
@@ -22,11 +22,13 @@
 #ifndef SWIFT_TOOL_H
 #define SWIFT_TOOL_H
 
-/* Forward-declare stuff to avoid cyclic includes. */
-struct cell;
-struct gpart;
-struct part;
-struct runner;
+/* Config parameters. */
+#include "../config.h"
+
+/* Includes. */
+#include "cell.h"
+#include "part.h"
+#include "runner.h"
 
 void factor(int value, int *f1, int *f2);
 void density_dump(int N);
-- 
GitLab