1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

Allow compilation on gcc/clang without -Wno-unknown-pragmas.

This commit is contained in:
Nicholas Hastings
2013-10-06 13:46:15 -04:00
parent 34d4b05185
commit 9889382863
67 changed files with 218 additions and 17 deletions

View File

@ -245,7 +245,9 @@ void zfree(void *buf)
}
*/
#ifdef _WIN32
#pragma warning(disable : 4702) // unreachable code
#endif
typedef struct tm_unz_s
{ unsigned int tm_sec; // seconds after the minute - [0,59]

View File

@ -29,8 +29,10 @@ typedef enum _D3DFORMAT D3DFORMAT;
// The various image format types
//-----------------------------------------------------------------------------
#ifdef _WIN32
// don't bitch that inline functions aren't used!!!!
#pragma warning(disable : 4514)
#endif
enum ImageFormat
{

View File

@ -5127,9 +5127,9 @@ float Studio_GetPoseParameter( const CStudioHdr *pStudioHdr, int iParameter, flo
return ctlValue * (PoseParam.end - PoseParam.start) + PoseParam.start;
}
#ifdef _WIN32
#pragma warning (disable : 4701)
#endif
//-----------------------------------------------------------------------------
// Purpose:
@ -5237,8 +5237,9 @@ static int ClipRayToHitbox( const Ray_t &ray, mstudiobbox_t *pbox, matrix3x4_t&
return hitside;
}
#ifdef _WIN32
#pragma warning (default : 4701)
#endif
//-----------------------------------------------------------------------------
// Purpose:

View File

@ -792,7 +792,9 @@ struct dfaceid_t
#if defined( _X360 )
#pragma bitfield_order( push, lsb_to_msb )
#endif
#ifdef _WIN32
#pragma warning( disable:4201 ) // C4201: nonstandard extension used: nameless struct/union
#endif
struct dleaf_version_0_t
{
DECLARE_BYTESWAP_DATADESC();
@ -846,7 +848,9 @@ struct dleaf_t
// Precaculated light info for entities.
// CompressedLightCube m_AmbientLighting;
};
#ifdef _WIN32
#pragma warning( default:4201 ) // C4201: nonstandard extension used: nameless struct/union
#endif
#if defined( _X360 )
#pragma bitfield_order( pop )
#endif

View File

@ -10,10 +10,17 @@
#pragma once
#endif
#ifdef _WIN32
#pragma warning(push, 1)
#pragma warning(disable:4701 4702 4530)
#endif
#include <fstream>
#ifdef _WIN32
#pragma warning(pop)
#endif
#include "TokenReader.h"
#include "GDClass.h"
#include "InputOutput.h"

View File

@ -12,11 +12,17 @@
#include <tier0/dbg.h>
#include <utlvector.h>
#include <utldict.h>
#ifdef _WIN32
#pragma warning(push, 1)
#pragma warning(disable:4701 4702 4530)
#include <fstream>
#pragma warning(pop)
#endif
#include <fstream>
#ifdef _WIN32
#pragma warning(pop)
#endif
#define KEYVALUE_MAX_KEY_LENGTH 80
#define KEYVALUE_MAX_VALUE_LENGTH 512

View File

@ -1,7 +1,7 @@
#ifndef HAPTICS_INTERFACE_H
#define HAPTICS_INTERFACE_H
#ifdef GAME_DLL
#if defined( GAME_DLL ) && defined( _WIN32 )
#pragma warning("IHaptics.h is only for client ussage");
#endif

View File

@ -13,7 +13,10 @@
#include <string.h>
typedef unsigned char byte;
#ifdef _WIN32
#pragma warning(disable:4244)
#endif
#include "tier0/dbg.h"
#include "mathlib/vector.h"

View File

@ -593,7 +593,9 @@
// The Microsoft Visual C++ version of the 3DNow! macros.
// Stop the "no EMMS" warning, since it doesn't detect FEMMS properly
#ifdef _WIN32
#pragma warning(disable:4799)
#endif
// Defines for operands.
#define _K3D_MM0 0xc0

View File

@ -18,8 +18,9 @@
#include "basehandle.h"
#endif
#ifdef _WIN32
#pragma warning( disable : 4284 ) // warning C4284: return type for 'CNetworkVarT<int>::operator ->' is 'int *' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation)
#endif
#define MyOffsetOf( type, var ) ( (int)&((type*)0)->var )

View File

@ -32,7 +32,9 @@
#include "shaderlib/ShaderDLL.h"
// make "local variable is initialized but not referenced" warnings errors for combo checking macros
#ifdef _WIN32
#pragma warning ( error : 4189 )
#endif
//-----------------------------------------------------------------------------
// Global interfaces

View File

@ -68,7 +68,9 @@ enum UnitEncode
# pragma pack(pop)
// Turn off the no return value warning in ReadCounter.
#ifdef _WIN32
#pragma warning( disable : 4035 )
#endif
#define k8NUM_COUNTERS 4
class k8BaseEvent
{
@ -250,7 +252,9 @@ public:
};
#ifdef _WIN32
#pragma warning( default : 4035 )
#endif

View File

@ -8,7 +8,9 @@
#ifndef P4PERFORMANCECOUNTERS_H
#define P4PERFORMANCECOUNTERS_H
#ifdef _WIN32
#pragma once
#endif
// Pentium 4 support
/*
@ -75,7 +77,9 @@ enum Counters
// register base for CCCR register
#define MSR_CCCR_BASE 0x360
#ifdef _WIN32
#pragma pack(push, 1)
#endif
// access to these bits is through the methods
typedef union ESCR
{
@ -121,7 +125,9 @@ typedef union CCCR
} CCCR;
#ifdef _WIN32
#pragma pack(pop)
#endif
extern const unsigned short cccr_escr_map[NCOUNTERS][8];
@ -144,7 +150,9 @@ enum P4OverflowInterrupt
};
// Turn off the no return value warning in ReadCounter.
#ifdef _WIN32
#pragma warning( disable : 4035 )
#endif
class P4BaseEvent
{
int m_counter;
@ -314,7 +322,9 @@ public:
pme->WriteMSR( cccrPort, cccr.flat );
}
};
#ifdef _WIN32
#pragma warning( default : 4035 )
#endif
#include "EventMasks.h"
#include "EventModes.h"

View File

@ -12,8 +12,10 @@
#include "tier0/platform.h"
// Get rid of a bunch of STL warnings!
#ifdef _WIN32
#pragma warning( push, 3 )
#pragma warning( disable : 4018 )
#endif
#define VERSION "1.0.2"
@ -187,6 +189,8 @@ enum PerfErrors
E_ILLEGAL_OPERATION = -10,
};
#ifdef _WIN32
#pragma warning( pop )
#endif
#endif // PMELIB_H

View File

@ -811,7 +811,9 @@ void InvalidParameterViolation()
// Disable compiler optimizations. If we don't do this then VC++ generates code
// that confuses the Visual Studio debugger and causes it to display completely
// random call stacks. That makes the minidumps excruciatingly hard to understand.
#ifdef _WIN32
#pragma optimize("", off)
#endif
// Write a minidump file, unless running under the debugger in which case break
// into the debugger.
@ -848,7 +850,9 @@ void VInvalidParameterHandler(const wchar_t* expression,
}
// Restore compiler optimizations.
#ifdef _WIN32
#pragma optimize("", on)
#endif
// Helper class for registering error callbacks. See above for details.
class ErrorHandlerRegistrar
@ -1592,8 +1596,10 @@ class _LocaleUpdate
};
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable: 4483)
#endif
#if _MSC_FULL_VER >= 140050415
#define _NATIVE_STARTUP_NAMESPACE __identifier("<CrtImplementationDetails>")
#else /* _MSC_FULL_VER >= 140050415 */
@ -1649,7 +1655,9 @@ namespace _NATIVE_STARTUP_NAMESPACE
}
};
}
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif // _MSC_VER >= 1400

