From e8880db447bf9a92074a8a61601a5371b1dee598 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 26 Sep 2015 14:01:01 +0200 Subject: [PATCH 1/3] get the code to compile under vs2015 (disable warnings) --- src/creport.c | 2 +- src/magic.c | 6 +++--- src/platform.h | 8 ++++++++ src/report.c | 4 ++++ src/reports.c | 4 ++++ src/spells.c | 4 ++++ vs2015-build.bat | 11 +++++++++++ 7 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 vs2015-build.bat diff --git a/src/creport.c b/src/creport.c index aea88f03a..c8f4f9537 100644 --- a/src/creport.c +++ b/src/creport.c @@ -1531,7 +1531,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset) fprintf(F, "\"%s\";charset\n", charset); fprintf(F, "\"%s\";locale\n", locale_name(f->locale)); fprintf(F, "%d;noskillpoints\n", 1); - fprintf(F, "%ld;date\n", ctx->report_time); + fprintf(F, "%lld;date\n", (long long)ctx->report_time); fprintf(F, "\"%s\";Spiel\n", game_name()); fprintf(F, "\"%s\";Konfiguration\n", "Standard"); fprintf(F, "\"%s\";Koordinaten\n", "Hex"); diff --git a/src/magic.c b/src/magic.c index a02eff09f..a189e9495 100644 --- a/src/magic.c +++ b/src/magic.c @@ -870,9 +870,9 @@ int eff_spelllevel(unit * u, const spell * sp, int cast_level, int range) /* Ein Spruch mit Fixkosten wird immer mit der Stufe des Spruchs und * nicht auf der Stufe des Magiers gezaubert */ if (costtyp == SPC_FIX) { - spellbook * spells = unit_get_spellbook(u); - if (spells) { - spellbook_entry * sbe = spellbook_get(spells, sp); + spellbook * sb = unit_get_spellbook(u); + if (sb) { + spellbook_entry * sbe = spellbook_get(sb, sp); if (sbe) { return _min(cast_level, sbe->level); } diff --git a/src/platform.h b/src/platform.h index 1da86fe5b..8e207fae2 100644 --- a/src/platform.h +++ b/src/platform.h @@ -34,6 +34,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # undef MOUSE_MOVED # define STDIO_CP 1252 /* log.c, convert to console character set */ # pragma warning (disable: 4201 4214 4514 4115 4711) +# pragma warning(disable: 4710) +/* warning C4710: function not inlined */ +# pragma warning(disable: 4456) +/* warning C4456 : declaration of hides previous local declaration */ +# pragma warning(disable: 4457) +/* warning C4457: declaration of hides function parameter */ +# pragma warning(disable: 4459) +/* warning C4459: declaration of hides global declaration */ # pragma warning(disable: 4056) /* warning C4056: overflow in floating point constant arithmetic */ # pragma warning(disable: 4201) diff --git a/src/report.c b/src/report.c index e77ff1d9e..254da710e 100644 --- a/src/report.c +++ b/src/report.c @@ -96,6 +96,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#ifdef _MSC_VER +# pragma warning(disable: 4774) // TODO: remove this +#endif + extern int *storms; extern int weeks_per_month; extern int months_per_year; diff --git a/src/reports.c b/src/reports.c index 21d51afa2..5f547b6ed 100644 --- a/src/reports.c +++ b/src/reports.c @@ -73,6 +73,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "move.h" +#ifdef _MSC_VER +# pragma warning(disable: 4774) // TODO: remove this +#endif + #define SCALEWEIGHT 100 /* Faktor, um den die Anzeige von Gewichten skaliert wird */ bool nocr = false; diff --git a/src/spells.c b/src/spells.c index 436a1bc43..033d74024 100644 --- a/src/spells.c +++ b/src/spells.c @@ -101,6 +101,10 @@ #include /* ----------------------------------------------------------------------- */ +#ifdef _MSC_VER +# pragma warning(disable: 4774) // TODO: remove this +#endif + static double zero_effect = 0.0; attrib_type at_wdwpyramid = { diff --git a/vs2015-build.bat b/vs2015-build.bat new file mode 100644 index 000000000..82f1f4cd6 --- /dev/null +++ b/vs2015-build.bat @@ -0,0 +1,11 @@ +@ECHO OFF +SET VSVERSION=14 +SET SRCDIR=%CD% +CD .. +SET ERESSEA=%CD% + +CD %SRCDIR% +mkdir build-vs%VSVERSION% +cd build-vs%VSVERSION% +"%ProgramFiles(x86)%\CMake\bin\cmake.exe" -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%ProgramFiles(x86)%/Lua/5.1;%ERESSEA%/dependencies-win32" -DCMAKE_MODULE_PATH="%SRCDIR%/cmake/Modules" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. +PAUSE From 6a074fd29486383e285fa2811d46d8d7b793c882 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 27 Sep 2015 09:33:56 +0200 Subject: [PATCH 2/3] only disable MSVC2015 warnings in MSVC2015, do not break confuse compilers. --- src/platform.h | 2 ++ src/report.c | 2 +- src/reports.c | 2 +- src/spells.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/platform.h b/src/platform.h index 8e207fae2..77a767875 100644 --- a/src/platform.h +++ b/src/platform.h @@ -34,6 +34,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # undef MOUSE_MOVED # define STDIO_CP 1252 /* log.c, convert to console character set */ # pragma warning (disable: 4201 4214 4514 4115 4711) +#if _MSC_VER >= 1900 # pragma warning(disable: 4710) /* warning C4710: function not inlined */ # pragma warning(disable: 4456) @@ -42,6 +43,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* warning C4457: declaration of hides function parameter */ # pragma warning(disable: 4459) /* warning C4459: declaration of hides global declaration */ +#endif # pragma warning(disable: 4056) /* warning C4056: overflow in floating point constant arithmetic */ # pragma warning(disable: 4201) diff --git a/src/report.c b/src/report.c index 254da710e..aa9b9addd 100644 --- a/src/report.c +++ b/src/report.c @@ -96,7 +96,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER >= 1900 # pragma warning(disable: 4774) // TODO: remove this #endif diff --git a/src/reports.c b/src/reports.c index 5f547b6ed..bf365ab6c 100644 --- a/src/reports.c +++ b/src/reports.c @@ -73,7 +73,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "move.h" -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER >= 1900 # pragma warning(disable: 4774) // TODO: remove this #endif diff --git a/src/spells.c b/src/spells.c index 033d74024..61c86956d 100644 --- a/src/spells.c +++ b/src/spells.c @@ -101,7 +101,7 @@ #include /* ----------------------------------------------------------------------- */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER >= 1900 # pragma warning(disable: 4774) // TODO: remove this #endif From a3c843f90d2668c15d685abc8fe86ce42d2c4e2b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 11 Oct 2015 14:57:35 +0200 Subject: [PATCH 3/3] clean up after tests update runtests.bat script for windows development in VS2015 --- scripts/tests/common.lua | 2 +- scripts/tests/orders.lua | 2 +- scripts/tests/storage.lua | 1 + tests/runtests.bat | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/tests/common.lua b/scripts/tests/common.lua index fb1a29965..69467dd11 100644 --- a/scripts/tests/common.lua +++ b/scripts/tests/common.lua @@ -45,7 +45,7 @@ function test_flags() eressea.write_game("test.dat") eressea.free_game() eressea.read_game("test.dat") - os.remove('test.dat') + os.remove('data/test.dat') f = get_faction(no) assert_equal(flags, f.flags) end diff --git a/scripts/tests/orders.lua b/scripts/tests/orders.lua index d9443c9c4..21ecbe644 100644 --- a/scripts/tests/orders.lua +++ b/scripts/tests/orders.lua @@ -104,7 +104,7 @@ function test_process_quit() eressea.write_game('test.dat') eressea.free_game() eressea.read_game('test.dat') - os.remove('test.dat') + os.remove('data/test.dat') assert_equal(nil, _G.get_faction(fno)) end diff --git a/scripts/tests/storage.lua b/scripts/tests/storage.lua index cf496224c..a0e8e780e 100644 --- a/scripts/tests/storage.lua +++ b/scripts/tests/storage.lua @@ -28,4 +28,5 @@ function test_store_unit() store:close() assert_not_nil(u) assert_equal(u:get_item("money"), u.number * 100) + os.remove(filename) end diff --git a/tests/runtests.bat b/tests/runtests.bat index 3bb41c982..94bba0d68 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -1,5 +1,8 @@ @ECHO OFF -SET BUILD=..\build-vs12\eressea\Debug\ +IF EXIST ..\build-vs10 SET BUILD=..\build-vs10\eressea\Debug +IF EXIST ..\build-vs11 SET BUILD=..\build-vs11\eressea\Debug +IF EXIST ..\build-vs12 SET BUILD=..\build-vs12\eressea\Debug +IF EXIST ..\build-vs14 SET BUILD=..\build-vs14\eressea\Debug SET SERVER=%BUILD%\eressea.exe %BUILD%\test_eressea.exe %SERVER% ..\scripts\run-tests.lua