diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6db6cfbdaacd8f68cbd505b07a3982e8409fb5f9..dcf0a7d693e07e861be292b32cf1b7debfe7fcf2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,5 @@
 The SWIFT source code is using a variation of the 'Google' formatting style. 
-The script 'format.sh' in the root directory applies the clang-format-13
+The script 'format.sh' in the root directory applies the clang-format-18
 tool with our style choices to all the SWIFT C source file. Please apply 
 the formatting script to the files before submitting a merge request.
 
diff --git a/INSTALL.swift b/INSTALL.swift
index 6aba15db9d64d5a3ef0dec744554afdba3ba933a..12e7372509601d74cbe8252cba3767c71ed0bc39 100644
--- a/INSTALL.swift
+++ b/INSTALL.swift
@@ -191,7 +191,7 @@ before you can build it.
                              ==================
 
 The SWIFT source code uses a variation of 'Google' style. The script
-'format.sh' in the root directory applies the clang-format-13 tool with our
+'format.sh' in the root directory applies the clang-format-18 tool with our
 style choices to all the SWIFT C source file. Please apply the formatting
 script to the files before submitting a merge request.
 
diff --git a/README.md b/README.md
index e8aab51c8662eaaf40bd9d4a6eff9e0cfb92c77d..8ef3fe31f0d0a26753db9ec1a74d4389312564c6 100644
--- a/README.md
+++ b/README.md
@@ -81,7 +81,7 @@ Contribution Guidelines
 -----------------------
 
 The SWIFT source code uses a variation of the 'Google' formatting style.
-The script 'format.sh' in the root directory applies the clang-format-13
+The script 'format.sh' in the root directory applies the clang-format-18
 tool with our style choices to all the SWIFT C source file. Please apply
 the formatting script to the files before submitting a pull request.
 
diff --git a/format.sh b/format.sh
index 6070fd1a1a5cbd99b877b6c6169e209caa8165e7..601c2f54428d405f78afb9d1e947dfb6cab05784 100755
--- a/format.sh
+++ b/format.sh
@@ -1,16 +1,16 @@
 #!/bin/bash
 
 # The clang-format command can be overridden using CLANG_FORMAT_CMD.
-# We currrently use version 13.0 so any overrides should use that version
+# We currrently use version 18.0 so any overrides should use that version
 # or one known to be compatible with it for instance if your standard
-# command is version 13 use:
+# command is version 18 use:
 #    CLANG_FORMAT_CMD=clang-format ./format.sh
-clang=${CLANG_FORMAT_CMD:="clang-format-13"}
+clang=${CLANG_FORMAT_CMD:="clang-format-18"}
 
 # Formatting command
 cmd="$clang -style=file $(git ls-files | grep '\.[ch]$')"
 
-# Test if `clang-format-13` works
+# Test if `clang-format-18` works
 command -v $clang > /dev/null
 if [[ $? -ne 0 ]]
 then
diff --git a/src/adiabatic_index.h b/src/adiabatic_index.h
index a623d40722278b41181642617f223218c1b5f156..d303c1805b0f50059558e4790e82c656ddaf1bff 100644
--- a/src/adiabatic_index.h
+++ b/src/adiabatic_index.h
@@ -117,8 +117,8 @@ __attribute__((always_inline, const)) INLINE static float pow_gamma(float x) {
   const float icbrt = icbrtf(x); /* x^(-1/3) */
   return icbrt * x * x;          /* x^(5/3) */
 #else
-  const float cbrt = cbrtf(x);                 /* x^(1/3) */
-  return cbrt * cbrt * x;                      /* x^(5/3) */
+  const float cbrt = cbrtf(x); /* x^(1/3) */
+  return cbrt * cbrt * x;      /* x^(5/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_7_5)
@@ -128,10 +128,10 @@ __attribute__((always_inline, const)) INLINE static float pow_gamma(float x) {
 #elif defined(HYDRO_GAMMA_4_3)
 
 #ifdef WITH_ICBRTF
-  const float icbrt = icbrtf(x);               /* x^(-1/3) */
-  return icbrt * icbrt * x * x;                /* x^(4/3) */
+  const float icbrt = icbrtf(x); /* x^(-1/3) */
+  return icbrt * icbrt * x * x;  /* x^(4/3) */
 #else
-  return cbrtf(x) * x;                   /* x^(4/3) */
+  return cbrtf(x) * x; /* x^(4/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_2_1)
@@ -161,8 +161,8 @@ __attribute__((always_inline, const)) INLINE static float pow_gamma_minus_one(
   const float icbrt = icbrtf(x); /* x^(-1/3) */
   return x * icbrt;              /* x^(2/3) */
 #else
-  const float cbrt = cbrtf(x);                 /* x^(1/3) */
-  return cbrt * cbrt;                          /* x^(2/3) */
+  const float cbrt = cbrtf(x); /* x^(1/3) */
+  return cbrt * cbrt;          /* x^(2/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_7_5)
@@ -172,10 +172,10 @@ __attribute__((always_inline, const)) INLINE static float pow_gamma_minus_one(
 #elif defined(HYDRO_GAMMA_4_3)
 
 #ifdef WITH_ICBRTF
-  const float icbrt = icbrtf(x);               /* x^(-1/3) */
-  return x * icbrt * icbrt;                    /* x^(1/3) */
+  const float icbrt = icbrtf(x); /* x^(-1/3) */
+  return x * icbrt * icbrt;      /* x^(1/3) */
 #else
-  return cbrtf(x);                       /* x^(1/3) */
+  return cbrtf(x); /* x^(1/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_2_1)
@@ -205,8 +205,8 @@ pow_minus_gamma_minus_one(float x) {
   const float icbrt = icbrtf(x); /* x^(-1/3) */
   return icbrt * icbrt;          /* x^(-2/3) */
 #else
-  const float cbrt_inv = 1.f / cbrtf(x);       /* x^(-1/3) */
-  return cbrt_inv * cbrt_inv;                  /* x^(-2/3) */
+  const float cbrt_inv = 1.f / cbrtf(x); /* x^(-1/3) */
+  return cbrt_inv * cbrt_inv;            /* x^(-2/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_7_5)
@@ -216,9 +216,9 @@ pow_minus_gamma_minus_one(float x) {
 #elif defined(HYDRO_GAMMA_4_3)
 
 #ifdef WITH_ICBRTF
-  return icbrtf(x);                            /* x^(-1/3) */
+  return icbrtf(x); /* x^(-1/3) */
 #else
-  return 1.f / cbrtf(x);                 /* x^(-1/3) */
+  return 1.f / cbrtf(x); /* x^(-1/3) */
 #endif  // WITH_ICBRTF
 
 #elif defined(HYDRO_GAMMA_2_1)
@@ -264,7 +264,7 @@ __attribute__((always_inline, const)) INLINE static float pow_minus_gamma(
 #elif defined(HYDRO_GAMMA_4_3)
 
 #ifdef WITH_ICBRTF
-  const float cbrt_inv = icbrtf(x);            /* x^(-1/3) */
+  const float cbrt_inv = icbrtf(x); /* x^(-1/3) */
 #else
   const float cbrt_inv = 1.f / cbrtf(x); /* x^(-1/3) */
 #endif  // WITH_ICBRTF
diff --git a/src/common_io_copy.c b/src/common_io_copy.c
index fdca65cce98fd6c78f06167391100d81b8c878a9..38d128a14540936bfb9cd392242ca815d3afaad0 100644
--- a/src/common_io_copy.c
+++ b/src/common_io_copy.c
@@ -729,9 +729,9 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
                      threadpool_auto_chunk_size, (void*)&props);
 
     } else {
-      
+
       if (N != 0 && props.ptr_func != NULL)
-	error("Missing conversion function");
+        error("Missing conversion function");
     }
   }
 
