From 1dc516ab50333ce72310b438187f1128b4f3b3b3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 15 May 2015 07:59:06 +0200 Subject: [PATCH 1/2] reduce warning level on oldterrain() log, warn from caller (json_report) instead. --- src/jsreport.c | 13 +++++++++---- src/kernel/terrain.c | 2 +- src/util/log.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/jsreport.c b/src/jsreport.c index 4c9890329..2ea46b678 100644 --- a/src/jsreport.c +++ b/src/jsreport.c @@ -1,9 +1,11 @@ #include "reports.h" #include "jsreport.h" -#include "kernel/region.h" -#include "kernel/terrain.h" -#include "kernel/terrainid.h" -#include "kernel/config.h" +#include +#include +#include +#include + +#include #include #include @@ -56,6 +58,9 @@ static int report_json(const char *filename, report_context * ctx, const char *c sr = find_seen(ctx->seen, r); if (sr) { terrain_t ter = oldterrain(r->terrain); + if (ter != NOTERRAIN) { + log_warning("report_json: %s has no terrain id\n", r->terrain->_name); + } data = 1 + (int)ter; } } diff --git a/src/kernel/terrain.c b/src/kernel/terrain.c index 313811b47..36efb3591 100644 --- a/src/kernel/terrain.c +++ b/src/kernel/terrain.c @@ -133,7 +133,7 @@ terrain_t oldterrain(const struct terrain_type * terrain) if (newterrains[t] == terrain) return t; } - log_warning("%s is not a classic terrain.\n", terrain->_name); + log_debug("%s is not a classic terrain.\n", terrain->_name); return NOTERRAIN; } diff --git a/src/util/log.h b/src/util/log.h index 1e56d4b34..2a206b55b 100644 --- a/src/util/log.h +++ b/src/util/log.h @@ -20,8 +20,8 @@ extern "C" { extern void log_flush(void); /* use macros above instead of these: */ - extern void log_warning(const char *format, ...); extern void log_error(const char *format, ...); + extern void log_warning(const char *format, ...); extern void log_debug(const char *format, ...); extern void log_info(const char *format, ...); extern void log_printf(FILE * ios, const char *format, ...); From 9418051cd33b1eead91980788157f96cdfc60549 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 16 May 2015 22:35:07 +0200 Subject: [PATCH 2/2] make gcc warn about signed/unsigned comparisons, just like Visual Studio does --- src/CMakeLists.txt | 2 +- src/kernel/config.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9e1a7bfca..ba2d3a2f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories (${BSON_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR}) IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") elseif(MSVC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP") diff --git a/src/kernel/config.c b/src/kernel/config.c index 2e0f2c32c..fca5afb07 100644 --- a/src/kernel/config.c +++ b/src/kernel/config.c @@ -1199,7 +1199,7 @@ void setguard(unit * u, unsigned int flags) } fset(u, UFL_GUARD); fset(u->region, RF_GUARDED); - if ((int)flags == guard_flags(u)) { + if (flags == guard_flags(u)) { if (a) a_remove(&u->attribs, a); }