From 9b54bc45159da31207b7d0fed8b3b604a825414d Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Thu, 8 Aug 2024 13:53:19 +0000 Subject: [PATCH] Change the clang formatting version number from 13 to 18. --- CONTRIBUTING.md | 2 +- INSTALL.swift | 2 +- README.md | 2 +- format.sh | 8 +++--- src/adiabatic_index.h | 30 +++++++++---------- src/common_io_copy.c | 4 +-- src/const.h | 20 ++++++------- src/distributed_io.c | 2 +- src/engine.c | 5 ++-- src/engine_config.c | 5 ++-- src/fof.c | 6 ++-- src/hydro/Planetary/hydro_io.h | 9 +++--- src/hydro/Shadowswift/voronoi3d_algorithm.h | 4 +-- src/io_properties.h | 6 ++-- src/lightcone/lightcone.c | 2 +- src/lightcone/lightcone_crossing.h | 2 +- src/lightcone/lightcone_replications.c | 4 +-- src/lightcone/lightcone_shell.c | 2 +- src/lock.h | 5 ++-- src/memuse.c | 10 ++++--- src/mpiuse.c | 10 ++++--- src/parallel_io.c | 2 +- src/partition.c | 31 ++++++++++++-------- src/power_spectrum.c | 4 +-- src/rt/GEAR/rt.h | 4 +-- src/rt/SPHM1RT/rt.h | 6 ++-- src/rt/debug/rt.h | 4 +-- src/rt/none/rt.h | 4 +-- src/runner_black_holes.c | 12 ++++---- src/runner_doiact_functions_black_holes.h | 16 +++++------ src/runner_doiact_functions_hydro.h | 32 ++++++++++----------- src/runner_doiact_functions_limiter.h | 12 ++++---- src/runner_doiact_functions_stars.h | 22 +++++++------- src/runner_doiact_grav.c | 2 +- src/runner_doiact_nosort.h | 2 +- src/runner_others.c | 4 +-- src/runner_sinks.c | 18 ++++++------ src/scheduler.c | 20 +++++++------ src/scheduler.h | 24 ++++++++++------ src/space_regrid.c | 2 +- src/space_split.c | 2 +- src/task.c | 32 ++++++++++----------- src/tools.c | 16 +++++++---- 43 files changed, 220 insertions(+), 191 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6db6cfbdaa..dcf0a7d693 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 6aba15db9d..12e7372509 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 e8aab51c86..8ef3fe31f0 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 6070fd1a1a..601c2f5442 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 a623d40722..d303c1805b 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 fdca65cce9..38d128a145 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 429fe2275a..9cf25776e4 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 72bf633025..483eeb1631 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 7a335c9573..f3109a082f 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 fb18cc48cb..0da7f2e55e 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 e83ebec0cd..6594b2b60e 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 b43b5f37a3..5b291114be 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 37d7730545..449e1f22a3 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 4f9bc49294..78aa94cb21 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 8c244b0c71..d04076384a 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 78777f1ff0..226fbfa3b8 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 f65044814c..22ec701d92 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 e3ac45885f..51d07bd8b7 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 39601b0c52..e350303fe9 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 29844fda0e..b5d125dbd5 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 7d00934226..96d634de3e 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 cc024dd652..51b0dac1cb 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 e4d544d4c5..52654d09dc 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 2f252fca48..f6693c7c5a 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 802a1fa449..e2d6b8272d 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 0cb2b94202..810dc0a759 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 cf14510431..ddac996526 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 6254cb4040..d3c1f7c5d4 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 aebef16591..ca5dc32461 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 09ef41e852..cbfa9c78ed 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 eff6702b82..1bcf1af207 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 44f6572b42..0d7e07de6a 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 c09811da10..b91066f509 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 e2f50d7214..fb4fef6bd1 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 4b500fe2e6..51d2412d0f 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 06568b7da4..725ef3ca1a 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 cd9fd0c4cc..97d3a5ad4b 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 8a8c3c0240..2b156f8250 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 eb332bf8d1..6ea7b41d58 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 95fa4d9cd9..487fe7c0e3 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 0b79d5b23f..43e020d5e5 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 8754535d37..34db33db4e 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 b58889a4f5..03c4e29325 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]; -- GitLab