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

View File

@ -15,10 +15,6 @@
#include "SExposedVideoData.h"
#include "IContextManager.h"
#ifdef _MSC_VER
#pragma comment(lib, "libEGL.lib")
#endif
namespace irr
{
namespace video

View File

@ -23,11 +23,9 @@
#endif
#if defined (_IRR_WINDOWS_API_)
#if !defined ( _WIN32_WCE )
#include <direct.h> // for _chdir
#include <io.h> // for _access
#include <tchar.h>
#endif
#include <direct.h> // for _chdir
#include <io.h> // for _access
#include <tchar.h>
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_) || defined(_IRR_IOS_PLATFORM_) || defined(_IRR_ANDROID_PLATFORM_))
#include <stdio.h>
#include <stdlib.h>
@ -797,7 +795,6 @@ IFileList* CFileSystem::createFileList()
// --------------------------------------------
//! Windows version
#ifdef _IRR_WINDOWS_API_
#if !defined ( _WIN32_WCE )
r = new CFileList(Path, true, false);
@ -819,12 +816,7 @@ IFileList* CFileSystem::createFileList()
_findclose( hFile );
}
#endif
//TODO add drives
//entry.Name = "E:\\";
//entry.isDirectory = true;
//Files.push_back(entry);
#endif
// --------------------------------------------

View File

@ -18,9 +18,7 @@
#ifdef _IRR_WINDOWS_API_
#define WIN32_LEAN_AND_MEAN
#if !defined(_IRR_XBOX_PLATFORM_)
#include <windows.h>
#endif
#include <windows.h>
#define _IRR_WINDOWS_NT_CONSOLE_
#else
#include <time.h>

View File

@ -22,20 +22,13 @@
#include "IGUISpriteBank.h"
#include <winuser.h>
#include "SExposedVideoData.h"
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
#include <mmsystem.h>
#include <regstr.h>
#ifdef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#ifdef _MSC_VER
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
#endif
#else
#ifdef _MSC_VER
#pragma comment(lib, "winmm.lib")
#endif
#endif
#endif

View File

@ -13,11 +13,9 @@
#include "IImagePresenter.h"
#define WIN32_LEAN_AND_MEAN
#if !defined(_IRR_XBOX_PLATFORM_)
#include <windows.h>
#include <mmsystem.h> // For JOYCAPS
#include <windowsx.h>
#endif
#include <windows.h>
#include <mmsystem.h> // For JOYCAPS
#include <windowsx.h>
#if !defined(GET_X_LPARAM)
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))

View File

