Get rid of various old compiler and platform checks

This commit is contained in:
sfan5
2022-02-26 11:38:43 +01:00
parent 01586f584a
commit df908ef4ea
20 changed files with 34 additions and 214 deletions

View File

@ -61,7 +61,7 @@
//! WIN32 for Windows32
//! WIN64 for Windows64
// The windows platform and API support SDL and WINDOW device
#if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64)
#if defined(_WIN32) || defined(_WIN64)
#define _IRR_WINDOWS_
#define _IRR_WINDOWS_API_
#ifndef _IRR_COMPILE_WITH_SDL_DEVICE_
@ -69,14 +69,7 @@
#endif
#endif
#if defined(_MSC_VER) && (_MSC_VER < 1500)
# error "Only Microsoft Visual Studio 9.0 and later are supported."
#endif
#if defined(__APPLE__) || defined(MACOSX)
#if !defined(MACOSX)
#define MACOSX // legacy support
#endif
#if defined(__APPLE__)
#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) || defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
#define _IRR_IOS_PLATFORM_
#define _IRR_COMPILE_WITH_IOS_DEVICE_
@ -181,10 +174,6 @@ If not defined, Windows Multimedia library is used, which offers also broad supp
#ifdef NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#undef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#endif
// can't get this to compile currently under borland, can be removed if someone has a better solution
#if defined(__BORLANDC__)
#undef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#endif
#endif
@ -460,7 +449,7 @@ ones. */
#else // _IRR_WINDOWS_API_
// Force symbol export in shared libraries built with gcc.
#if (__GNUC__ >= 4) && !defined(_IRR_STATIC_LIB_) && defined(IRRLICHT_EXPORTS)
#if defined(__GNUC__) && !defined(_IRR_STATIC_LIB_) && defined(IRRLICHT_EXPORTS)
#define IRRLICHT_API __attribute__ ((visibility("default")))
#else
#define IRRLICHT_API
@ -480,22 +469,6 @@ ones. */
#undef __IRR_HAS_S64
#endif
#if defined(__BORLANDC__)
#include <tchar.h>
// Borland 5.5.1
#if __BORLANDC__ == 0x551
#undef _tfinddata_t
#undef _tfindfirst
#undef _tfindnext
#define _tfinddata_t __tfinddata_t
#define _tfindfirst __tfindfirst
#define _tfindnext __tfindnext
typedef long intptr_t;
#endif
#endif
#ifndef __has_feature
#define __has_feature(x) 0 // Compatibility with non-clang compilers.
#endif

View File

@ -15,11 +15,6 @@ namespace irr
namespace core
{
#ifdef DEBUG_CLIENTBLOCK
#undef DEBUG_CLIENTBLOCK
#define DEBUG_CLIENTBLOCK new
#endif
//! Very simple allocator implementation, containers using it can be used across dll boundaries
template<typename T>
class irrAllocator
@ -102,12 +97,6 @@ public:
};
#ifdef DEBUG_CLIENTBLOCK
#undef DEBUG_CLIENTBLOCK
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#endif
//! defines an allocation strategy (used only by irr::array so far)
enum eAllocStrategy
{

View File

@ -61,22 +61,17 @@ typedef double f64;
#include <wchar.h>
#ifdef _IRR_WINDOWS_API_
//! Defines for s{w,n}printf_irr because s{w,n}printf methods do not match the ISO C
//! standard on Windows platforms.
//! We want int snprintf_irr(char *str, size_t size, const char *format, ...);
//! and int swprintf_irr(wchar_t *wcs, size_t maxlen, const wchar_t *format, ...);
#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
#if defined(_MSC_VER)
#define swprintf_irr swprintf_s
#define snprintf_irr sprintf_s
#elif !defined(__CYGWIN__)
#define swprintf_irr _snwprintf
#define snprintf_irr _snprintf
#endif
#else
#define swprintf_irr swprintf
#define snprintf_irr snprintf
#endif // _IRR_WINDOWS_API_
#endif // _MSC_VER
namespace irr
{
@ -89,15 +84,11 @@ namespace irr
//! define a break macro for debugging.
#if defined(_DEBUG)
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && !defined (_WIN32_WCE)
#if defined(WIN64) || defined(_WIN64) // using portable common solution for x64 configuration
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)
#include <crtdbg.h>
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_CrtDbgBreak();}
#else
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#endif
#else
#include "assert.h"
#include <assert.h>
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) assert( !(_CONDITION_) );
#endif
#else
@ -113,9 +104,9 @@ For functions: template<class T> _IRR_DEPRECATED_ void test4(void) {}
**/
#if defined(IGNORE_DEPRECATED_WARNING)
#define _IRR_DEPRECATED_
#elif _MSC_VER >= 1310 //vs 2003 or higher
#elif defined(_MSC_VER)
#define _IRR_DEPRECATED_ __declspec(deprecated)
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) // all versions above 3.0 should support this feature
#elif defined(__GNUC__)
#define _IRR_DEPRECATED_ __attribute__ ((deprecated))
#else
#define _IRR_DEPRECATED_
@ -125,35 +116,7 @@ For functions: template<class T> _IRR_DEPRECATED_ void test4(void) {}
/** Usage in a derived class:
virtual void somefunc() _IRR_OVERRIDE_;
*/
#if ( ((__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))) && (defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L) )
#define _IRR_OVERRIDE_ override
#elif (_MSC_VER >= 1600 ) /* supported since MSVC 2010 */
#define _IRR_OVERRIDE_ override
#elif (__clang_major__ >= 3 && __has_feature(cxx_override_control))
#define _IRR_OVERRIDE_ override
#else
#define _IRR_OVERRIDE_
#endif
// memory debugging
#if defined(_DEBUG) && defined(IRRLICHT_EXPORTS) && defined(_MSC_VER) && \
(_MSC_VER > 1299) && !defined(_IRR_DONT_DO_MEMORY_DEBUGGING_HERE) && !defined(_WIN32_WCE)
#define CRTDBG_MAP_ALLOC
#define _CRTDBG_MAP_ALLOC
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#include <stdlib.h>
#include <crtdbg.h>
#define new DEBUG_CLIENTBLOCK
#endif
//! ignore VC8 warning deprecated
/** The Microsoft compiler */
#if defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER >= 1400)
//#pragma warning( disable: 4996)
//#define _CRT_SECURE_NO_DEPRECATE 1
//#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
//! creates four CC codes used in Irrlicht for simple ids

View File

@ -13,26 +13,13 @@
// in between!
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#if defined(_MSC_VER)
# pragma warning(disable: 4103)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __DMC__ )
# pragma pack( push, 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
// Using pragma pack might work with earlier gcc versions already, but
// it started to be necessary with gcc 4.7 on mingw unless compiled with -mno-ms-bitfields.
// And I found some hints on the web that older gcc versions on the other hand had sometimes
// trouble with pragma pack while they worked with __attribute__((packed)).
# if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
# else
# define PACK_STRUCT __attribute__((packed))
#endif
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif

View File

@ -6,14 +6,8 @@
// file belongs to irrpack.h, see there for more info
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
#if defined(_MSC_VER)
# pragma pack( pop, packing )
#elif defined (__DMC__)
# pragma pack( pop )
#elif defined( __GNUC__ )
# if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))
# pragma pack( pop, packing )
# endif
#endif
#undef PACK_STRUCT