diff --git a/src/const.h b/src/const.h
index 429fe2275a518df5c57402ab1f7276e2df39be1e..9cf25776e40b324dc2399bf7ce7ca58b41aa00fa 100644
--- a/src/const.h
+++ b/src/const.h
@@ -27,7 +27,7 @@
 
 /* Type of gradients to use (GIZMO_SPH only) */
 /* If no option is chosen, no gradients are used (first order scheme) */
-//#define GRADIENTS_SPH
+// #define GRADIENTS_SPH
 #define GRADIENTS_GIZMO
 
 /* Types of slope limiter to use (GIZMO_SPH only) */
@@ -40,11 +40,11 @@
 
 /* Options to control the movement of particles for GIZMO_SPH. */
 /* This option disables particle movement */
-//#define GIZMO_FIX_PARTICLES
+// #define GIZMO_FIX_PARTICLES
 /* Try to keep cells regular by adding a correction velocity. */
-//#define GIZMO_STEER_MOTION
+// #define GIZMO_STEER_MOTION
 /* Use the total energy instead of the thermal energy as conserved variable. */
-//#define GIZMO_TOTAL_ENERGY
+// #define GIZMO_TOTAL_ENERGY
 
 /* Options to control handling of unphysical values (GIZMO_SPH only). */
 /* In GIZMO, mass and energy (and hence density and pressure) can in principle
@@ -53,7 +53,7 @@
    If no options are selected below, we assume (and pray) that this will not
    happen, and add no restrictions to how these variables are treated. */
 /* Check for unphysical values and crash if they occur. */
-//#define GIZMO_UNPHYSICAL_ERROR
+// #define GIZMO_UNPHYSICAL_ERROR
 /* Check for unphysical values and reset them to safe values. */
 #define GIZMO_UNPHYSICAL_RESCUE
 /* Show a warning message if an unphysical value was reset (only works if
@@ -65,9 +65,9 @@
 /* Parameters that control how GIZMO handles pathological particle
    configurations. */
 /* Show a warning message if a pathological configuration has been detected. */
-//#define GIZMO_PATHOLOGICAL_WARNING
+// #define GIZMO_PATHOLOGICAL_WARNING
 /* Crash if a pathological configuration has been detected. */
-//#define GIZMO_PATHOLOGICAL_ERROR
+// #define GIZMO_PATHOLOGICAL_ERROR
 /* Maximum allowed gradient matrix condition number. If the condition number of
    the gradient matrix (defined in equation C1 in Hopkins, 2015) is larger than
    this value, we artificially increase the number of neighbours to get a more
@@ -91,16 +91,16 @@
 
 /* Options to control SHADOWFAX_SPH */
 /* This option disables cell movement */
-//#define SHADOWFAX_FIX_CELLS
+// #define SHADOWFAX_FIX_CELLS
 /* This option enables cell steering, i.e. trying to keep the cells regular by
    adding a correction to the cell velocities.*/
 #define SHADOWFAX_STEER_CELL_MOTION
 /* This option evolves the total energy instead of the thermal energy */
-//#define SHADOWFAX_TOTAL_ENERGY
+// #define SHADOWFAX_TOTAL_ENERGY
 
 /* Source terms */
 #define SOURCETERMS_NONE
-//#define SOURCETERMS_SN_FEEDBACK
+// #define SOURCETERMS_SN_FEEDBACK
 
 /* GRACKLE doesn't really like exact zeroes, so use something
  * comparatively small instead. */
diff --git a/src/distributed_io.c b/src/distributed_io.c
index 72bf63302539a2ae3974e9db8660c0247ecbb16e..483eeb1631092f01d554ad5f6dc9f22a0b24b223 100644
--- a/src/distributed_io.c
+++ b/src/distributed_io.c
@@ -62,7 +62,7 @@
 #include "xmf.h"
 
 /* Are we timing the i/o? */
-//#define IO_SPEED_MEASUREMENT
+// #define IO_SPEED_MEASUREMENT
 
 /* Max number of entries that can be written for a given particle type */
 static const int io_max_size_output_list = 100;
diff --git a/src/engine.c b/src/engine.c
index 7a335c957373d70ff379ca566f411ef980f855cd..f3109a082fdf204750b7fc483c6cf27e86ab19d4 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -3061,8 +3061,9 @@ void engine_pin(void) {
   threadpool_set_affinity_mask(entry_affinity);
 
   int pin;
-  for (pin = 0; pin < CPU_SETSIZE && !CPU_ISSET(pin, entry_affinity); ++pin)
-    ;
+  for (pin = 0; pin < CPU_SETSIZE && !CPU_ISSET(pin, entry_affinity); ++pin) {
+    /* Nothing to do here */
+  }
 
   cpu_set_t affinity;
   CPU_ZERO(&affinity);
diff --git a/src/engine_config.c b/src/engine_config.c
index fb18cc48cb175d8eb202ea9c1bc5e3ca375654f4..0da7f2e55e8d586f43ef965f619171fb8f2f9e9b 100644
--- a/src/engine_config.c
+++ b/src/engine_config.c
@@ -312,8 +312,9 @@ void engine_config(int restart, int fof, struct engine *e,
     int skip = 0;
     for (int k = 0; k < nr_affinity_cores; k++) {
       int c;
-      for (c = skip; c < CPU_SETSIZE && !CPU_ISSET(c, entry_affinity); ++c)
-        ;
+      for (c = skip; c < CPU_SETSIZE && !CPU_ISSET(c, entry_affinity); ++c) {
+        /* Nothing to do here */
+      }
       cpuid[k] = c;
       skip = c + 1;
     }
diff --git a/src/fof.c b/src/fof.c
index e83ebec0cd104abf574e798f0f736a5d1038fec9..6594b2b60efb8f7df858731f61adc60a6aa72dd3 100644
--- a/src/fof.c
+++ b/src/fof.c
@@ -65,7 +65,7 @@ int current_fof_attach_type;
 int current_fof_ignore_type;
 
 /* Are we timing calculating group properties in the FOF? */
-//#define WITHOUT_GROUP_PROPS
+// #define WITHOUT_GROUP_PROPS
 
 /**
  * @brief Properties of a group used for black hole seeding
@@ -2350,8 +2350,8 @@ void fof_calc_group_mass(struct fof_props *props, const struct space *s,
         }
 
       } /* Foreign root */
-    }   /* Particle is in a group */
-  }     /* Loop over particles */
+    } /* Particle is in a group */
+  } /* Loop over particles */
 
   size_t nsend = map.size;
   struct fof_mass_send_hashmap hashmap_mass_send = {NULL, 0};
