Skip to content

Commit

Permalink
Cleans up MSVC only warnings pragmas.
Browse files Browse the repository at this point in the history
Any warnings that need to be disabled at the current warning level are disabled through CMakePresets.json now.
Also fixes two warnings seen at current warning level.
  • Loading branch information
OmniBlade committed Jun 25, 2024
1 parent 19073d6 commit 9641ffc
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"hidden": true,
"cacheVariables": {
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL",
"VC_CXX_FLAGS": "/Zc:strictStrings;-wd4244;-wd4018;-wd4291;-wd4101;-wd4267",
"VC_CXX_FLAGS": "/Zc:strictStrings;-wd4244;-wd4018;-wd4291;-wd4101;-wd4267;-wd4200",
"CMAKE_CXX_FLAGS_RELEASE": "/Zi /O2 /Ob2 /DNDEBUG",
"CMAKE_EXE_LINKER_FLAGS_RELEASE": "/debug:full /INCREMENTAL:NO",
"CMAKE_MODULE_LINKER_FLAGS_RELEASE": "/debug:full /INCREMENTAL:NO",
Expand Down
3 changes: 0 additions & 3 deletions common/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
#include "field.h"
#include "endianness.h"

// ST - 12/18/2018 10:14AM
#pragma warning(disable : 4996)

FieldClass::FieldClass(const char* id, char data)
{
strncpy(ID, id, sizeof(ID));
Expand Down
2 changes: 0 additions & 2 deletions common/graphicsviewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,6 @@ unsigned int GraphicViewPortClass::Print(char const* str, int x, int y, int fcol
return (return_code);
}

#pragma warning(disable : 4996)

/***************************************************************************
* GVPC::PRINT -- Stub function to print an integer *
* *
Expand Down
3 changes: 0 additions & 3 deletions common/ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@
#include "cstraw.h"
#endif

// Disable the "temporary object used to initialize a non-constant reference" warning.
//#pragma warning 665 9

/***********************************************************************************************
* INIClass::~INIClass -- Destructor for INI handler. *
* *
Expand Down
2 changes: 0 additions & 2 deletions common/int.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,6 @@ template <class T> T Gcd(const T& a, const T& n)
return g[(i - 1) % 3];
}

//#pragma warning 604 9
//#pragma warning 595 9
template <class T> T Generate_Prime(Straw& rng, int pbits)
{
T minQ = (T(1UL) << (unsigned short)(pbits - (unsigned short)2));
Expand Down
1 change: 0 additions & 1 deletion common/mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ unsigned XMP_Encode(unsigned char* to, unsigned tobytes, digit const* from, int
* HISTORY: *
* 07/01/1996 JLB : Created. *
*=============================================================================================*/
//#pragma warning 364 9
unsigned XMP_Encode(unsigned char* to, digit const* from, int precision)
{
int i;
Expand Down
1 change: 0 additions & 1 deletion common/packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ bool PacketClass::Get_Field(const char* id, int& data)
* HISTORY: *
* 04/23/1996 PWG : Created. *
*========================================================================*/
#pragma warning(disable : 4996)
bool PacketClass::Get_Field(const char* id, char* data)
{
FieldClass* field = Find_Field(id);
Expand Down
1 change: 0 additions & 1 deletion common/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ typedef struct
/*
------------------------------- Shape block ---------------------------------
*/
#pragma warning(disable : 4200)
#pragma pack(push, 2)
typedef struct
{
Expand Down
1 change: 1 addition & 0 deletions common/soscodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ unsigned sosCODECDecompressData(_SOS_COMPRESS_INFO* stream, unsigned bytes)
}
#endif
assert(0 && "Unreachable");
return 0;
}

//
Expand Down
6 changes: 0 additions & 6 deletions redalert/dllinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
**
*/

// Exception handling isn't enabled
#pragma warning(disable : 4530) // warning C4530: C++ exception handler used, but unwind semantics are not enabled.

#include <string>
#include <vector>
#include <set>
Expand Down Expand Up @@ -72,9 +69,6 @@ typedef __int64 int64;
**
**
*/
// For compatibility with Watcom in audio enums
#pragma warning(disable : 4091)

// From RedAlert\Audio.cpp
typedef enum
{
Expand Down
3 changes: 0 additions & 3 deletions redalert/ipxmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@

#endif // WINSOCK_IPX

// Turn off "expression is not meaningful".
//#pragma warning 628 9

//#include "WolDebug.h"

/***************************************************************************
Expand Down
1 change: 0 additions & 1 deletion tiberiandawn/conquer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3613,7 +3613,6 @@ static bool Change_Local_Dir(int cd)
* 07/11/1995 JLB : Created. *
* 05/22/1996 ST : Handles multiple CD drives / CD changers *
*=============================================================================================*/
#pragma warning(disable : 4101)
bool Force_CD_Available(int cd)
{

Expand Down
9 changes: 0 additions & 9 deletions tiberiandawn/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@

#define FOREIGN_VERSION_NUMBER 6

//
// typedef enums with -1 will show this warning, even when the type of the enum is signed. It's a compiler bug,
// apparently ST - 1/8/2019 9:23AM
//
#pragma warning(push)
#pragma warning(disable : 4341)

/**********************************************************************
** These enumerations are used to implement RTTI.
*/
Expand Down Expand Up @@ -3042,6 +3035,4 @@ typedef enum StrategyType : unsigned char

#endif // USE_RA_AI

#pragma warning(pop)

#endif
3 changes: 0 additions & 3 deletions tiberiandawn/dllinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ typedef __int64 int64;
**
**
*/
// For compatibility with Watcom in audio enums
#pragma warning(disable : 4091)

// From TiberianDawn\Audio.cpp
typedef enum
{
Expand Down
2 changes: 0 additions & 2 deletions tiberiandawn/iomap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@

#include "function.h"

#pragma warning(disable : 4302) // Truncation from pointer to TARGET

/***********************************************************************************************
* CellClass::Should_Save -- Should the cell be written to disk? *
* *
Expand Down
2 changes: 0 additions & 2 deletions tiberiandawn/ioobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@

#include "function.h"

#pragma warning(disable : 4302) // Truncation from pointer to TARGET

/***********************************************************************************************
* TeamTypeClass::Load -- Loads from a save game file. *
* *
Expand Down
3 changes: 0 additions & 3 deletions tiberiandawn/ipxmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@
/* For `Players` vector */
#include "externs.h"

// Turn off "expression is not meaningful".
//#pragma warning 628 9

//#include "WolDebug.h"

/***************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion tools/miniposix/dirent/dirent.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ DIR *opendir(const char *name)
__seterrno(ENOENT);
return NULL;
}
size = wcslen(full) + 1;
size = (int)wcslen(full) + 1;
memcpy(wname, L"\\\\?\\", sizeof(wchar_t) * 5);
if (size > NTFS_MAX_PATH) {
free(wname);
Expand Down

0 comments on commit 9641ffc

Please sign in to comment.