From 487692f479ac364d919461abe11e0e3b83edf61b Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Wed, 15 Oct 2014 02:32:44 -0400 Subject: [PATCH] delete warning #pragma's from source; disable in CMakeLists.txt instead --- CMakeLists.txt | 8 +++++++- include/pstypes.h | 17 ----------------- src/asteroid/asteroid.cpp | 8 -------- src/debris/debris.cpp | 7 ------- src/hud/hudconfig.cpp | 11 ----------- src/mission/missionhotkey.cpp | 10 ---------- src/model/modelread.cpp | 7 ------- 7 files changed, 7 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 326ad14..14add1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,8 @@ if(NOT WIN32) add_definitions(-DPLAT_UNIX) add_definitions(-Wall) -# add_definitions(-Wno-format-y2k -Wno-deprecated) +# add_definitions(-Wno-format-y2k) +# add_definitions(-Wno-deprecated) add_definitions(-fsigned-char) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG -g -O2") @@ -59,6 +60,11 @@ else() ) add_definitions(/D _CRT_SECURE_NO_WARNINGS) + add_definitions(/W4) + add_definitions(/wd4100) # unreferenced parameter + add_definitions(/wd4127) # conditional expression is constant: do { } while (0) + add_definitions(/wd4611) # non-portable interaction between setjmp() and C++ object destruction + add_definitions(/wd4996) # deprecated functions: fopen, fileno, ... endif() diff --git a/include/pstypes.h b/include/pstypes.h index e4c1bb8..320074d 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -235,23 +235,6 @@ #define GAME_CD_CHECK #endif -// 4127 is constant conditional (assert) -// 4100 is unreferenced formal parameters, -// 4514 is unreferenced inline function removed, -// 4201 is nameless struct extension used. (used by windows header files) -// 4410 illegal size for operand... ie... fxch st(1) -// 4611 is _setjmp warning. Since we use setjmp alot, and we don't really use constructors or destructors, this warning doesn't really apply to us. -// 4725 is the pentium division bug warning, and I can't seem to get rid of it, even with this pragma. -// JS: I figured out the disabling 4725 works, but not on the first function in the module. -// So to disable this, I add in a stub function at the top of each module that does nothing. -// 4710 is inline function not expanded (who cares?) -// 4711 tells us an inline function was expanded (who cares?) -// 4702 unreachable code. I care, but too many to deal with -// 4201 nonstandard extension used : nameless struct/union (happens a lot in Windows include headers) -// 4390 emptry control statement (triggered by nprintf and mprintf's inside of one-line if's, etc) -#ifndef PLAT_UNIX -#pragma warning(disable: 4127 4100 4514 4201 4410 4611 4725 4710 4711 4702 4201 4390) -#endif #include "SDL.h" diff --git a/src/asteroid/asteroid.cpp b/src/asteroid/asteroid.cpp index b75d7d8..3edbc5c 100644 --- a/src/asteroid/asteroid.cpp +++ b/src/asteroid/asteroid.cpp @@ -1140,10 +1140,6 @@ void asteroid_process_pre( object *objp, float frame_time) } } -#ifndef PLAT_UNIX -#pragma warning ( push ) -#pragma warning ( disable : 4701 ) -#endif int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpos, collision_info_struct *asteroid_hit_info) { if (!Asteroids_enabled) { @@ -1398,10 +1394,6 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo return 0; } } -#ifndef PLAT_UNIX -#pragma warning ( pop ) -#endif - void asteroid_render(object * obj) { diff --git a/src/debris/debris.cpp b/src/debris/debris.cpp index 854da6c..1a6e4bd 100644 --- a/src/debris/debris.cpp +++ b/src/debris/debris.cpp @@ -997,10 +997,6 @@ void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float dam // NOTE: debris_hit_info pointer NULL for debris:weapon collision, otherwise debris:ship collision. // Return true if hit, else return false. // -#ifndef PLAT_UNIX -#pragma warning ( push ) -#pragma warning ( disable : 4701 ) -#endif int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, collision_info_struct *debris_hit_info) { mc_info mc; @@ -1247,9 +1243,6 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c return 0; } } -#ifndef PLAT_UNIX -#pragma warning ( pop ) -#endif // --------------------------------------------------------------------------------------- // debris_get_team() diff --git a/src/hud/hudconfig.cpp b/src/hud/hudconfig.cpp index f7031a4..82078da 100644 --- a/src/hud/hudconfig.cpp +++ b/src/hud/hudconfig.cpp @@ -444,10 +444,6 @@ int HC_select_all = 0; // Module Globals ////////////////////////////////////////////////////////////////////////////// -#ifndef PLAT_UNIX -#pragma warning(disable:4710) -#endif - const char *Hud_config_fname[GR_NUM_RESOLUTIONS] = { "HUDConfig", "2_HUDConfig" @@ -606,10 +602,6 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] = } }; -#ifndef PLAT_UNIX -#pragma warning(default:4710) -#endif - int HC_gauge_description_coords[GR_NUM_RESOLUTIONS][3] = { { // GR_640 #ifdef MAKE_FS1 @@ -746,9 +738,6 @@ const char *HC_gauge_descriptions(int n) #define HCB_ACCEPT 7 #endif -#ifndef PLAT_UNIX -#pragma warning(disable : 4710) -#endif ui_button_info HC_buttons[GR_NUM_RESOLUTIONS][NUM_HUD_BUTTONS] = { { // GR_640 diff --git a/src/mission/missionhotkey.cpp b/src/mission/missionhotkey.cpp index 89a55eb..1d6845d 100644 --- a/src/mission/missionhotkey.cpp +++ b/src/mission/missionhotkey.cpp @@ -370,12 +370,6 @@ static int Hotkey_ship_x[GR_NUM_RESOLUTIONS] = { 448 // GR_1024 }; -#ifndef PLAT_UNIX -// pragma pair put into place because of compiler warnings about being unable to inline -// the constructor function of the hotkey_buttons set. -#pragma warning(disable: 4710) -#endif - struct hotkey_buttons { const char *filename; int x, y; @@ -430,10 +424,6 @@ static hotkey_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = { //XSTR:ON }; -#ifndef PLAT_UNIX -#pragma warning(default: 4710) -#endif - #ifndef MAKE_FS1 #define HOTKEY_NUM_TEXT 6 diff --git a/src/model/modelread.cpp b/src/model/modelread.cpp index 41cd9ac..466c189 100644 --- a/src/model/modelread.cpp +++ b/src/model/modelread.cpp @@ -2673,10 +2673,6 @@ void model_get_rotating_submodel_axis(vector *model_axis, vector *world_axis, in // Does stepped rotation of a submodel -#ifndef PLAT_UNIX -#pragma warning ( push ) -#pragma warning (disable : 4701) -#endif void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) { SDL_assert(psub->flags & MSS_FLAG_STEPPED_ROTATE); @@ -2765,9 +2761,6 @@ void submodel_stepped_rotate(model_subsystem *psub, submodel_instance_info *sii) sii->cur_turn_rate = 0.0f; } } -#ifndef PLAT_UNIX -#pragma warning ( pop ) -#endif // Rotates the angle of a submodel. Use this so the right unlocked axis // gets stuffed. -- 2.39.2