diff --git a/src/hydro/Planetary/hydro_io.h b/src/hydro/Planetary/hydro_io.h
index b43b5f37a3544ec81de7f1ddf08e06a2ada8aa89..5b291114be59b083db2485822c216723f8c0e465 100644
--- a/src/hydro/Planetary/hydro_io.h
+++ b/src/hydro/Planetary/hydro_io.h
@@ -58,10 +58,11 @@ INLINE static void hydro_read_particles(struct part* parts,
 #endif
 
   /* Temporary warning to be printed for a few months after the change */
-  message("\n # Warning: some required field names for initial conditions were"
-          " tweaked in July 2024 to match the GADGET-2 format that SWIFT follows."
-          " Please update your scripts (e.g. download the latest WoMa package) to"
-          " match. Apologies for any inconvenience");
+  message(
+      "\n # Warning: some required field names for initial conditions were"
+      " tweaked in July 2024 to match the GADGET-2 format that SWIFT follows."
+      " Please update your scripts (e.g. download the latest WoMa package) to"
+      " match. Apologies for any inconvenience");
 
   /* List what we want to read */
   list[0] = io_make_input_field("Coordinates", DOUBLE, 3, COMPULSORY,
diff --git a/src/hydro/Shadowswift/voronoi3d_algorithm.h b/src/hydro/Shadowswift/voronoi3d_algorithm.h
index 37d7730545340a0a7afdb6fed27a351a1b654ff6..449e1f22a38939fec49a3861dbe32683cf85d315 100644
--- a/src/hydro/Shadowswift/voronoi3d_algorithm.h
+++ b/src/hydro/Shadowswift/voronoi3d_algorithm.h
@@ -31,7 +31,7 @@
 #include <string.h>
 
 /* For debugging purposes */
-//#define LOOP_CHECK 1000
+// #define LOOP_CHECK 1000
 
 #ifdef LOOP_CHECK
 /* We need to do the trickery below to get a unique counter for each call to the
@@ -75,7 +75,7 @@ __attribute__((always_inline)) INLINE int check_counter(int *counter,
 
 /* This flag activates a number of expensive geometrical checks that help
    finding bugs. */
-//#define VORONOI3D_EXPENSIVE_CHECKS
+// #define VORONOI3D_EXPENSIVE_CHECKS
 
 /* Tolerance parameter used to decide when to use more precise geometric
    criteria */
diff --git a/src/io_properties.h b/src/io_properties.h
index 4f9bc49294a0ab7f2fb567e6656bee402683c840..78aa94cb2106be5dc333bb7cdc6a9ebfe1f59d59 100644
--- a/src/io_properties.h
+++ b/src/io_properties.h
@@ -443,9 +443,9 @@ INLINE static struct io_props io_make_output_field_convert_part_(
   io_make_output_field_convert_gpart(name, type, dim, units, a_exponent, \
                                      gpart, convert, desc)
 
-#define io_make_physical_output_field_convert_gpart(                         \
-    name, type, dim, units, a_exponent, gpart, convertible, convert, desc)   \
-  io_make_output_field_convert_gpart_(name, type, dim, units, a_exponent,    \
+#define io_make_physical_output_field_convert_gpart(                          \
+    name, type, dim, units, a_exponent, gpart, convertible, convert, desc)    \
+  io_make_output_field_convert_gpart_(name, type, dim, units, a_exponent,     \
                                       sizeof(gpart[0]), gpart, convert, desc, \
                                       /*physical=*/1, convertible);
 
diff --git a/src/lightcone/lightcone.c b/src/lightcone/lightcone.c
index 8c244b0c71a3d3e00bdcf1a8baab16887c1af9ea..d04076384afbbd52f7ed294c0e1d7494db9089b2 100644
--- a/src/lightcone/lightcone.c
+++ b/src/lightcone/lightcone.c
@@ -59,7 +59,7 @@
 #include "units.h"
 
 /* Whether to dump the replication list */
-//#define DUMP_REPLICATIONS
+// #define DUMP_REPLICATIONS
 #ifdef DUMP_REPLICATIONS
 static int output_nr = 0;
 #endif
diff --git a/src/lightcone/lightcone_crossing.h b/src/lightcone/lightcone_crossing.h
index 78777f1ff09b805074110601701c4c85aa6ffc2a..226fbfa3b840678bd2cafa2e0173eb25d142a808 100644
--- a/src/lightcone/lightcone_crossing.h
+++ b/src/lightcone/lightcone_crossing.h
@@ -246,7 +246,7 @@ lightcone_check_particle_crosses(
         lightcone_buffer_map_update(props, e, gp, a_cross, x_cross);
 
     } /* Next periodic replication*/
-  }   /* Next lightcone */
+  } /* Next lightcone */
 }
 
 #endif /* SWIFT_LIGHTCONE_CROSSING_H */
diff --git a/src/lightcone/lightcone_replications.c b/src/lightcone/lightcone_replications.c
index f65044814c71fb72298bf3da83404f8ac9c8ef09..22ec701d92365313a1c4dbe8e043616ab6607044 100644
--- a/src/lightcone/lightcone_replications.c
+++ b/src/lightcone/lightcone_replications.c
@@ -128,8 +128,8 @@ void replication_list_init(struct replication_list *replication_list,
             replication_list->nrep += 1;
           }
         } /* Next replication in z */
-      }   /* Next replication in y */
-    }     /* Next replication in x */
+      } /* Next replication in y */
+    } /* Next replication in x */
 
     /* Allocate storage after first pass */
     if (ipass == 0) {
diff --git a/src/lightcone/lightcone_shell.c b/src/lightcone/lightcone_shell.c
index e3ac45885fd57efa2b14a67b1d376ee44f0d1568..51d07bd8b7cc94d4d9fad8e02b94a1f375bdfb52 100644
--- a/src/lightcone/lightcone_shell.c
+++ b/src/lightcone/lightcone_shell.c
@@ -762,7 +762,7 @@ void healpix_smoothing_mapper(void *map_data, int num_elements,
               } /* Next smoothed map */
             }
           } /* Next pixel in this range */
-        }   /* Next range of pixels */
+        } /* Next range of pixels */
 
         /* Free array of pixel ranges */
         free(range);