View File

@ -666,7 +666,7 @@ typedef void * HINSTANCE;
// When we port to 64 bit, we'll have to resolve the int, ptr vs size_t 32/64 bit problems...
#if !defined( _WIN64 )
#if !defined( _WIN64 ) && defined ( _WIN32 )
#pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
#pragma warning( disable : 4311 ) // pointer truncation from 'char *' to 'int'
#pragma warning( disable : 4312 ) // conversion from 'unsigned int' to 'memhandle_t' of greater size

View File

@ -579,7 +579,9 @@ void ConVar_PrintDescription( const ConCommandBase *pVar );
//-----------------------------------------------------------------------------
// Purpose: Utility class to quickly allow ConCommands to call member methods
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning (disable : 4355 )
#endif
template< class T >
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
@ -626,8 +628,9 @@ private:
FnMemberCommandCompletionCallback_t m_CompletionFunc;
};
#ifdef _WIN32
#pragma warning ( default : 4355 )
#endif
//-----------------------------------------------------------------------------
// Purpose: Utility macros to quicky generate a simple console command

View File

@ -21,8 +21,10 @@
#include "tier0/memalloc.h"
#include "tier0/memdbgon.h"
#ifdef _WIN32
#pragma warning (disable:4100)
#pragma warning (disable:4514)
#endif
//-----------------------------------------------------------------------------

View File

@ -20,8 +20,10 @@
#include "tier0/memalloc.h"
#include "tier0/memdbgon.h"
#ifdef _WIN32
#pragma warning (disable:4100)
#pragma warning (disable:4514)
#endif
//-----------------------------------------------------------------------------

View File