@ -22,10 +22,6 @@
#include "SLight.h"
#include "SExposedVideoData.h"
#ifdef _MSC_VER
#pragma warning( disable: 4996)
#endif
namespace irr
{
namespace io

View File

@ -27,10 +27,6 @@
#include <windows.h>
#endif
#ifdef _MSC_VER
#pragma comment(lib, "libGLESv2.lib")
#endif
namespace irr
{
namespace video

View File

@ -26,10 +26,6 @@
#include <windows.h>
#endif
#ifdef _MSC_VER
#pragma comment(lib, "libGLES_CM.lib")
#endif
namespace irr
{
namespace video

View File

@ -5,9 +5,7 @@
#include "COSOperator.h"
#ifdef _IRR_WINDOWS_API_
#ifndef _IRR_XBOX_PLATFORM_
#include <windows.h>
#endif
#else
#include <string.h>
#include <unistd.h>
@ -63,8 +61,7 @@ void COSOperator::copyToClipboard(const c8 *text) const
return;
// Windows version
#if defined(_IRR_XBOX_PLATFORM_)
#elif defined(_IRR_WINDOWS_API_)
#if defined(_IRR_WINDOWS_API_)
if (!OpenClipboard(NULL) || text == 0)
return;
@ -101,8 +98,6 @@ void COSOperator::copyToClipboard(const c8 *text) const
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux )
IrrDeviceLinux->copyToClipboard(text);
#else
#endif
}
@ -111,9 +106,7 @@ void COSOperator::copyToClipboard(const c8 *text) const
//! \return Returns 0 if no string is in there, otherwise an utf-8 string.
const c8* COSOperator::getTextFromClipboard() const
{
#if defined(_IRR_XBOX_PLATFORM_)
return 0;
#elif defined(_IRR_WINDOWS_API_)
#if defined(_IRR_WINDOWS_API_)
if (!OpenClipboard(NULL))
return 0;
@ -156,7 +149,7 @@ const c8* COSOperator::getTextFromClipboard() const
bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
{
#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_)
#if defined(_IRR_WINDOWS_API_)
MEMORYSTATUSEX MemoryStatusEx;
MemoryStatusEx.dwLength = sizeof(MEMORYSTATUSEX);

View File

@ -20,11 +20,6 @@
#include <GL/glext.h>
#endif
#include <GL/wglext.h>
#ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib")
#endif
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1

View File

@ -11,10 +11,6 @@
#include <GL/gl.h>
#include <GL/wglext.h>
#ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib")
#endif
namespace irr
{
namespace video

View File

@ -8,7 +8,7 @@ static const char* const copyright = "Irrlicht Engine (c) 2002-2017 Nikolaus Geb
#ifdef _IRR_WINDOWS_
#include <windows.h>
#if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(_WIN32_WCE)
#if defined(_DEBUG) && !defined(__GNUWIN32__)
#include <crtdbg.h>
#endif // _DEBUG
#endif
@ -148,7 +148,7 @@ BOOL APIENTRY DllMain( HANDLE hModule,
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
#if defined(_DEBUG) && !defined(__GNUWIN32__) && !defined(__BORLANDC__) && !defined (_WIN32_WCE) && !defined (_IRR_XBOX_PLATFORM_)
#if defined(_DEBUG) && !defined(__GNUWIN32__)
_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
#endif
break;

View File

@ -1,30 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__
#define __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifndef REALINLINE
#ifdef _MSC_VER
#define REALINLINE __forceinline
#else
#define REALINLINE inline
#endif
#endif
//! Size of a static C-style array.
#define array_size(_arr) ((sizeof(_arr)/sizeof(*_arr)))
//! Compiler Align
#if defined(_MSC_VER)
#define ALIGN(x) __declspec(align(x))
#elif defined(__GNUC__)
#define ALIGN(x) __attribute__ ((aligned(x)))
#else
#define ALIGN(x)
#endif
#endif // __S_VIDEO_2_SOFTWARE_COMPILE_CONFIG_H_INCLUDED__

View File

@ -10,10 +10,17 @@
#ifndef __S_VIDEO_2_SOFTWARE_HELPER_H_INCLUDED__
#define __S_VIDEO_2_SOFTWARE_HELPER_H_INCLUDED__
#include "SoftwareDriver2_compile_config.h"
#include "irrMath.h"
#include "SMaterial.h"
#ifndef REALINLINE
#ifdef _MSC_VER
#define REALINLINE __forceinline
#else
#define REALINLINE inline
#endif
#endif
namespace irr
{

View File

@ -12,14 +12,12 @@
#define bswap_16(X) SDL_Swap16(X)
#define bswap_32(X) SDL_Swap32(X)
#define bswap_64(X) SDL_Swap64(X)
#elif defined(_IRR_WINDOWS_API_) && defined(_MSC_VER) && (_MSC_VER > 1298)
#elif defined(_IRR_WINDOWS_API_) && defined(_MSC_VER)
#include <stdlib.h>
#define bswap_16(X) _byteswap_ushort(X)
#define bswap_32(X) _byteswap_ulong(X)
#define bswap_64(X) _byteswap_uint64(X)
#if (_MSC_VER >= 1400)
#define localtime _localtime_s
#endif
#elif defined(_IRR_OSX_PLATFORM_) || defined(_IRR_IOS_PLATFORM_)
#include <libkern/OSByteOrder.h>
#define bswap_16(X) OSReadSwapInt16(&X,0)
@ -65,13 +63,9 @@ namespace os
// Windows specific functions
// ----------------------------------------------------------------
#ifdef _IRR_XBOX_PLATFORM_
#include <xtl.h>
#else
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <time.h>
#endif
namespace irr
{
@ -80,16 +74,10 @@ namespace os
//! prints a debuginfo string
void Printer::print(const c8* message, ELOG_LEVEL ll)
{
#if defined (_WIN32_WCE )
core::stringw tmp(message);
tmp += L"\n";
OutputDebugStringW(tmp.c_str());
#else
core::stringc tmp(message);
tmp += "\n";
OutputDebugStringA(tmp.c_str());
printf("%s", tmp.c_str());
#endif
}
static LARGE_INTEGER HighPerformanceFreq;