diff --git a/src/lock.h b/src/lock.h
index 39601b0c52e414dad1a507b406c54640a254df30..e350303fe9a0da11bf02a688a3b1ac32116dde83 100644
--- a/src/lock.h
+++ b/src/lock.h
@@ -52,8 +52,9 @@
 #define lock_init(l) (*(l) = 0)
 #define lock_destroy(l) 0
 INLINE static int lock_lock(volatile int *l) {
-  while (atomic_cas(l, 0, 1) != 0)
-    ;
+  while (atomic_cas(l, 0, 1) != 0) {
+    /* Nothing to do here. */
+  }
   return 0;
 }
 #define lock_trylock(l) ((*(l)) ? 1 : atomic_cas(l, 0, 1))
diff --git a/src/memuse.c b/src/memuse.c
index 29844fda0e323a3496ee2c972e1adbcf2182d1e3..b5d125dbd5ea7eb71a51ae0ba1b72572e5b7dc3e 100644
--- a/src/memuse.c
+++ b/src/memuse.c
@@ -149,8 +149,9 @@ static void memuse_log_reallocate(size_t ind) {
         error("Failed to re-allocate memuse log.");
 
       /* Wait for all writes to the old buffer to complete. */
-      while (memuse_log_done < memuse_log_size)
-        ;
+      while (memuse_log_done < memuse_log_size) {
+        /* Nothing to do here */
+      }
 
       /* Copy to new buffer. */
       memcpy(new_log, memuse_log,
@@ -189,8 +190,9 @@ void memuse_log_allocation(const char *label, void *ptr, int allocated,
   if (ind == memuse_log_size) memuse_log_reallocate(ind);
 
   /* Other threads wait for space. */
-  while (ind > memuse_log_size)
-    ;
+  while (ind > memuse_log_size) {
+    /* Nothing to do here. */
+  }
 
   /* Guard against case when we have already overran the available new
    * space. */
diff --git a/src/mpiuse.c b/src/mpiuse.c
index 7d00934226e61372f2b10db4214da2957e823709..96d634de3ec5b1877d6ebae14bc866d544fe9ea7 100644
--- a/src/mpiuse.c
+++ b/src/mpiuse.c
@@ -123,8 +123,9 @@ static void mpiuse_log_reallocate(size_t ind) {
       error("Failed to re-allocate MPI use log.");
 
     /* Wait for all writes to the old buffer to complete. */
-    while (mpiuse_log_done < mpiuse_log_size)
-      ;
+    while (mpiuse_log_done < mpiuse_log_size) {
+      /* Nothing to do here */
+    }
 
     /* Copy to new buffer. */
     memcpy(new_log, mpiuse_log,
@@ -159,8 +160,9 @@ void mpiuse_log_allocation(int type, int subtype, void *ptr, int activation,
   if (ind == mpiuse_log_size) mpiuse_log_reallocate(ind);
 
   /* Other threads wait for space. */
-  while (ind > mpiuse_log_size)
-    ;
+  while (ind > mpiuse_log_size) {
+    /* Nothing to do here */
+  }
 
   /* Record the log. */
   mpiuse_log[ind].step = engine_current_step;
diff --git a/src/parallel_io.c b/src/parallel_io.c
index cc024dd6525f4bb4ee92bad053503b1babb6af6f..51b0dac1cb498f7d203c3d8555c4629ec3ea66f7 100644
--- a/src/parallel_io.c
+++ b/src/parallel_io.c
@@ -69,7 +69,7 @@
 #define HDF5_PARALLEL_IO_MAX_BYTES 2147000000LL
 
 /* Are we timing the i/o? */
-//#define IO_SPEED_MEASUREMENT
+// #define IO_SPEED_MEASUREMENT
 
 /* Max number of entries that can be written for a given particle type */
 static const int io_max_size_output_list = 100;
diff --git a/src/partition.c b/src/partition.c
index e4d544d4c563eee72a96c27dbacf87d4692940ee..52654d09dcd730c1ed5bedd3c164ad1afcf8bdc9 100644
--- a/src/partition.c
+++ b/src/partition.c
@@ -1417,13 +1417,17 @@ void partition_gather_weights(void *map_data, int num_elements,
 
     /* Get the top-level cells involved. */
     struct cell *ci, *cj;
-    for (ci = t->ci; ci->parent != NULL; ci = ci->parent)
-      ;
-    if (t->cj != NULL)
-      for (cj = t->cj; cj->parent != NULL; cj = cj->parent)
-        ;
-    else
+    for (ci = t->ci; ci->parent != NULL; ci = ci->parent) {
+      /* Nothing to do here. */
+    }
+
+    if (t->cj != NULL) {
+      for (cj = t->cj; cj->parent != NULL; cj = cj->parent) {
+        /* Nothing to do here. */
+      }
+    } else {
       cj = NULL;
+    }
 
     /* Get the cell IDs. */
     int cid = ci - cells;
@@ -2364,13 +2368,16 @@ static void check_weights(struct task *tasks, int nr_tasks,
 
     /* Get the top-level cells involved. */
     struct cell *ci, *cj;
-    for (ci = t->ci; ci->parent != NULL; ci = ci->parent)
-      ;
-    if (t->cj != NULL)
-      for (cj = t->cj; cj->parent != NULL; cj = cj->parent)
-        ;
-    else
+    for (ci = t->ci; ci->parent != NULL; ci = ci->parent) {
+      /* Nothing to do here */
+    }
+    if (t->cj != NULL) {
+      for (cj = t->cj; cj->parent != NULL; cj = cj->parent) {
+        /* Nothing to do here */
+      }
+    } else {
       cj = NULL;
+    }
 
     /* Get the cell IDs. */
     int cid = ci - cells;
diff --git a/src/power_spectrum.c b/src/power_spectrum.c
index 2f252fca485eacae3fdb42647d1bb9d85d1420ee..f6693c7c5a767e1711ec950b048a57ec873c9b57 100644
--- a/src/power_spectrum.c
+++ b/src/power_spectrum.c
@@ -804,8 +804,8 @@ void pow_from_grid_mapper(void* map_data, const int num, void* extra) {
                          (powgridft[index][0] * powgridft2[index][0] +
                           powgridft[index][1] * powgridft2[index][1]));
       } /* Loop over z */
-    }   /* Loop over y */
-  }     /* Loop over z */
+    } /* Loop over y */
+  } /* Loop over z */
 }
 
 /**
diff --git a/src/rt/GEAR/rt.h b/src/rt/GEAR/rt.h
index 802a1fa449fec69b54580c84d5ad87dd8658dea1..e2d6b8272d5a2585be780248fea6d93a63dd0859 100644
--- a/src/rt/GEAR/rt.h
+++ b/src/rt/GEAR/rt.h
@@ -256,7 +256,7 @@ __attribute__((always_inline)) INLINE static void rt_split_part(struct part* p,
 __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
     struct part* p) {
   message("WARNING: found particle without neighbours");
-};
+}
 
 /**
  * @brief Exception handle a star part not having any neighbours in ghost task
@@ -272,7 +272,7 @@ __attribute__((always_inline)) INLINE static void rt_spart_has_no_neighbours(
     sp->rt_data.emission_this_step[g] = 0.f;
   }
   message("WARNING: found star without neighbours");
-};
+}
 
 /**
  * @brief Do checks/conversions on particles on startup.
diff --git a/src/rt/SPHM1RT/rt.h b/src/rt/SPHM1RT/rt.h
index 0cb2b94202158d5f63df771c71e2217e08dd439d..810dc0a759e0265c12e0c472f816fe7bd46c14d1 100644
--- a/src/rt/SPHM1RT/rt.h
+++ b/src/rt/SPHM1RT/rt.h
@@ -103,7 +103,7 @@ __attribute__((always_inline)) INLINE static void rt_reset_part_each_subcycle(
     rt_check_unphysical_state(&rpd->conserved[g].urad, rpd->conserved[g].frad,
                               urad_old, cred);
   }
-};
+}
 
 /**
  * @brief First initialisation of the RT hydro particle data.
@@ -196,7 +196,7 @@ __attribute__((always_inline)) INLINE static void rt_split_part(struct part* p,
 __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
     struct part* p) {
   message("WARNING: found particle without neighbours");
-};
+}
 
 /**
  * @brief Exception handle a star part not having any neighbours in ghost task
@@ -206,7 +206,7 @@ __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
 __attribute__((always_inline)) INLINE static void rt_spart_has_no_neighbours(
     struct spart* sp) {
   message("WARNING: found star without neighbours");
-};
+}
 
 /**
  * @brief Do checks/conversions on particles on startup.
diff --git a/src/rt/debug/rt.h b/src/rt/debug/rt.h
index cf14510431988fa127d1fbff06c0d066ea9099b9..ddac996526ae07ed4c04b9e9394f137c3a390962 100644
--- a/src/rt/debug/rt.h
+++ b/src/rt/debug/rt.h
@@ -172,7 +172,7 @@ __attribute__((always_inline)) INLINE static void rt_split_part(struct part* p,
 __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
     struct part* p) {
   message("WARNING: found particle without neighbours");
-};
+}
 
 /**
  * @brief Exception handle a star part not having any neighbours in ghost task
@@ -180,7 +180,7 @@ __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
  * @param sp The #spart.
  */
 __attribute__((always_inline)) INLINE static void rt_spart_has_no_neighbours(
-    struct spart* sp){};
+    struct spart* sp) {}
 
 /**
  * @brief Do checks/conversions on particles on startup.
diff --git a/src/rt/none/rt.h b/src/rt/none/rt.h
index 6254cb4040b8d530141e5bd6ad0e9d169f3229ad..d3c1f7c5d454655af2688a9c42230305817e0dba 100644
--- a/src/rt/none/rt.h
+++ b/src/rt/none/rt.h
@@ -136,7 +136,7 @@ __attribute__((always_inline)) INLINE static void rt_split_part(struct part* p,
  * @param p The #part.
  */
 __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
-    struct part* p){};
+    struct part* p) {}
 
 /**
  * @brief Exception handle a star part not having any neighbours in ghost task
@@ -144,7 +144,7 @@ __attribute__((always_inline)) INLINE static void rt_part_has_no_neighbours(
  * @param sp The #spart.
  */
 __attribute__((always_inline)) INLINE static void rt_spart_has_no_neighbours(
-    struct spart* sp){};
+    struct spart* sp) {}
 
 /**
  * @brief Do checks/conversions on particles on startup.
diff --git a/src/runner_black_holes.c b/src/runner_black_holes.c
index aebef16591aa6feaff1d12c26f0733e4a7cad0d4..ca5dc32461cbec5ebc758e2b492a153783a04714 100644
--- a/src/runner_black_holes.c
+++ b/src/runner_black_holes.c
@@ -211,7 +211,7 @@ void runner_do_gas_swallow(struct runner *r, struct cell *c, int timer) {
               break;
             }
           } /* Loop over foreign BHs */
