Commit 594cbca6 authored by Matthieu Schaller's avatar Matthieu Schaller

Add the strict-prototype flag and correct all the prototypes as this creates...

Add the strict-prototype flag and correct all the prototypes as this creates issues with the Cray compiler.
parent d3009eb5
......@@ -787,10 +787,10 @@ if test "$enable_warn" != "no"; then
# We will do this by hand instead and only default to the macro for unknown compilers
case "$ax_cv_c_compiler_vendor" in
gnu | clang)
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow"
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wshadow -Wstrict-prototypes"
;;
intel)
CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow"
CFLAGS="$CFLAGS -w2 -Wunused-variable -Wshadow -Wstrict-prototypes"
;;
*)
AX_CFLAGS_WARN_ALL
......
......@@ -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");
......
......@@ -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.
......
......@@ -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 */
......@@ -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.
......
......@@ -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,
......
......@@ -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 */
......@@ -5126,7 +5126,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;
......
......@@ -365,8 +365,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);
......
......@@ -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_compute(struct space *s, const struct engine *e);
void gravity_exact_force_check(struct space *s, const struct engine *e,
float rel_tol);
......
......@@ -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 */
......@@ -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 */
......@@ -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_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 */
......@@ -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 */
......@@ -185,4 +185,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; }
......@@ -94,7 +94,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 */
......@@ -218,9 +218,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);
......
......@@ -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 */
......@@ -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 */
......@@ -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 */
......@@ -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();
......
......@@ -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;
......
......@@ -18,12 +18,11 @@
******************************************************************************/
/* Some standard headers. */
#include "../config.h"
#ifndef HAVE_FFTW
int main() { return 0; }
int main(int argc, char *argv[]) { return 0; }
#else
......@@ -34,7 +33,7 @@ int main() { return 0; }
/* Includes. */
#include "swift.h"
int main() {
int main(int argc, char *argv[]) {
/* Initialize CPU frequency, this also starts time. */
unsigned long long cpufreq = 0;
......
......@@ -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;
......
......@@ -19,7 +19,7 @@
#include "swift.h"
int main() {
int main(int argc, char *argv[]) {
greetings();
......
......@@ -26,7 +26,7 @@
#define numPoints (1 << 4)
int main() {
int main(int argc, char *argv[]) {
const float h = 1.2348f;
......
......@@ -25,7 +25,7 @@
#include <math.h>
#include <stdio.h>
int main() {
int main(int argc, char *argv[]) {
const int numPoints = 60000;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -163,7 +163,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 */
......@@ -290,7 +290,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];
......@@ -389,7 +389,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;
......
......@@ -79,7 +79,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];
......@@ -144,7 +144,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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -142,6 +142,6 @@ int main(int argc, char *argv[]) {
}
#else
int main() { return 0; }
int main(int argc, char *argv[]) { return 0; }
#endif
......@@ -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 */
......
......@@ -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;
......
......@@ -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.};
......
......@@ -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};
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment