From 838cf3d938a91efc840bd844406793de5ad33328 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 12 Jan 2015 22:53:21 +0100 Subject: [PATCH] try to allow visual studio to build with all warnings (/WAll) enabled. --- src/attributes/stealth.c | 1 - src/bind_tolua.c | 1 + src/callback.c | 1 - src/kernel/faction.h | 2 +- src/kernel/item.h | 4 ++-- src/kernel/race.h | 5 ++--- src/platform.h | 10 ++++++---- src/reports.test.c | 1 + src/util/unicode.test.c | 9 +++++---- src/vortex.c | 1 - 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/attributes/stealth.c b/src/attributes/stealth.c index 129802c09..9d76ffb29 100644 --- a/src/attributes/stealth.c +++ b/src/attributes/stealth.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/src/bind_tolua.c b/src/bind_tolua.c index 26e536f9c..c6df54a10 100644 --- a/src/bind_tolua.c +++ b/src/bind_tolua.c @@ -1,3 +1,4 @@ +#include #pragma warning(push) #pragma warning(disable: 4100) #include "config.pkg.c" diff --git a/src/callback.c b/src/callback.c index c2d178819..9d76f30c8 100644 --- a/src/callback.c +++ b/src/callback.c @@ -1,4 +1,3 @@ -#include #include #include "callback.h" #include diff --git a/src/kernel/faction.h b/src/kernel/faction.h index 20c6f9785..31705860f 100644 --- a/src/kernel/faction.h +++ b/src/kernel/faction.h @@ -82,7 +82,6 @@ typedef struct faction { int no_units; struct ally *allies; struct group *groups; - bool alive; /* enno: sollte ein flag werden */ int nregions; int money; #if SCORE_MODULE @@ -104,6 +103,7 @@ typedef struct faction { struct item *items; /* items this faction can claim */ struct seen_region **seen; struct quicklist *seen_factions; + bool alive; /* enno: sollte ein flag werden */ } faction; extern struct faction *factions; diff --git a/src/kernel/item.h b/src/kernel/item.h index d40e2d90c..9f2513134 100644 --- a/src/kernel/item.h +++ b/src/kernel/item.h @@ -193,11 +193,11 @@ extern "C" { typedef struct armor_type { const item_type *itype; + unsigned int flags; double penalty; double magres; int prot; float projectile; /* chance, dass ein projektil abprallt */ - unsigned int flags; } armor_type; #define WTF_NONE 0x00 @@ -223,7 +223,7 @@ extern "C" { int reload; /* time to reload this weapon */ weapon_mod *modifiers; /* --- functions --- */ - bool(*attack) (const struct troop *, const struct weapon_type *, + bool(*attack) (const struct troop *, const struct weapon_type *, int *deaths); } weapon_type; diff --git a/src/kernel/race.h b/src/kernel/race.h index 6882af222..fa61e4cec 100644 --- a/src/kernel/race.h +++ b/src/kernel/race.h @@ -140,14 +140,13 @@ extern "C" { int at_bonus; /* Verändert den Angriffsskill (default: 0) */ int df_bonus; /* Verändert den Verteidigungskill (default: 0) */ const struct spell *precombatspell; - struct att attack[10]; - signed char bonus[MAXSKILLS]; signed char *study_speed; /* study-speed-bonus in points/turn (0=30 Tage) */ - bool __remove_me_nonplayer; int flags; int battle_flags; int ec_flags; race_t oldfamiliars[MAXMAGIETYP]; + struct att attack[10]; + signed char bonus[MAXSKILLS]; const char *(*generate_name) (const struct unit *); const char *(*describe) (const struct unit *, const struct locale *); diff --git a/src/platform.h b/src/platform.h index e83600fa2..64c369c0a 100644 --- a/src/platform.h +++ b/src/platform.h @@ -26,7 +26,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef _MSC_VER # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN +#pragma warning(push) +#pragma warning(disable:4820 4255 4668) # include +# include +#pragma warning(pop) # undef MOUSE_MOVED # define STDIO_CP 1252 /* log.c, convert to console character set */ # pragma warning (disable: 4201 4214 4514 4115 4711) @@ -41,6 +45,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # pragma warning(disable: 4996) /* is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' */ # pragma warning(disable: 4668) +/* : bytes padding after data member */ +# pragma warning(disable: 4820) /* warning C4100: was declared deprecated */ #ifndef _CRT_SECURE_NO_DEPRECATE @@ -113,9 +119,5 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#ifdef HAVE_IO_H -#include -#endif - #endif diff --git a/src/reports.test.c b/src/reports.test.c index 5f9ce5ae0..060934ddb 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -1,3 +1,4 @@ +#include #include #include "reports.h" diff --git a/src/util/unicode.test.c b/src/util/unicode.test.c index 52392fda4..958b695e2 100644 --- a/src/util/unicode.test.c +++ b/src/util/unicode.test.c @@ -1,3 +1,4 @@ +#include #include #include "unicode.h" #include @@ -10,14 +11,14 @@ static void test_unicode_tolower(CuTest * tc) CuAssertIntEquals(tc, 0, unicode_utf8_tolower(buffer, sizeof(buffer), "HeLlO W0Rld")); CuAssertStrEquals(tc, "hello w0rld", buffer); memset(buffer, 0, sizeof(buffer)); - buffer[5]='X'; + buffer[5] = 'X'; CuAssertIntEquals(tc, ENOMEM, unicode_utf8_tolower(buffer, 5, "HeLlO W0Rld")); CuAssertStrEquals(tc, "helloX", buffer); } CuSuite *get_unicode_suite(void) { - CuSuite *suite = CuSuiteNew(); - SUITE_ADD_TEST(suite, test_unicode_tolower); - return suite; + CuSuite *suite = CuSuiteNew(); + SUITE_ADD_TEST(suite, test_unicode_tolower); + return suite; } diff --git a/src/vortex.c b/src/vortex.c index a4aee3181..79b37fb8a 100644 --- a/src/vortex.c +++ b/src/vortex.c @@ -1,4 +1,3 @@ -#include #include #include "vortex.h"