-        }   /* Is the cell local? */
+        } /* Is the cell local? */
 #endif
 
         /* If we have a local particle, we must have found the BH in one
@@ -221,8 +221,8 @@ void runner_do_gas_swallow(struct runner *r, struct cell *c, int timer) {
                 p->id, swallow_id);
         }
       } /* Part was flagged for swallowing */
-    }   /* Loop over the parts */
-  }     /* Cell is not split */
+    } /* Loop over the parts */
+  } /* Cell is not split */
 }
 
 /**
@@ -449,7 +449,7 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
               break;
             }
           } /* Loop over foreign BHs */
-        }   /* Is the cell local? */
+        } /* Is the cell local? */
 #endif
 
         /* If we have a local particle, we must have found the BH in one
@@ -460,8 +460,8 @@ void runner_do_bh_swallow(struct runner *r, struct cell *c, int timer) {
         }
 
       } /* Part was flagged for swallowing */
-    }   /* Loop over the parts */
-  }     /* Cell is not split */
+    } /* Loop over the parts */
+  } /* Cell is not split */
 }
 
 /**
diff --git a/src/runner_doiact_functions_black_holes.h b/src/runner_doiact_functions_black_holes.h
index 09ef41e8522baf4b033426d15f77234b3de59bec..cbfa9c78edabd7d4014fcbd59a710410ac522284 100644
--- a/src/runner_doiact_functions_black_holes.h
+++ b/src/runner_doiact_functions_black_holes.h
@@ -116,8 +116,8 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) {
           }
         }
       } /* loop over the parts in ci. */
-    }   /* loop over the bparts in ci. */
-  }     /* Do we have gas particles in the cell? */
+    } /* loop over the bparts in ci. */
+  } /* Do we have gas particles in the cell? */
 
   /* When doing BH swallowing, we need a quick loop also over the BH
    * neighbours */
@@ -177,7 +177,7 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) {
         }
       }
     } /* loop over the bparts in ci. */
-  }   /* loop over the bparts in ci. */
+  } /* loop over the bparts in ci. */
 
 #endif /* (FUNCTION_TASK_LOOP == TASK_LOOP_SWALLOW) */
 
@@ -286,8 +286,8 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci,
           }
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the bparts in ci. */
-  }     /* Do we have gas particles in the cell? */
+    } /* loop over the bparts in ci. */
+  } /* Do we have gas particles in the cell? */
 
   /* When doing BH swallowing, we need a quick loop also over the BH
    * neighbours */
@@ -347,7 +347,7 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci,
         }
       }
     } /* loop over the bparts in cj. */
-  }   /* loop over the bparts in ci. */
+  } /* loop over the bparts in ci. */
 
 #endif /* (FUNCTION_TASK_LOOP == TASK_LOOP_SWALLOW) */
 }
