summaryrefslogtreecommitdiff
path: root/src/main/WarnLevel.c
diff options
context:
space:
mode:
authorknarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-12-03 04:41:30 +0000
committerknarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-12-03 04:41:30 +0000
commit20d0ca7a93ffe72dd8cd23223fc08c4bac934f43 (patch)
tree9e1a53e30068033309f5b701b3aa4be9da7b0ada /src/main/WarnLevel.c
parenta8569cd218d3d9aa7c690ad71a6ee9467fa0e1d4 (diff)
Cactus allows for negative error level
Currently, Cactus allows to set a negative error level through the command line option. This leads to CCTK_WARN(0,"") not necessarily aborting. While this is not wrong by itself, a lot of code assumes an abort at that point. This patch changes CCTKi_SetErrorLevel() to only accept non-negative error levels and to change the command-parsing code to give an error message for that case as well. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4923 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/WarnLevel.c')
-rw-r--r--src/main/WarnLevel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/WarnLevel.c b/src/main/WarnLevel.c
index 9e1cd221..52fa0f5a 100644
--- a/src/main/WarnLevel.c
+++ b/src/main/WarnLevel.c
@@ -1109,7 +1109,13 @@ int CCTKi_SetErrorLevel (int level)
{
int retval;
- if (level <= warning_level)
+ if (level < 0)
+ {
+ CCTK_VWarn (3, __LINE__, __FILE__, "Cactus",
+ "Error level cannot be negative (%d requested)", level);
+ retval = 0;
+ }
+ else if (level <= warning_level)
{
if (error_level != level)
{