@ -545,8 +545,10 @@ inline I CUtlLinkedList<T,S,ML,I,M>::PrivateNext( I i ) const
// Are nodes in the list or valid?
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning(push)
#pragma warning( disable: 4310 ) // Allows "(I)(S)M::INVALID_INDEX" below
#endif
template <class T, class S, bool ML, class I, class M>
inline bool CUtlLinkedList<T,S,ML,I,M>::IndexInRange( I index ) // Static method
{
@ -565,7 +567,9 @@ inline bool CUtlLinkedList<T,S,ML,I,M>::IndexInRange( I index ) // Static method
return ( ( (S)index == index ) && ( (S)index != InvalidIndex() ) );
}
#ifdef _WIN32
#pragma warning(pop)
#endif
template <class T, class S, bool ML, class I, class M>
inline bool CUtlLinkedList<T,S,ML,I,M>::IsValidIndex( I i ) const

View File

@ -22,9 +22,10 @@
#include "tier0/memalloc.h"
#include "tier0/memdbgon.h"
#ifdef _WIN32
#pragma warning (disable:4100)
#pragma warning (disable:4514)
#endif
//-----------------------------------------------------------------------------

View File

@ -662,8 +662,10 @@ inline void CUtlRBTree<T, I, L, M>::SetColor( I i, typename CUtlRBTree<T, I, L,
//-----------------------------------------------------------------------------
// Allocates/ deallocates nodes
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif
template < class T, class I, typename L, class M >
I CUtlRBTree<T, I, L, M>::NewNode()
{
@ -708,7 +710,9 @@ I CUtlRBTree<T, I, L, M>::NewNode()
return elem;
}
#ifdef _WIN32
#pragma warning(pop)
#endif
template < class T, class I, typename L, class M >
void CUtlRBTree<T, I, L, M>::FreeNode( I i )

View File

@ -278,9 +278,11 @@ public:
// Especialy useful if you have a lot of vectors that are sparse, or if you're
// carefully packing holders of vectors
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable : 4200) // warning C4200: nonstandard extension used : zero-sized array in struct/union
#pragma warning(disable : 4815 ) // warning C4815: 'staticData' : zero-sized array in stack object will have no elements
#endif
class CUtlVectorUltraConservativeAllocator
{
@ -518,7 +520,9 @@ private:
}
};
#ifdef _WIN32
#pragma warning(pop)
#endif
//-----------------------------------------------------------------------------

View File

@ -124,8 +124,10 @@ bool LessFunc_GLMTexLayoutKey( const GLMTexLayoutKey &a, const GLMTexLayoutKey &
#define GLM_TEX_MAX_FACES 6
#define GLM_TEX_MAX_SLICES (GLM_TEX_MAX_MIPS * GLM_TEX_MAX_FACES)
#ifdef _WIN32
#pragma warning( push )
#pragma warning( disable : 4200 )
#endif
struct GLMTexLayout
{
@ -148,7 +150,9 @@ struct GLMTexLayout
GLMTexLayoutSlice m_slices[0]; // dynamically allocated 2-d array [faces][mips]
};
#ifdef _WIN32
#pragma warning( pop )
#endif
class CGLMTexLayoutTable
{

View File

@ -22,6 +22,7 @@
#endif
#endif
#ifdef _WIN32
#pragma warning( disable: 4800 ) // disables 'performance warning converting int to bool'
#pragma warning( disable: 4786 ) // disables 'identifier truncated in browser information' warning
#pragma warning( disable: 4355 ) // disables 'this' : used in base member initializer list
@ -29,6 +30,7 @@
#pragma warning( disable: 4514 ) // warning C4514: 'Color::Color' : unreferenced inline function has been removed
#pragma warning( disable: 4100 ) // warning C4100: 'code' : unreferenced formal parameter
#pragma warning( disable: 4127 ) // warning C4127: conditional expression is constant
#endif
typedef unsigned char uchar;
typedef unsigned short ushort;

View File

@ -55,7 +55,9 @@ typedef void (Panel::*MessageFunc_t)(void);
// Contains the information to map a string message name with parameters
// to a function call
//-----------------------------------------------------------------------------
#ifdef _WIN32
#pragma warning(disable:4121)
#endif
struct MessageMapItem_t
{
const char *name;

View File

@ -11,8 +11,9 @@
// $NoKeywords: $
//=============================================================================
#ifdef _WIN32
#pragma warning(disable: 4514)
#endif
// First include standard libraries
#include <stdio.h>

View File

@ -16,8 +16,10 @@
#define NTAB 32
#ifdef _WIN32
#pragma warning(push)
#pragma warning( disable:4251 )
#endif
//-----------------------------------------------------------------------------
// A generator of uniformly distributed random numbers
@ -102,8 +104,9 @@ VSTDLIB_INTERFACE float RandomGaussianFloat( float flMean = 0.0f, float flStdDev
//-----------------------------------------------------------------------------
VSTDLIB_INTERFACE void InstallUniformRandomStream( IUniformRandomStream *pStream );
#ifdef _WIN32
#pragma warning(pop)
#endif
#endif // VSTDLIB_RANDOM_H