@@ -469,7 +469,7 @@ void DOPAIR1_SUBSET_BH_NAIVE(struct runner *r, struct cell *restrict ci,
         }
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 }
 
 /**
@@ -557,7 +557,7 @@ void DOSELF1_SUBSET_BH(struct runner *r, struct cell *restrict ci,
         }
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 }
 
 /**
diff --git a/src/runner_doiact_functions_hydro.h b/src/runner_doiact_functions_hydro.h
index eff6702b82e0007e28157864c93a93b435619960..1bcf1af20777fd97ad7756603ffa3fb5babc3168 100644
--- a/src/runner_doiact_functions_hydro.h
+++ b/src/runner_doiact_functions_hydro.h
@@ -156,7 +156,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOPAIR);
 }
@@ -310,7 +310,7 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci,
         }
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOPAIR);
 }
@@ -451,7 +451,7 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOSELF);
 }
@@ -592,7 +592,7 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) {
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOSELF);
 }
@@ -694,7 +694,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(timer_dopair_subset_naive);
 }
@@ -803,7 +803,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the parts in ci. */
+    } /* loop over the parts in ci. */
   }
 
   /* Parts are on the right. */
@@ -869,7 +869,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the parts in ci. */
+    } /* loop over the parts in ci. */
   }
 
   TIMER_TOC(timer_dopair_subset);
@@ -1036,7 +1036,7 @@ void DOSELF_SUBSET(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(timer_doself_subset);
 }
@@ -1219,8 +1219,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the parts in ci. */
-  }     /* Cell ci is active */
+    } /* loop over the parts in ci. */
+  } /* Cell ci is active */
 
   if (CELL_IS_ACTIVE(cj, e)) {
 
@@ -1319,8 +1319,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
 #endif
         }
       } /* loop over the parts in ci. */
-    }   /* loop over the parts in cj. */
-  }     /* Cell cj is active */
+    } /* loop over the parts in cj. */
+  } /* Cell cj is active */
 
   TIMER_TOC(TIMER_DOPAIR);
 }
@@ -1741,8 +1741,8 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
           }
         }
       } /* loop over the parts in cj. */
-    }   /* Is pi active? */
-  }     /* Loop over all ci */
+    } /* Is pi active? */
+  } /* Loop over all ci */
 
   /* Loop over *all* the parts in cj starting from the centre until
      we are out of range of anything in ci (using the maximal hj). */
@@ -1958,8 +1958,8 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
           }
         }
       } /* loop over the parts in ci. */
-    }   /* Is pj active? */
-  }     /* Loop over all cj */
+    } /* Is pj active? */
+  } /* Loop over all cj */
 
   /* Clean-up if necessary */  // MATTHIEU: temporary disable this optimization
   if (CELL_IS_ACTIVE(ci, e))   // && !cell_is_all_active_hydro(ci, e))
diff --git a/src/runner_doiact_functions_limiter.h b/src/runner_doiact_functions_limiter.h
index 44f6572b42dbf15b71b65ad3b1db9d60d6c63f83..0d7e07de6aff448ffdf1645bf4cdeaec85094fcc 100644
--- a/src/runner_doiact_functions_limiter.h
+++ b/src/runner_doiact_functions_limiter.h
@@ -123,7 +123,7 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci,
       }
 
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOPAIR);
 }
@@ -216,7 +216,7 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) {
         IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(TIMER_DOSELF);
 }
@@ -355,8 +355,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
           IACT_NONSYM(r2, dx, hi, hj, pi, pj, a, H);
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the parts in ci. */
-  }     /* Cell ci is active */
+    } /* loop over the parts in ci. */
+  } /* Cell ci is active */
 
   if (cell_is_starting_hydro(cj, e)) {
 
@@ -439,8 +439,8 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid,
           IACT_NONSYM(r2, dx, hj, hi, pj, pi, a, H);
         }
       } /* loop over the parts in ci. */
-    }   /* loop over the parts in cj. */
-  }     /* Cell cj is active */
+    } /* loop over the parts in cj. */
+  } /* Cell cj is active */
 
   TIMER_TOC(TIMER_DOPAIR);
 }
diff --git a/src/runner_doiact_functions_stars.h b/src/runner_doiact_functions_stars.h
index c09811da106d89746e332f159e03d04910183e34..b91066f509b9364288ef6ff70e58eebab6150072 100644
--- a/src/runner_doiact_functions_stars.h
+++ b/src/runner_doiact_functions_stars.h
@@ -150,7 +150,7 @@ void DOSELF1_STARS(struct runner *r, struct cell *c, int timer) {
 #endif
       }
     } /* loop over the parts in ci. */
-  }   /* loop over the sparts in ci. */
+  } /* loop over the sparts in ci. */
 
   TIMER_TOC(TIMER_DOSELF_STARS);
 }
@@ -280,7 +280,7 @@ void DO_NONSYM_PAIR1_STARS_NAIVE(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 }
 
 /**
@@ -475,8 +475,8 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the parts in ci. */
-  }     /* do_ci_stars */
+    } /* loop over the parts in ci. */
+  } /* do_ci_stars */
 
   if (do_cj_stars) {
     /* Pick-out the sorted lists. */
@@ -629,8 +629,8 @@ void DO_SYM_PAIR1_STARS(struct runner *r, struct cell *ci, struct cell *cj,
 #endif
         }
       } /* loop over the parts in ci. */
-    }   /* loop over the parts in cj. */
-  }     /* Cell cj is active */
+    } /* loop over the parts in cj. */
+  } /* Cell cj is active */
 
   TIMER_TOC(TIMER_DOPAIR_STARS);
 }
@@ -755,7 +755,7 @@ void DOPAIR1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the sparts in ci. */
+    } /* loop over the sparts in ci. */
   }
 
   /* Sparts are on the right. */
@@ -818,7 +818,7 @@ void DOPAIR1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
 #endif
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the sparts in ci. */
+    } /* loop over the sparts in ci. */
   }
 }
 
@@ -916,7 +916,7 @@ void DOPAIR1_SUBSET_STARS_NAIVE(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 }
 
 /**
@@ -1003,7 +1003,7 @@ void DOSELF1_SUBSET_STARS(struct runner *r, struct cell *restrict ci,
 #endif
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 }
 
 /**
@@ -1060,7 +1060,7 @@ void DOPAIR1_SUBSET_BRANCH_STARS(struct runner *r, struct cell *restrict ci,
   /* Get the sorting index. */
   int sid = 0;
   for (int k = 0; k < 3; k++)
-    sid = 3 * sid + ((cj->loc[k] - ci->loc[k] + shift[k] < 0) ? 0
+    sid = 3 * sid + ((cj->loc[k] - ci->loc[k] + shift[k] < 0)   ? 0
                      : (cj->loc[k] - ci->loc[k] + shift[k] > 0) ? 2
                                                                 : 1);
 
diff --git a/src/runner_doiact_grav.c b/src/runner_doiact_grav.c
index e2f50d721495cff7763e42decb9a9f4a396ae6a1..fb4fef6bd1a00e60ad2100220868e13fa347651b 100644
--- a/src/runner_doiact_grav.c
+++ b/src/runner_doiact_grav.c
@@ -2509,7 +2509,7 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci,
       multi_i->pot.interacted = 1;
 
     } /* We are in charge of this pair */
