Skip to content

Commit

Permalink
Wrap #pragma warnings to avoid GCC compilation warnings (#134, #135)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Nov 29, 2021
1 parent 73000ac commit 3734bc9
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 22 deletions.
10 changes: 8 additions & 2 deletions Inc/DirectXCollision.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ namespace DirectX
struct BoundingOrientedBox;
struct BoundingFrustum;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4324 4820)
// C4324: alignment padding warnings
// C4820: Off by default noise
#endif

//-------------------------------------------------------------------------------------
// Bounding sphere
Expand Down Expand Up @@ -321,20 +323,23 @@ namespace DirectX
// Test a triangle against six planes at once (see BoundingFrustum::GetPlanes)
}

#ifdef _MSC_VER
#pragma warning(pop)
#endif

/****************************************************************************
*
* Implementation
*
****************************************************************************/

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4068 4365 4616 6001)
// C4068/4616: ignore unknown pragmas
// C4365: Off by default noise
// C6001: False positives

#endif
#ifdef _PREFAST_
#pragma prefast(push)
#pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes")
Expand All @@ -346,8 +351,9 @@ namespace DirectX
#ifdef _PREFAST_
#pragma prefast(pop)
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

} // namespace DirectX

5 changes: 1 addition & 4 deletions Inc/DirectXMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ namespace DirectX
// C4365: Off by default noise
// C4324/4820: padding warnings
#endif

#ifdef _PREFAST_
#pragma prefast(push)
#pragma prefast(disable : 25000, "FXMVECTOR is 16 bytes")
Expand Down Expand Up @@ -947,11 +948,9 @@ namespace DirectX
#ifdef __clang__
#pragma clang diagnostic pop
#endif

#ifdef _PREFAST_
#pragma prefast(pop)
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
Expand Down Expand Up @@ -2192,11 +2191,9 @@ namespace DirectX
#ifdef __clang__
#pragma clang diagnostic pop
#endif

#ifdef _PREFAST_
#pragma prefast(pop)
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif
Expand Down
24 changes: 16 additions & 8 deletions Inc/DirectXPackedVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ namespace DirectX

namespace PackedVector
{

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4201 4365 4324 4996)
// C4201: nonstandard extension used
// C4365: Off by default noise
// C4324: alignment padding warnings
// C4996: deprecation warnings
#endif

#ifdef __clang__
#pragma clang diagnostic push
Expand Down Expand Up @@ -1048,9 +1049,9 @@ namespace DirectX
#ifdef __clang__
#pragma clang diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)

#endif

/****************************************************************************
*
Expand Down Expand Up @@ -1107,9 +1108,11 @@ namespace DirectX
XMVECTOR XM_CALLCONV XMLoadUNibble4(_In_ const XMUNIBBLE4* pSource) noexcept;
XMVECTOR XM_CALLCONV XMLoadU555(_In_ const XMU555* pSource) noexcept;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand All @@ -1123,8 +1126,9 @@ namespace DirectX
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

/****************************************************************************
*
Expand Down Expand Up @@ -1164,9 +1168,11 @@ namespace DirectX
void XM_CALLCONV XMStoreUNibble4(_Out_ XMUNIBBLE4* pDestination, _In_ FXMVECTOR V) noexcept;
void XM_CALLCONV XMStoreU555(_Out_ XMU555* pDestination, _In_ FXMVECTOR V) noexcept;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand All @@ -1180,21 +1186,23 @@ namespace DirectX
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

/****************************************************************************
*
* Implementation
*
****************************************************************************/

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4068 4214 4204 4365 4616 6001 6101)
// C4068/4616: ignore unknown pragmas
// C4214/4204: nonstandard extension used
// C4365: Off by default noise
// C6001/6101: False positives
#endif

#ifdef _PREFAST_
#pragma prefast(push)
Expand All @@ -1207,9 +1215,9 @@ namespace DirectX
#ifdef _PREFAST_
#pragma prefast(pop)
#endif

#ifdef _MSC_VER
#pragma warning(pop)

#endif
} // namespace PackedVector

} // namespace DirectX
Expand Down
26 changes: 20 additions & 6 deletions Inc/DirectXPackedVector.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,11 @@ inline XMVECTOR XM_CALLCONV XMLoadXDecN4(const XMXDECN4* pSource) noexcept
}

