From 15f9511f821e350bc8c0c850b6f0a65ff786df87 Mon Sep 17 00:00:00 2001 From: hinder Date: Mon, 26 Nov 2012 12:12:53 +0000 Subject: Set variables in error branch of conditionals to avoid compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compiler doesn't know that CCTK_WARN(0,…) is fatal. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/MoL/trunk@189 578cdeb0-5ea1-4b81-8215-5a3b8777ee0b --- src/RK45.c | 4 ++++ src/SetTime.c | 6 +++++- src/StepSize.c | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/RK45.c b/src/RK45.c index 880f1fb..ea547fd 100644 --- a/src/RK45.c +++ b/src/RK45.c @@ -150,6 +150,10 @@ void MoL_RK45Add(CCTK_ARGUMENTS) else { CCTK_WARN (0, "internal error"); + /* Avoid compiler warnings */ + beta_array = NULL; + gammastar_array = NULL; + gamma_array = NULL; } int totalsize = 1; diff --git a/src/SetTime.c b/src/SetTime.c index 969c95a..edef89f 100644 --- a/src/SetTime.c +++ b/src/SetTime.c @@ -284,6 +284,8 @@ void MoL_ResetTime(CCTK_ARGUMENTS) else { CCTK_WARN (0, "internal error"); + /* Avoid compiler warning */ + alpha_array = NULL; } cctkGH->cctk_time = ((* Original_Time) @@ -463,7 +465,9 @@ void MoL_ResetDeltaTime(CCTK_ARGUMENTS) } else { - CCTK_WARN (0, "internal error"); + CCTK_WARN (0, "internal error"); + /* Avoid compiler warning */ + alpha_array = NULL; } cctkGH->cctk_delta_time = ((alpha_array[substep + 1] - alpha_array[substep]) diff --git a/src/StepSize.c b/src/StepSize.c index 4ea17ff..c32812c 100644 --- a/src/StepSize.c +++ b/src/StepSize.c @@ -259,6 +259,9 @@ void MoL_ReduceAdaptiveError(CCTK_ARGUMENTS) else { CCTK_WARN (CCTK_WARN_ABORT, "unsupported ODE_Method in stepsize control"); + /* Avoid compiler warnings */ + p1 = 0; + p2 = 0; } /* Decide whether to accept this step */ -- cgit v1.2.3