-  }   /* Loop over top-level cells */
+  } /* Loop over top-level cells */
 
   if (timer) TIMER_TOC(timer_dograv_long_range);
 }
diff --git a/src/runner_doiact_nosort.h b/src/runner_doiact_nosort.h
index 4b500fe2e6ed9da97979623313cc205775af6d6c..51d2412d0f6904dd9492798c9e126dbb02098f92 100644
--- a/src/runner_doiact_nosort.h
+++ b/src/runner_doiact_nosort.h
@@ -315,7 +315,7 @@ void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci,
         IACT_NONSYM(r2, dx, hi, pj->h, pi, pj);
       }
     } /* loop over the parts in cj. */
-  }   /* loop over the parts in ci. */
+  } /* loop over the parts in ci. */
 
   TIMER_TOC(timer_dopair_subset);
 }
diff --git a/src/runner_others.c b/src/runner_others.c
index 06568b7da4d91886020c25053ce1982f303e67b7..725ef3ca1a92ea5e6d2e708568768c8a559533cb 100644
--- a/src/runner_others.c
+++ b/src/runner_others.c
@@ -306,8 +306,8 @@ void runner_do_star_formation_sink(struct runner *r, struct cell *c,
           /* Sample the IMF to the get next target mass */
           sink_update_target_mass(s, sink_props, e, star_counter);
         } /* Loop over the stars to spawn */
-      }   /* if sink_is_active */
-    }     /* Loop over the particles */
+      } /* if sink_is_active */
+    } /* Loop over the particles */
   }
 
   /* If we formed any stars, the star sorts are now invalid. We need to
diff --git a/src/runner_sinks.c b/src/runner_sinks.c
index cd9fd0c4cca70591b58685257704a4ca4278bbe2..97d3a5ad4b62888bea8ceca85aebf9fa5f14ce86 100644
--- a/src/runner_sinks.c
+++ b/src/runner_sinks.c
@@ -109,8 +109,8 @@ void runner_doself_sinks_swallow(struct runner *r, struct cell *c, int timer) {
               e->gravity_properties, e->sink_properties);
         }
       } /* loop over the parts in ci. */
-    }   /* loop over the bparts in ci. */
-  }     /* Do we have gas particles in the cell? */
+    } /* loop over the bparts in ci. */
+  } /* Do we have gas particles in the cell? */
 
   /* When doing sink swallowing, we need a quick loop also over the sink
    * neighbours */
@@ -165,7 +165,7 @@ void runner_doself_sinks_swallow(struct runner *r, struct cell *c, int timer) {
                                               e->gravity_properties);
       }
     } /* loop over the sinks in ci. */
-  }   /* loop over the sinks in ci. */
+  } /* loop over the sinks in ci. */
 
   if (timer) TIMER_TOC(timer_doself_sink_swallow);
 }
@@ -252,8 +252,8 @@ void runner_do_nonsym_pair_sinks_naive_swallow(struct runner *r,
               e->gravity_properties, e->sink_properties);
         }
       } /* loop over the parts in cj. */
-    }   /* loop over the sinks in ci. */
-  }     /* Do we have gas particles in the cell? */
+    } /* loop over the sinks in ci. */
+  } /* Do we have gas particles in the cell? */
 
   /* When doing sink swallowing, we need a quick loop also over the sinks
    * neighbours */
@@ -308,7 +308,7 @@ void runner_do_nonsym_pair_sinks_naive_swallow(struct runner *r,
                                               e->gravity_properties);
       }
     } /* loop over the sinks in cj. */
-  }   /* loop over the sinks in ci. */
+  } /* loop over the sinks in ci. */
 }
 
 /**
@@ -682,7 +682,7 @@ void runner_do_sinks_gas_swallow(struct runner *r, struct cell *c, int timer) {
           get_integer_time_begin(ti_current + 1, p->time_bin);
       ti_beg_max = max(ti_beg, ti_beg_max);
     } /* Loop over the parts */
-  }   /* Cell is not split */
+  } /* Cell is not split */
 
   /* Update ti_beg_max. See bug fix above. */
   if (ti_beg_max != c->hydro.ti_beg_max) {
@@ -875,8 +875,8 @@ void runner_do_sinks_sink_swallow(struct runner *r, struct cell *c, int timer) {
         }
 
       } /* Part was flagged for swallowing */
-    }   /* Loop over the parts */
-  }     /* Cell is not split */
+    } /* Loop over the parts */
+  } /* Cell is not split */
 }
 
 /**
diff --git a/src/scheduler.c b/src/scheduler.c
index 8a8c3c02404235057ce6729a032131472c47e844..2b156f82501c51a417722525ce32361c41502d6a 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -81,8 +81,9 @@ static void scheduler_extend_unlocks(struct scheduler *s) {
     error("Failed to re-allocate unlocks.");
 
   /* Wait for all writes to the old buffer to complete. */
-  while (s->completed_unlock_writes < s->size_unlocks)
-    ;
+  while (s->completed_unlock_writes < s->size_unlocks) {
+    /* Nothing to do here. */
+  }
 
   /* Copy the buffers. */
   memcpy(unlocks_new, s->unlocks, sizeof(struct task *) * s->size_unlocks);
@@ -123,8 +124,9 @@ void scheduler_addunlock(struct scheduler *s, struct task *ta,
 #endif
 
   /* Wait for there to actually be space at my index. */
-  while (ind > s->size_unlocks)
-    ;
+  while (ind > s->size_unlocks) {
+    /* Nothing to do here. */
+  }
 
   /* Guard against case when more than (old) s->size_unlocks unlocks
    * are now pending. */
@@ -1379,7 +1381,7 @@ static void scheduler_splittask_hydro(struct task *t, struct scheduler *s) {
               }
       }
     } /* pair interaction? */
-  }   /* iterate over the current task. */
+  } /* iterate over the current task. */
 }
 
 /**
@@ -1454,9 +1456,9 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) {
                         s);
 
           } /* Self-gravity only */
-        }   /* Make tasks explicitly */
-      }     /* Cell is split */
-    }       /* Self interaction */
+        } /* Make tasks explicitly */
+      } /* Cell is split */
+    } /* Self interaction */
 
     /* Pair interaction? */
     else if (t->type == task_type_pair) {
@@ -1529,7 +1531,7 @@ static void scheduler_splittask_gravity(struct task *t, struct scheduler *s) {
         } /* Split the pair */
       }
     } /* pair interaction? */
-  }   /* iterate over the current task. */
+  } /* iterate over the current task. */
 }
 
 /**
diff --git a/src/scheduler.h b/src/scheduler.h
index eb332bf8d1ff5fa655d7af20dd5be1b5ae6fbcdf..6ea7b41d58037ef4e86bb779d7910d74a9a41e9a 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -202,8 +202,10 @@ scheduler_activate_send(struct scheduler *s, struct link *link,
   struct link *l = NULL;
   for (l = link;
        l != NULL && !(l->t->cj->nodeID == nodeID && l->t->subtype == subtype);
-       l = l->next)
-    ;
+       l = l->next) {
+    /* Nothing to do here */
+  }
+
   if (l == NULL) {
     error("Missing link to send task.");
   }