//------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -1558,8 +1560,9 @@ inline XMVECTOR XM_CALLCONV XMLoadXDec4(const XMXDEC4* pSource) noexcept
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

//------------------------------------------------------------------------------
_Use_decl_annotations_
Expand Down Expand Up @@ -1696,9 +1699,11 @@ inline XMVECTOR XM_CALLCONV XMLoadUDec4(const XMUDEC4* pSource) noexcept
}

//------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -1801,8 +1806,9 @@ inline XMVECTOR XM_CALLCONV XMLoadDec4(const XMDEC4* pSource) noexcept
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

//------------------------------------------------------------------------------
_Use_decl_annotations_
Expand Down Expand Up @@ -2903,9 +2909,11 @@ inline void XM_CALLCONV XMStoreXDecN4
}

//------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -2982,8 +2990,9 @@ inline void XM_CALLCONV XMStoreXDec4
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

//------------------------------------------------------------------------------
_Use_decl_annotations_
Expand Down Expand Up @@ -3194,9 +3203,11 @@ inline void XM_CALLCONV XMStoreUDec4
}

//------------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -3327,8 +3338,9 @@ inline void XM_CALLCONV XMStoreDec4
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

//------------------------------------------------------------------------------
_Use_decl_annotations_
Expand Down Expand Up @@ -4142,10 +4154,11 @@ inline XMXDECN4::XMXDECN4(const float* pArray) noexcept
* XMXDEC4 operators
*
****************************************************************************/

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
// C4996: ignore deprecation warning
#endif

#ifdef __GNUC__
#pragma GCC diagnostic push
Expand Down Expand Up @@ -4227,8 +4240,9 @@ inline XMDEC4::XMDEC4(const float* pArray) noexcept
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#ifdef _MSC_VER
#pragma warning(pop)
#endif

/****************************************************************************
*
Expand Down
2 changes: 2 additions & 0 deletions SHMath/DirectXSH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
// http://go.microsoft.com/fwlink/p/?LinkId=262885
//-------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning( disable : 4619 4456 )
// C4619 #pragma warning warnings
// C4456 declaration hides previous local declaration
#endif

#ifdef __clang__
#pragma clang diagnostic ignored "-Wold-style-cast"
Expand Down
9 changes: 8 additions & 1 deletion SHMath/DirectXSHD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// http://go.microsoft.com/fwlink/p/?LinkId=262885
//-------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning( disable : 4616 4619 4061 4265 4626 5039 )
// C4616/C4619 #pragma warning warnings
// C4061 numerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
Expand All @@ -16,8 +17,11 @@

#pragma warning(push)
#pragma warning(disable: 4365)
#endif
#include <d3d11_1.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include "DirectXSH.h"

Expand Down Expand Up @@ -89,8 +93,10 @@ namespace
}\
return false;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 6101)
#endif
_Success_(return)
bool _LoadScanline(
_Out_writes_(count) DirectX::XMVECTOR* pDestination,
Expand Down Expand Up @@ -165,8 +171,9 @@ namespace
return false;
}
}
#ifdef _MSC_VER
#pragma warning(pop)

#endif
} // namespace anonymous

//-------------------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion SHMath/DirectXSHD3D12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
// http://go.microsoft.com/fwlink/p/?LinkId=262885
//-------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning( disable : 4616 4619 4061 4265 4626 5039 )
// C4616/C4619 #pragma warning warnings
// C4061 numerator 'identifier' in switch of enum 'enumeration' is not explicitly handled by a case label
// C4265 class has virtual functions, but destructor is not virtual
// C4626 assignment operator was implicitly defined as deleted
// C5039 pointer or reference to potentially throwing function passed to extern C function under - EHc
#endif

#include <d3d12.h>

Expand Down Expand Up @@ -86,8 +88,10 @@ namespace
}\
return false;

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 6101)
#endif
_Success_(return)
bool _LoadScanline(
_Out_writes_(count) DirectX::XMVECTOR* pDestination,
Expand Down Expand Up @@ -162,8 +166,9 @@ namespace
return false;
}
}
#ifdef _MSC_VER
#pragma warning(pop)

#endif
} // namespace anonymous

//-------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 3734bc9

Please sign in to comment.