diff --git a/configure.ac b/configure.ac index 56018272debbb9e9ccb2f425eff45b97c358aec9..583169d146f8c7e94c45c941e006243badcefe51 100644 --- a/configure.ac +++ b/configure.ac @@ -19,9 +19,6 @@ AC_INIT([SWIFT],[0.7.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim]) swift_config_flags="$*" -# Need to define this, instead of using fifth argument of AC_INIT, until 2.64. -AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages]) - AC_COPYRIGHT AC_CONFIG_SRCDIR([src/space.c]) AC_CONFIG_AUX_DIR([.]) @@ -687,7 +684,7 @@ if test "x$with_profiler" != "xno"; then proflibs="-lprofiler" fi AC_CHECK_LIB([profiler],[ProfilerFlush], - [have_profiler="yes" + [have_profiler="yes" AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])], [have_profiler="no"], $proflibs) @@ -840,6 +837,7 @@ if test "$enable_warn" != "no"; then ;; esac + # Add a "choke on warning" flag if it exists if test "$enable_warn" = "error"; then case "$ax_cv_c_compiler_vendor" in @@ -848,6 +846,11 @@ if test "$enable_warn" != "no"; then ;; esac fi + + # We want strict-prototypes, but this must still work even if warnings + # are an error. + AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[CFLAGS="$CFLAGS -Wstrict-prototypes"], + [CFLAGS="$CFLAGS"],[$CFLAGS],[AC_LANG_SOURCE([int main(void){return 0;}])]) fi # Various package configuration options. @@ -1211,6 +1214,11 @@ AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to # Make sure the latest git revision string gets included touch src/version.c +# Need to define this, instead of using fifth argument of AC_INIT, until +# 2.64. Defer until now as this redefines PACKAGE_URL, which can emit a +# compilation error when testing with -Werror. +AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages]) + # Generate output. AC_OUTPUT diff --git a/examples/main.c b/examples/main.c index 4d59e97445af2f59cfcd947a805c2ed2a1218ad2..692eb53deb4d411b5cbbbd9ed8269e70aca066a1 100644 --- a/examples/main.c +++ b/examples/main.c @@ -54,7 +54,7 @@ struct profiler prof; /** * @brief Help messages for the command line parameters. */ -void print_help_message() { +void print_help_message(void) { printf("\nUsage: swift [OPTION]... PARAMFILE\n"); printf(" swift_mpi [OPTION]... PARAMFILE\n\n"); diff --git a/src/clocks.c b/src/clocks.c index fbaa83f15fafda23751d5d6c34d40750132287b5..cac0131acade08e41ee7ed4a22fabde49e197060 100644 --- a/src/clocks.c +++ b/src/clocks.c @@ -50,7 +50,7 @@ static int clocks_units_index = 0; static double clocks_units_scale = 1000.0; /* Local prototypes. */ -static void clocks_estimate_cpufreq(); +static void clocks_estimate_cpufreq(void); /** * @brief Get the current time. @@ -113,7 +113,7 @@ void clocks_set_cpufreq(unsigned long long freq) { * * @result the CPU frequency. */ -unsigned long long clocks_get_cpufreq() { +unsigned long long clocks_get_cpufreq(void) { if (clocks_cpufreq > 0) return clocks_cpufreq; @@ -132,7 +132,7 @@ unsigned long long clocks_get_cpufreq() { * file (probably a overestimate) or finally just use a value of 1 with * time units of ticks. */ -static void clocks_estimate_cpufreq() { +static void clocks_estimate_cpufreq(void) { #ifdef HAVE_CLOCK_GETTIME /* Try to time a nanosleep() in ticks. */ @@ -241,7 +241,7 @@ ticks clocks_to_ticks(double ms) { * * @result the current time units. */ -const char *clocks_getunit() { return clocks_units[clocks_units_index]; } +const char *clocks_getunit(void) { return clocks_units[clocks_units_index]; } /** * @brief returns the time since the start of the execution in seconds @@ -252,7 +252,7 @@ const char *clocks_getunit() { return clocks_units[clocks_units_index]; } * * @result the time since the start of the execution */ -const char *clocks_get_timesincestart() { +const char *clocks_get_timesincestart(void) { static char buffer[40]; @@ -274,7 +274,7 @@ const char *clocks_get_timesincestart() { * @result cpu time used in sysconf(_SC_CLK_TCK) ticks, usually 100/s not our * usual ticks. */ -double clocks_get_cputime_used() { +double clocks_get_cputime_used(void) { struct tms tmstic; times(&tmstic); diff --git a/src/clocks.h b/src/clocks.h index bdb3a6651e52f5b165e644015b91f96aa5812d57..f3901584774c7586d6a68b4415d6b443cb53c466 100644 --- a/src/clocks.h +++ b/src/clocks.h @@ -34,15 +34,15 @@ struct clocks_time { void clocks_gettime(struct clocks_time *time); double clocks_diff(struct clocks_time *start, struct clocks_time *end); -const char *clocks_getunit(); +const char *clocks_getunit(void); void clocks_set_cpufreq(unsigned long long freq); -unsigned long long clocks_get_cpufreq(); +unsigned long long clocks_get_cpufreq(void); double clocks_from_ticks(ticks tics); ticks clocks_to_ticks(double interval); double clocks_diff_ticks(ticks tic, ticks toc); -const char *clocks_get_timesincestart(); +const char *clocks_get_timesincestart(void); -double clocks_get_cputime_used(); +double clocks_get_cputime_used(void); #endif /* SWIFT_CLOCKS_H */ diff --git a/src/collectgroup.c b/src/collectgroup.c index b704a0a5ea33cc1c5332fc0575061ad8e38f4d21..2820ac74851912cc6b0c7d7679a7189dd94b0a7e 100644 --- a/src/collectgroup.c +++ b/src/collectgroup.c @@ -43,7 +43,7 @@ struct mpicollectgroup1 { }; /* Forward declarations. */ -static void mpicollect_create_MPI_type(); +static void mpicollect_create_MPI_type(void); /** * @brief MPI datatype for the #mpicollectgroup1 structure. @@ -60,7 +60,7 @@ static MPI_Op mpicollectgroup1_reduce_op; /** * @brief Perform any once only initialisations. Must be called once. */ -void collectgroup_init() { +void collectgroup_init(void) { #ifdef WITH_MPI /* Initialise the MPI types. */ @@ -211,7 +211,7 @@ static void mpicollectgroup1_reduce(void *in, void *inout, int *len, /** * @brief Registers any MPI collection types and reduction functions. */ -static void mpicollect_create_MPI_type() { +static void mpicollect_create_MPI_type(void) { if (MPI_Type_contiguous(sizeof(struct mpicollectgroup1), MPI_BYTE, &mpicollectgroup1_type) != MPI_SUCCESS || diff --git a/src/collectgroup.h b/src/collectgroup.h index f2014ed254fdde7ea293224751061d824782b4a7..846b48cf593cf04e13bfff1a59abe71e84bfff2c 100644 --- a/src/collectgroup.h +++ b/src/collectgroup.h @@ -45,7 +45,7 @@ struct collectgroup1 { int forcerebuild; }; -void collectgroup_init(); +void collectgroup_init(void); void collectgroup1_apply(struct collectgroup1 *grp1, struct engine *e); void collectgroup1_init(struct collectgroup1 *grp1, size_t updates, size_t g_updates, size_t s_updates, diff --git a/src/debug.c b/src/debug.c index 93d14952f523be5f1d1fa90484e9e7951f8e3f6e..05c21de0a73bba3a5e867a4265de0a5c14736a14 100644 --- a/src/debug.c +++ b/src/debug.c @@ -642,7 +642,7 @@ void getProcMemUse(long *size, long *resident, long *share, long *trs, /** * @brief Print the current memory use of the process. A la "top". */ -void printProcMemUse() { +void printProcMemUse(void) { long size; long resident; long share; diff --git a/src/debug.h b/src/debug.h index 1e482c05c5af2dfebff1a254018fb1802df6cc5d..c9d65ad06cf5307a5fd8596c9c5b6c8b83cb6d9e 100644 --- a/src/debug.h +++ b/src/debug.h @@ -51,5 +51,5 @@ void dumpCellRanks(const char *prefix, struct cell *cells_top, int nr_cells); void getProcMemUse(long *size, long *resident, long *share, long *trs, long *lrs, long *drs, long *dt); -void printProcMemUse(); +void printProcMemUse(void); #endif /* SWIFT_DEBUG_H */ diff --git a/src/engine.c b/src/engine.c index 804f2d502db1221bc45a428f1d10bb8cf8f9b785..9a7a7ede8b5c7d5633543f083d6bef451c0f0059 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5332,7 +5332,7 @@ void engine_dump_snapshot(struct engine *e) { /** * @brief Returns the initial affinity the main thread is using. */ -static cpu_set_t *engine_entry_affinity() { +static cpu_set_t *engine_entry_affinity(void) { static int use_entry_affinity = 0; static cpu_set_t entry_affinity; @@ -5351,7 +5351,7 @@ static cpu_set_t *engine_entry_affinity() { * @brief Ensure the NUMA node on which we initialise (first touch) everything * doesn't change before engine_init allocates NUMA-local workers. */ -void engine_pin() { +void engine_pin(void) { #ifdef HAVE_SETAFFINITY cpu_set_t *entry_affinity = engine_entry_affinity(); @@ -5373,7 +5373,7 @@ void engine_pin() { /** * @brief Unpins the main thread. */ -void engine_unpin() { +void engine_unpin(void) { #ifdef HAVE_SETAFFINITY pthread_t main_thread = pthread_self(); cpu_set_t *entry_affinity = engine_entry_affinity(); @@ -6217,8 +6217,12 @@ void engine_recompute_displacement_constraint(struct engine *e) { /* Get the counts of each particle types */ const long long total_nr_dm_gparts = e->total_nr_gparts - e->total_nr_parts - e->total_nr_sparts; - float count_parts[swift_type_count] = { - e->total_nr_parts, total_nr_dm_gparts, 0.f, 0.f, e->total_nr_sparts, 0.f}; + float count_parts[swift_type_count] = {(float)e->total_nr_parts, + (float)total_nr_dm_gparts, + 0.f, + 0.f, + (float)e->total_nr_sparts, + 0.f}; /* Count of particles for the two species */ const float N_dm = count_parts[1]; diff --git a/src/engine.h b/src/engine.h index 4c6a8453a30d7fea8c5431d4c399138d8b7e701d..72f440b2e3c0efe4b86c8adb3c06bbe20d1a635c 100644 --- a/src/engine.h +++ b/src/engine.h @@ -384,8 +384,8 @@ void engine_makeproxies(struct engine *e); void engine_redistribute(struct engine *e); void engine_print_policy(struct engine *e); int engine_is_done(struct engine *e); -void engine_pin(); -void engine_unpin(); +void engine_pin(void); +void engine_unpin(void); void engine_clean(struct engine *e); int engine_estimate_nr_tasks(struct engine *e); diff --git a/src/gravity.h b/src/gravity.h index 073b0b053275491c555e28a7fe91e6ce4bf64a43..6497de8294dfa3f207332ff696ddb992c875eb28 100644 --- a/src/gravity.h +++ b/src/gravity.h @@ -36,7 +36,7 @@ struct engine; struct space; void gravity_exact_force_ewald_init(double boxSize); -void gravity_exact_force_ewald_free(); +void gravity_exact_force_ewald_free(void); void gravity_exact_force_ewald_evaluate(double rx, double ry, double rz, double corr_f[3], double *corr_p); void gravity_exact_force_compute(struct space *s, const struct engine *e); diff --git a/src/hydro/Default/hydro_io.h b/src/hydro/Default/hydro_io.h index 542cc21d41741a203adacb4560c6bd701e3af758..c7a0953eba5e5c713caa4f01cb9e8bd20f6b065f 100644 --- a/src/hydro/Default/hydro_io.h +++ b/src/hydro/Default/hydro_io.h @@ -178,6 +178,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_DEFAULT_HYDRO_IO_H */ diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index 28c0eea4772f51fab35a08d43c0564472694eeeb..b6e2c32230cac682c7ca907dcada971117be55c0 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -202,6 +202,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_GADGET2_HYDRO_IO_H */ diff --git a/src/hydro/GizmoMFM/hydro_io.h b/src/hydro/GizmoMFM/hydro_io.h index 171132eacfcd43feeec57d3c16b5a458171b1d79..94127b3fa954446e8d8de804430ca7319ff35381 100644 --- a/src/hydro/GizmoMFM/hydro_io.h +++ b/src/hydro/GizmoMFM/hydro_io.h @@ -239,6 +239,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_GIZMO_MFM_HYDRO_IO_H */ diff --git a/src/hydro/GizmoMFV/hydro_io.h b/src/hydro/GizmoMFV/hydro_io.h index c1b151230f3198a30d6696e36a2704156804fdce..18f023acbaad7bddbc4b1531d47987b5faf3bac9 100644 --- a/src/hydro/GizmoMFV/hydro_io.h +++ b/src/hydro/GizmoMFV/hydro_io.h @@ -239,6 +239,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_GIZMO_MFV_HYDRO_IO_H */ diff --git a/src/hydro/Minimal/hydro_io.h b/src/hydro/Minimal/hydro_io.h index 380d6120e05acf2e015ece6f133df02fad3b761d..846462a287ca9f90b762c55a5c0d12d88632d7ff 100644 --- a/src/hydro/Minimal/hydro_io.h +++ b/src/hydro/Minimal/hydro_io.h @@ -200,6 +200,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_MINIMAL_HYDRO_IO_H */ diff --git a/src/hydro/MinimalMultiMat/hydro_io.h b/src/hydro/MinimalMultiMat/hydro_io.h index 2a5eeb6a54d079ae72e1591116a8984b0d7a6f38..a1b6afa785aee3d5e0bfd8043e259ff65ccfcc70 100644 --- a/src/hydro/MinimalMultiMat/hydro_io.h +++ b/src/hydro/MinimalMultiMat/hydro_io.h @@ -204,6 +204,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_MINIMAL_MULTI_MAT_HYDRO_IO_H */ diff --git a/src/hydro/PressureEnergy/hydro_io.h b/src/hydro/PressureEnergy/hydro_io.h index 776e7653ac3152e1594f25a33796a470dfcf69d3..521f0ba28efc18716e6fb46c24a9d86bbf6d9d5a 100644 --- a/src/hydro/PressureEnergy/hydro_io.h +++ b/src/hydro/PressureEnergy/hydro_io.h @@ -191,6 +191,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_MINIMAL_HYDRO_IO_H */ diff --git a/src/hydro/PressureEntropy/hydro_io.h b/src/hydro/PressureEntropy/hydro_io.h index 78371c1eb21fafed56e89d46690d0cf1e0f2a0f0..59c49c0665f22eed3ef9b68de054e04533e80daa 100644 --- a/src/hydro/PressureEntropy/hydro_io.h +++ b/src/hydro/PressureEntropy/hydro_io.h @@ -201,6 +201,6 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } #endif /* SWIFT_PRESSURE_ENTROPY_HYDRO_IO_H */ diff --git a/src/hydro/Shadowswift/hydro_io.h b/src/hydro/Shadowswift/hydro_io.h index 8525d22025c1943529ddcd86cf3a42ba0ae4f5d4..4a15ec845dd3913b10c1b6579290f2ec6bdb4e84 100644 --- a/src/hydro/Shadowswift/hydro_io.h +++ b/src/hydro/Shadowswift/hydro_io.h @@ -189,4 +189,4 @@ void hydro_write_flavour(hid_t h_grpsph) { * * @return 1 if entropy is in 'internal energy', 0 otherwise. */ -int writeEntropyFlag() { return 0; } +int writeEntropyFlag(void) { return 0; } diff --git a/src/part.c b/src/part.c index 1b696a8cbc135fd2c128b5ad705a0e6e24a2d5c8..050e10e9cdd0ab56adcd34ba3e6f2d35c274f14a 100644 --- a/src/part.c +++ b/src/part.c @@ -259,7 +259,7 @@ MPI_Datatype multipole_mpi_type; /** * @brief Registers MPI particle types. */ -void part_create_mpi_types() { +void part_create_mpi_types(void) { /* This is not the recommended way of doing this. One should define the structure field by field diff --git a/src/part.h b/src/part.h index e6750ea864bf3785df0b4ebe011e0ad741d7b5c7..03ec331cb17b95b0133be568d6e857a44d1eaf73 100644 --- a/src/part.h +++ b/src/part.h @@ -104,7 +104,7 @@ extern MPI_Datatype gpart_mpi_type; extern MPI_Datatype spart_mpi_type; extern MPI_Datatype multipole_mpi_type; -void part_create_mpi_types(); +void part_create_mpi_types(void); #endif #endif /* SWIFT_PART_H */ diff --git a/src/space.h b/src/space.h index 74d669e5a96fb83c0a4b7ce3eea651a77b5355b5..75d6b7b113d59dadf6dd0970069595bcfc163542 100644 --- a/src/space.h +++ b/src/space.h @@ -234,9 +234,9 @@ void space_gparts_get_cell_index(struct space *s, int *gind, int *cell_counts, void space_sparts_get_cell_index(struct space *s, int *sind, int *cell_counts, struct cell *cells, int verbose); void space_synchronize_particle_positions(struct space *s); -void space_do_parts_sort(); -void space_do_gparts_sort(); -void space_do_sparts_sort(); +void space_do_parts_sort(void); +void space_do_gparts_sort(void); +void space_do_sparts_sort(void); void space_first_init_parts(struct space *s, int verbose); void space_first_init_gparts(struct space *s, int verbose); void space_first_init_sparts(struct space *s, int verbose); diff --git a/src/statistics.c b/src/statistics.c index 62a4f9a1420e88712e8fb527fc4d3db7f4b0abc0..bdca6cfb4ef84bb64aa4776bfc600b0727e0d606 100644 --- a/src/statistics.c +++ b/src/statistics.c @@ -396,7 +396,7 @@ void stats_add_MPI(void *in, void *inout, int *len, MPI_Datatype *datatype) { /** * @brief Registers MPI #statistics type and reduction function. */ -void stats_create_MPI_type() { +void stats_create_MPI_type(void) { /* This is not the recommended way of doing this. One should define the structure field by field diff --git a/src/statistics.h b/src/statistics.h index e8cddda1e855d156070b8a000cb15b515f127740..adc9f5b6a24a093419b7dd644404a68ef736a685 100644 --- a/src/statistics.h +++ b/src/statistics.h @@ -77,7 +77,7 @@ extern MPI_Datatype statistics_mpi_type; extern MPI_Op statistics_mpi_reduce_op; void stats_add_MPI(void* in, void* out, int* len, MPI_Datatype* datatype); -void stats_create_MPI_type(); +void stats_create_MPI_type(void); #endif #endif /* SWIFT_STATISTICS_H */ diff --git a/src/timers.c b/src/timers.c index fec111dd939528bd0648609d8a1f5f83e595ec02..e3beda71310b6a177833db73e207179e5a4b5468 100644 --- a/src/timers.c +++ b/src/timers.c @@ -110,7 +110,7 @@ void timers_reset(unsigned long long mask) { * @brief Re-set all the timers. * */ -void timers_reset_all() { timers_reset(timers_mask_all); } +void timers_reset_all(void) { timers_reset(timers_mask_all); } /** * @brief Outputs all the timers to the timers dump file. @@ -145,4 +145,4 @@ void timers_open_file(int rank) { /** * @brief Close the file containing the timer info. */ -void timers_close_file() { fclose(timers_file); } +void timers_close_file(void) { fclose(timers_file); } diff --git a/src/timers.h b/src/timers.h index 38ede8251eb5d640282e728e17d9330956a1cba8..82132865769604a2ac2e7be3541e2f2f4164f6c3 100644 --- a/src/timers.h +++ b/src/timers.h @@ -119,10 +119,10 @@ INLINE static ticks timers_toc(unsigned int t, ticks tic) { #endif /* Function prototypes. */ -void timers_reset_all(); +void timers_reset_all(void); void timers_reset(unsigned long long mask); void timers_open_file(int rank); -void timers_close_file(); +void timers_close_file(void); void timers_print(int step); #endif /* SWIFT_TIMERS_H */ diff --git a/src/tools.h b/src/tools.h index bb141101a3bf6fad38a83a15ea7f6bb5de86e9f8..a54510000d3c2843e8d60047752b19a46bd502d9 100644 --- a/src/tools.h +++ b/src/tools.h @@ -52,6 +52,6 @@ int compare_values(double a, double b, double threshold, double *absDiff, double *absSum, double *relDiff); int compare_particles(struct part a, struct part b, double threshold); -long get_maxrss(); +long get_maxrss(void); #endif /* SWIFT_TOOL_H */ diff --git a/src/vector.h b/src/vector.h index 9048e273759ae0c0978c8ddbf26a810d4761f464..a1ecddc6ed68ef659759665f15f25aa7e32dc908 100644 --- a/src/vector.h +++ b/src/vector.h @@ -493,7 +493,7 @@ __attribute__((always_inline)) INLINE vector vector_set1(const float x) { * @return temp set #vector. * @return A #vector filled with zeros. */ -__attribute__((always_inline)) INLINE vector vector_setzero() { +__attribute__((always_inline)) INLINE vector vector_setzero(void) { vector temp; temp.v = vec_setzero(); diff --git a/tests/testAdiabaticIndex.c b/tests/testAdiabaticIndex.c index 64a60fd2aa1f85a9a28fa312922f5fd68daa62d7..60ecefa264f48bed2d4df205766dc392a1a03d0f 100644 --- a/tests/testAdiabaticIndex.c +++ b/tests/testAdiabaticIndex.c @@ -16,7 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ - #include "../config.h" #include <fenv.h> @@ -42,7 +41,7 @@ void check_value(float a, float b, const char* s) { * @brief Check that the pre-defined adiabatic index constants contain correct * values */ -void check_constants() { +void check_constants(void) { float val; val = 0.5 * (hydro_gamma + 1.0f) / hydro_gamma; @@ -115,7 +114,7 @@ void check_functions(float x) { /** * @brief Check adiabatic index constants and power functions */ -int main() { +int main(int argc, char* argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testFFT.c b/tests/testFFT.c index b93ec9731687a1b08ea7c0abe075d302bd0e8786..eb8a9cc1a20e13b1b363345de39c23f983158460 100644 --- a/tests/testFFT.c +++ b/tests/testFFT.c @@ -22,7 +22,7 @@ #ifndef HAVE_FFTW -int main() { return 0; } +int main(int argc, char *argv[]) { return 0; } #else @@ -35,6 +35,7 @@ int main() { return 0; } #include "runner_doiact_fft.h" #include "swift.h" + __attribute__((always_inline)) INLINE static int row_major_id(int i, int j, int k, int N) { return (((i + N) % N) * N * N + ((j + N) % N) * N + ((k + N) % N)); @@ -44,8 +45,7 @@ int is_close(double x, double y, double abs_err) { return (abs(x - y) < abs_err); } -int main() { - +int main(int argc, char *argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; clocks_set_cpufreq(cpufreq); diff --git a/tests/testGravityDerivatives.c b/tests/testGravityDerivatives.c index 1e58dcc49a9fe277ddbc6982b71cfd741992e3b3..a6a709cb1a71d7b23fc1a9528aa718f378448265 100644 --- a/tests/testGravityDerivatives.c +++ b/tests/testGravityDerivatives.c @@ -924,7 +924,7 @@ void test(double x, double y, double tol, double min, const char* name) { /* message("'%s' (%e -- %e) OK!", name, x, y); */ } -int main() { +int main(int argc, char* argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testGreetings.c b/tests/testGreetings.c index 2f17bddf5731692d515675d2a21f6c3b4a725ebf..ea2819d4616ed1f1d87c61065bf09fce4043243a 100644 --- a/tests/testGreetings.c +++ b/tests/testGreetings.c @@ -19,7 +19,7 @@ #include "swift.h" -int main() { +int main(int argc, char *argv[]) { greetings(); diff --git a/tests/testKernel.c b/tests/testKernel.c index dc29d053c2049c9253290db81ea9991828bd5e1b..e3a13a4d54697f32c100b1f149a768a342da37a7 100644 --- a/tests/testKernel.c +++ b/tests/testKernel.c @@ -29,7 +29,7 @@ const int numPoints = (1 << 28); -int main() { +int main(int argc, char *argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testMaths.c b/tests/testMaths.c index 3d8f9a8f9db0cf01276eff89aa44157008cbddc6..2abb3aa99902323597b3d20fb19769a8ea1bafbe 100644 --- a/tests/testMaths.c +++ b/tests/testMaths.c @@ -25,7 +25,7 @@ #include <math.h> #include <stdio.h> -int main() { +int main(int argc, char *argv[]) { const int numPoints = 60000; diff --git a/tests/testMatrixInversion.c b/tests/testMatrixInversion.c index 9a45cd52d6f5d3ec96cc6d3f34fd683971f4cf19..a15e0dab7ec793cf4a914b6eb89c63863ab24fb0 100644 --- a/tests/testMatrixInversion.c +++ b/tests/testMatrixInversion.c @@ -95,7 +95,7 @@ void multiply_matrices(float A[3][3], float B[3][3], float C[3][3]) { #endif } -int main() { +int main(int argc, char* argv[]) { float A[3][3], B[3][3], C[3][3]; setup_matrix(A); diff --git a/tests/testPotentialPair.c b/tests/testPotentialPair.c index 53fc54ccdd63a9a9150b6701c1a76ac20af91d4c..cdffaef469096085db87b68d315066b8c8e54e3e 100644 --- a/tests/testPotentialPair.c +++ b/tests/testPotentialPair.c @@ -82,7 +82,7 @@ double acceleration(double mass, double r, double H, double rlr) { return r * acc * (4. * x * S_prime(2 * x) - 2. * S(2. * x) + 2.); } -int main() { +int main(int argc, char *argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testPotentialSelf.c b/tests/testPotentialSelf.c index 6d31f079fa79f7463637ec71dc2c75f37a10b129..25c441b399c9c3ed71479d26bd373e053817036d 100644 --- a/tests/testPotentialSelf.c +++ b/tests/testPotentialSelf.c @@ -85,7 +85,7 @@ double acceleration(double mass, double r, double H, double rlr) { return r * acc * (4. * x * S_prime(2 * x) - 2. * S(2. * x) + 2.); } -int main() { +int main(int argc, char *argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testReading.c b/tests/testReading.c index ca1e0ef69078c5e384a9cd4eab1098923ce9f279..6b4ca8717ec4508f7e23fde6f287877684c358b8 100644 --- a/tests/testReading.c +++ b/tests/testReading.c @@ -23,7 +23,7 @@ /* Includes. */ #include "swift.h" -int main() { +int main(int argc, char *argv[]) { size_t Ngas = 0, Ngpart = 0, Nspart = 0; int periodic = -1; diff --git a/tests/testRiemannExact.c b/tests/testRiemannExact.c index bce7c52d422f966e10d530cdcbc8f6d20431e153..aa630a76f5f82bd87dc15f00d7d90dff2405e749 100644 --- a/tests/testRiemannExact.c +++ b/tests/testRiemannExact.c @@ -169,7 +169,7 @@ void check_riemann_solution(struct riemann_statevector* WL, /** * @brief Check the exact Riemann solver on the Toro test problems */ -void check_riemann_exact() { +void check_riemann_exact(void) { struct riemann_statevector WL, WR, Whalf; /* Test 1 */ @@ -296,7 +296,7 @@ void check_riemann_exact() { /** * @brief Check the symmetry of the TRRS Riemann solver */ -void check_riemann_symmetry() { +void check_riemann_symmetry(void) { float WL[5], WR[5], Whalf1[5], Whalf2[5], n_unit1[3], n_unit2[3], n_norm, vij[3], totflux1[5], totflux2[5]; @@ -395,7 +395,7 @@ void check_riemann_symmetry() { /** * @brief Check the exact Riemann solver */ -int main() { +int main(int argc, char* argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testRiemannHLLC.c b/tests/testRiemannHLLC.c index b988825eb0535fcdc46baa1db1203d0dbac3537a..0cce0f9d144f7be9000d368d6ac28e8e49c7d9aa 100644 --- a/tests/testRiemannHLLC.c +++ b/tests/testRiemannHLLC.c @@ -85,7 +85,7 @@ int are_symmetric(float a, float b) { /** * @brief Check the symmetry of the HLLC Riemann solver for a random setup */ -void check_riemann_symmetry() { +void check_riemann_symmetry(void) { float WL[5], WR[5], n_unit1[3], n_unit2[3], n_norm, vij[3], totflux1[5], totflux2[5]; @@ -150,7 +150,7 @@ void check_riemann_symmetry() { /** * @brief Check the HLLC Riemann solver */ -int main() { +int main(int argc, char *argv[]) { /* Initialize CPU frequency, this also starts time. */ unsigned long long cpufreq = 0; diff --git a/tests/testRiemannTRRS.c b/tests/testRiemannTRRS.c index 4a0eac0be23581e175d2c0e599b786fd4508b14a..2c7098367a1ca8db84f097ad01aa2e1e411c433d 100644 --- a/tests/testRiemannTRRS.c +++ b/tests/testRiemannTRRS.c @@ -105,7 +105,7 @@ void check_riemann_solution(struct riemann_statevector* WL, /** * @brief Check the TRRS Riemann solver on the Toro test problems */ -void check_riemann_trrs() { +void check_riemann_trrs(void) { struct riemann_statevector WL, WR, Whalf; /* Test 1 */ @@ -232,7 +232,7 @@ void check_riemann_trrs() { /** * @brief Check the symmetry of the TRRS Riemann solver */ -void check_riemann_symmetry() { +void check_riemann_symmetry(void) { float WL[5], WR[5], Whalf1[5], Whalf2[5], n_unit1[3], n_unit2[3], n_norm, vij[3], totflux1[5], totflux2[5]; @@ -311,7 +311,7 @@ void check_riemann_symmetry() { /** * @brief Check the TRRS Riemann solver */ -int main() { +int main(int argc, char* argv[]) { /* check the TRRS Riemann solver */ check_riemann_trrs(); diff --git a/tests/testSPHStep.c b/tests/testSPHStep.c index 08d6abaa7521de2a7d12fd9672db0d24a5a20a97..cda1fb9ecb65d3a285ff37d281a74b2b3cf5fa43 100644 --- a/tests/testSPHStep.c +++ b/tests/testSPHStep.c @@ -93,7 +93,7 @@ void runner_dopair1_density(struct runner *r, struct cell *ci, struct cell *cj); void runner_dopair2_force(struct runner *r, struct cell *ci, struct cell *cj); /* Run a full time step integration for one cell */ -int main() { +int main(int argc, char *argv[]) { #ifndef DEFAULT_SPH return 0; diff --git a/tests/testSingle.c b/tests/testSingle.c index e2ec35bc4382658be7754b9c11fc3a3dbe4bbdc1..52fe51c529b8c3b43f9c5f03fe44b5b742acfc07 100644 --- a/tests/testSingle.c +++ b/tests/testSingle.c @@ -142,6 +142,6 @@ int main(int argc, char *argv[]) { } #else -int main() { return 0; } +int main(int argc, char *argv[]) { return 0; } #endif diff --git a/tests/testSymmetry.c b/tests/testSymmetry.c index 1ab493a7c149070dc667a2377ab205df7f873856..886290ab984603d0afb3201377611598cd7163e4 100644 --- a/tests/testSymmetry.c +++ b/tests/testSymmetry.c @@ -16,7 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ - #include "../config.h" #include <fenv.h> @@ -32,7 +31,7 @@ void print_bytes(void *p, size_t len) { printf(")\n"); } -void test() { +void test(void) { #if defined(SHADOWFAX_SPH) /* Initialize the Voronoi simulation box */ diff --git a/tests/testTimeIntegration.c b/tests/testTimeIntegration.c index 972e6f2323c0401c70de2990bcb088f95b3dfd83..49900572108a4948f867824da8f7d9608cb0d25a 100644 --- a/tests/testTimeIntegration.c +++ b/tests/testTimeIntegration.c @@ -26,7 +26,7 @@ * @brief Test the kick-drift-kick leapfrog integration * via a Sun-Earth simulation */ -int main() { +int main(int argc, char *argv[]) { struct cell c; int i; diff --git a/tests/testVoronoi1D.c b/tests/testVoronoi1D.c index d16a36d9449d7bfdb2c74408efad61b219b1d7e3..083d9aaa279f241ae1ac4d0bfaeb2780a39574a4 100644 --- a/tests/testVoronoi1D.c +++ b/tests/testVoronoi1D.c @@ -16,10 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ - #include "hydro/Shadowswift/voronoi1d_algorithm.h" -int main() { +int main(int argc, char *argv[]) { double box_anchor[1] = {-0.5}; double box_side[1] = {2.}; diff --git a/tests/testVoronoi2D.c b/tests/testVoronoi2D.c index 509d3ab69976fa8618db389ebd87eedb9ea34409..60a71624904c11a3cdb3b90906189df60bfc6956 100644 --- a/tests/testVoronoi2D.c +++ b/tests/testVoronoi2D.c @@ -16,14 +16,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ - #include "hydro/Shadowswift/voronoi2d_algorithm.h" #include "tools.h" /* Number of cells used to test the 2D interaction algorithm */ #define TESTVORONOI2D_NUMCELL 100 -int main() { +int main(int argc, char *argv[]) { /* initialize simulation box */ double anchor[3] = {-0.5f, -0.5f, -0.5f}; diff --git a/tests/testVoronoi3D.c b/tests/testVoronoi3D.c index b4f219a41368bb3ce4e8111ae44c43e7fa1f7441..db5c33aa6e4ef0792373febd5d773a6d1198db29 100644 --- a/tests/testVoronoi3D.c +++ b/tests/testVoronoi3D.c @@ -53,7 +53,7 @@ * * @return Volume of the simulation box as it is stored in the global variables. */ -float voronoi_get_box_volume() { +float voronoi_get_box_volume(void) { return VORONOI3D_BOX_SIDE_X * VORONOI3D_BOX_SIDE_Y * VORONOI3D_BOX_SIDE_Z; } @@ -129,7 +129,7 @@ float voronoi_get_box_face(unsigned long long id, float *face_midpoint) { /** * @brief Check if voronoi_volume_tetrahedron() works */ -void test_voronoi_volume_tetrahedron() { +void test_voronoi_volume_tetrahedron(void) { float v1[3] = {0., 0., 0.}; float v2[3] = {0., 0., 1.}; float v3[3] = {0., 1., 0.}; @@ -142,7 +142,7 @@ void test_voronoi_volume_tetrahedron() { /** * @brief Check if voronoi_centroid_tetrahedron() works */ -void test_voronoi_centroid_tetrahedron() { +void test_voronoi_centroid_tetrahedron(void) { float v1[3] = {0., 0., 0.}; float v2[3] = {0., 0., 1.}; float v3[3] = {0., 1., 0.}; @@ -158,7 +158,7 @@ void test_voronoi_centroid_tetrahedron() { /** * @brief Check if voronoi_calculate_cell() works */ -void test_calculate_cell() { +void test_calculate_cell(void) { double box_anchor[3] = {VORONOI3D_BOX_ANCHOR_X, VORONOI3D_BOX_ANCHOR_Y, VORONOI3D_BOX_ANCHOR_Z}; @@ -234,7 +234,7 @@ void test_calculate_cell() { assert(cell.face_midpoints[5][2] == face_midpoint[2] - cell.x[2]); } -void test_paths() { +void test_paths(void) { float u, l, q; int up, us, uw, lp, ls, lw, qp, qs, qw; float r2, dx[3]; @@ -1240,7 +1240,7 @@ void set_coordinates(struct part *p, double x, double y, double z, } #endif -void test_degeneracies() { +void test_degeneracies(void) { #ifdef SHADOWFAX_SPH int idx = 0; /* make a small cube */ @@ -1308,7 +1308,7 @@ void test_degeneracies() { #endif } -int main() { +int main(int argc, char *argv[]) { /* Set the all enclosing simulation box dimensions */ double box_anchor[3] = {VORONOI3D_BOX_ANCHOR_X, VORONOI3D_BOX_ANCHOR_Y,