@@ -225,8 +227,10 @@ __attribute__((always_inline)) INLINE static struct link *
 scheduler_activate_recv(struct scheduler *s, struct link *link,
                         const enum task_subtypes subtype) {
   struct link *l = NULL;
-  for (l = link; l != NULL && l->t->subtype != subtype; l = l->next)
-    ;
+  for (l = link; l != NULL && l->t->subtype != subtype; l = l->next) {
+    /* Nothing to do here */
+  }
+
   if (l == NULL) {
     error("Missing link to recv task.");
   }
@@ -251,8 +255,10 @@ scheduler_activate_pack(struct scheduler *s, struct link *link,
   struct link *l = NULL;
   for (l = link;
        l != NULL && !(l->t->cj->nodeID == nodeID && l->t->subtype == subtype);
-       l = l->next)
-    ;
+       l = l->next) {
+    /* Nothing to do here */
+  }
+
   if (l == NULL) {
     error("Missing link to pack task.");
   }
@@ -274,8 +280,10 @@ __attribute__((always_inline)) INLINE static struct link *
 scheduler_activate_unpack(struct scheduler *s, struct link *link,
                           enum task_subtypes subtype) {
   struct link *l = NULL;
-  for (l = link; l != NULL && l->t->subtype != subtype; l = l->next)
-    ;
+  for (l = link; l != NULL && l->t->subtype != subtype; l = l->next) {
+    /* Nothing to do here */
+  }
+
   if (l == NULL) {
     error("Missing link to unpack task.");
   }
diff --git a/src/space_regrid.c b/src/space_regrid.c
index 95fa4d9cd96ea5ab1832ba2e01d6295a8320a45b..487fe7c0e38495ac85622156615308cd4179ec01 100644
--- a/src/space_regrid.c
+++ b/src/space_regrid.c
@@ -388,7 +388,7 @@ void space_regrid(struct space *s, int verbose) {
     // message( "rebuilding upper-level cells took %.3f %s." ,
     // clocks_from_ticks(double)(getticks() - tic), clocks_getunit());
 
-  }      /* re-build upper-level cells? */
+  } /* re-build upper-level cells? */
   else { /* Otherwise, just clean up the cells. */
 
     /* Free the old cells, if they were allocated. */
diff --git a/src/space_split.c b/src/space_split.c
index 0b79d5b23f126c94087b507e4073a440ed5eb95c..43e020d5e5a02b401205cfca89da7cee8bbd1ce0 100644
--- a/src/space_split.c
+++ b/src/space_split.c
@@ -439,7 +439,7 @@ void space_split_recursive(struct space *s, struct cell *c,
       gravity_multipole_compute_power(&c->grav.multipole->m_pole);
 
     } /* Deal with gravity */
-  }   /* Split or let it be? */
+  } /* Split or let it be? */
 
   /* Otherwise, collect the data from the particles this cell. */
   else {
diff --git a/src/task.c b/src/task.c
index 8754535d37fb2bf22c4dec1252c76babd2e30c61..34db33db4e9a20a1c38e859fb8cd4d0cc0d12e91 100644
--- a/src/task.c
+++ b/src/task.c
@@ -187,22 +187,22 @@ MPI_Comm subtaskMPI_comms[task_subtype_count];
  * @param ARRAY is the array of this specific type.
  * @param COUNT is the number of elements in the array.
  */
-#define TASK_CELL_OVERLAP(TYPE, ARRAY, COUNT)                           \
-  __attribute__((always_inline))                                        \
-  INLINE static size_t task_cell_overlap_##TYPE(                        \
-      const struct cell *restrict ci, const struct cell *restrict cj) { \
-                                                                        \
-    if (ci == NULL || cj == NULL) return 0;                             \
-                                                                        \
-    if (ci->ARRAY <= cj->ARRAY &&                                       \
-        ci->ARRAY + ci->COUNT >= cj->ARRAY + cj->COUNT) {               \
-      return cj->COUNT;                                                 \
-    } else if (cj->ARRAY <= ci->ARRAY &&                                \
-               cj->ARRAY + cj->COUNT >= ci->ARRAY + ci->COUNT) {        \
-      return ci->COUNT;                                                 \
-    }                                                                   \
-                                                                        \
-    return 0;                                                           \
+#define TASK_CELL_OVERLAP(TYPE, ARRAY, COUNT)                    \
+  __attribute__((always_inline)) INLINE static size_t            \
+      task_cell_overlap_##TYPE(const struct cell *restrict ci,   \
+                               const struct cell *restrict cj) { \
+                                                                 \
+    if (ci == NULL || cj == NULL) return 0;                      \
+                                                                 \
+    if (ci->ARRAY <= cj->ARRAY &&                                \
+        ci->ARRAY + ci->COUNT >= cj->ARRAY + cj->COUNT) {        \
+      return cj->COUNT;                                          \
+    } else if (cj->ARRAY <= ci->ARRAY &&                         \
+               cj->ARRAY + cj->COUNT >= ci->ARRAY + ci->COUNT) { \
+      return ci->COUNT;                                          \
+    }                                                            \
+                                                                 \
+    return 0;                                                    \
   }
 
 TASK_CELL_OVERLAP(part, hydro.parts, hydro.count);
diff --git a/src/tools.c b/src/tools.c
index b58889a4f54ccb02c03a43c327f0ce038ab90a58..03c4e29325e1c71859cc30717812d0335bc05f4b 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -155,8 +155,9 @@ void pairs_single_density(double *dim, long long int pid,
 
   /* Find "our" part. */
   int k;
-  for (k = 0; k < N && parts[k].id != pid; k++)
-    ;
+  for (k = 0; k < N && parts[k].id != pid; k++) {
+    /* Nothing to do here */
+  }
 
   /* Clear accumulators. */
   if (k == N) error("Part not found.");
@@ -730,8 +731,9 @@ void engine_single_density(const double dim[3], const long long int pid,
 
   /* Find "our" part. */
   int k;
-  for (k = 0; k < N && parts[k].id != pid; k++)
-    ;
+  for (k = 0; k < N && parts[k].id != pid; k++) {
+    /* Nothing to do here */
+  }
 
   if (k == N) error("Part not found.");
   struct part p = parts[k];
@@ -783,8 +785,10 @@ void engine_single_force(double *dim, long long int pid,
   float a = 1.f, H = 0.f;
 
   /* Find "our" part. */
-  for (k = 0; k < N && parts[k].id != pid; k++)
-    ;
+  for (k = 0; k < N && parts[k].id != pid; k++) {
+    /* Nothing to do here */
+  }
+
   if (k == N) error("Part not found.");
   p = parts[k];