Skip to content
Snippets Groups Projects
Commit e59ef25b authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Removed shadowed variables and added compiler flag to prevent their appearance.

parent d0033162
Branches
Tags
No related merge requests found
...@@ -466,7 +466,7 @@ if test "$enable_warn" != "no"; then ...@@ -466,7 +466,7 @@ if test "$enable_warn" != "no"; then
# We will do this by hand instead and only default to the macro for unknown compilers # We will do this by hand instead and only default to the macro for unknown compilers
case "$ax_cv_c_compiler_vendor" in case "$ax_cv_c_compiler_vendor" in
gnu | clang) gnu | clang)
CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter" CFLAGS="$CFLAGS -Wall -Wextra -Wshadow -Wno-unused-parameter"
;; ;;
intel) intel)
CFLAGS="$CFLAGS -w2 -Wunused-variable" CFLAGS="$CFLAGS -w2 -Wunused-variable"
......
...@@ -188,7 +188,7 @@ struct task *queue_gettask(struct queue *q, const struct task *prev, ...@@ -188,7 +188,7 @@ struct task *queue_gettask(struct queue *q, const struct task *prev,
/* Set some pointers we will use often. */ /* Set some pointers we will use often. */
int *qtid = q->tid; int *qtid = q->tid;
struct task *qtasks = q->tasks; struct task *qtasks = q->tasks;
const int qcount = q->count; const int old_qcount = q->count;
/* Data for the sliding window in which to try the task with the /* Data for the sliding window in which to try the task with the
best overlap with the previous task. */ best overlap with the previous task. */
...@@ -201,7 +201,7 @@ struct task *queue_gettask(struct queue *q, const struct task *prev, ...@@ -201,7 +201,7 @@ struct task *queue_gettask(struct queue *q, const struct task *prev,
int ind = -1; int ind = -1;
/* Loop over the queue entries. */ /* Loop over the queue entries. */
for (int k = 0; k < qcount; k++) { for (int k = 0; k < old_qcount; k++) {
if (k < queue_search_window) { if (k < queue_search_window) {
window[window_count].ind = k; window[window_count].ind = k;
window[window_count].tid = qtid[k]; window[window_count].tid = qtid[k];
......
...@@ -564,7 +564,7 @@ int main(int argc, char *argv[]) { ...@@ -564,7 +564,7 @@ int main(int argc, char *argv[]) {
/* Start the test */ /* Start the test */
ticks time = 0; ticks time = 0;
for (size_t i = 0; i < runs; ++i) { for (size_t n = 0; n < runs; ++n) {
const ticks tic = getticks(); const ticks tic = getticks();
...@@ -642,7 +642,7 @@ int main(int argc, char *argv[]) { ...@@ -642,7 +642,7 @@ int main(int argc, char *argv[]) {
time += toc - tic; time += toc - tic;
/* Dump if necessary */ /* Dump if necessary */
if (i == 0) { if (n == 0) {
sprintf(outputFileName, "swift_dopair_125_%s.dat", sprintf(outputFileName, "swift_dopair_125_%s.dat",
outputFileNameExtension); outputFileNameExtension);
dump_particle_fields(outputFileName, main_cell, solution, 0); dump_particle_fields(outputFileName, main_cell, solution, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment