1
0
forked from mirrors/0ad

Remove ICC code paths

This commit is contained in:
Itms
2024-11-17 22:02:44 +01:00
parent 3f3bb8300e
commit 8f43dd53fc
15 changed files with 25 additions and 156 deletions
+2 -3
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -64,8 +64,7 @@ static const size_t vectorSize = 16;
ASSERT(IsAligned(size, vectorSize))
#define ASSERT_VECTOR_ALIGNED(pointer)\
ASSERT_VECTOR_MULTIPLE(pointer);\
ASSUME_ALIGNED(pointer, vectorSize)
ASSERT_VECTOR_MULTIPLE(pointer)
//
+2 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -83,7 +83,7 @@ struct Growth_Exponential
// allocators such as Arena append variable-sized intervals).
//
// we don't store smart pointers because storage usually doesn't need
// to be copied, and ICC 11 sometimes wasn't able to inline Address().
// to be copied.
struct Storage
{
// @return starting address (alignment depends on the allocator).
+2 -5
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2022 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -127,10 +127,7 @@ i64 movsx_le64(const u8* p, size_t size);
i64 movsx_be64(const u8* p, size_t size);
#if ICC_VERSION
#define swap32 _bswap
#define swap64 _bswap64
#elif MSC_VERSION
#if MSC_VERSION
extern unsigned short _byteswap_ushort(unsigned short);
extern unsigned long _byteswap_ulong(unsigned long);
extern unsigned __int64 _byteswap_uint64(unsigned __int64);
+4 -29
View File
@@ -50,10 +50,6 @@
**/
#if HAVE_C99 && GCC_VERSION // _Pragma from C99, unused from GCC
# define UNUSED2(param) _Pragma("unused " #param)
#elif ICC_VERSION
// ICC 12 still doesn't recognize pragma unused, casting to void
// isn't sufficient, and self-assignment doesn't work for references.
# define UNUSED2(param) do{ if(&param) {} } while(false)
#else
# define UNUSED2(param) ((void)(param))
#endif
@@ -142,7 +138,7 @@ inline void ignore_result(const T&) {}
// compiler-specific backend for UNREACHABLE.
// #define it to nothing if the compiler doesn't support such a hint.
#define HAVE_ASSUME_UNREACHABLE 1
#if MSC_VERSION && !ICC_VERSION // (ICC ignores this)
#if MSC_VERSION
# define ASSUME_UNREACHABLE __assume(0)
#elif GCC_VERSION
# define ASSUME_UNREACHABLE __builtin_unreachable()
@@ -158,14 +154,12 @@ inline void ignore_result(const T&) {}
#if HAVE_ASSUME_UNREACHABLE && !CONFIG_ENABLE_CHECKS
# define UNREACHABLE ASSUME_UNREACHABLE
// otherwise (or if CONFIG_ENABLE_CHECKS is set), add a user-visible
// warning if the code is reached. note that abort() fails to stop
// ICC from warning about the lack of a return statement, so we
// use an infinite loop instead.
// warning if the code is reached.
#else
# define UNREACHABLE\
STMT(\
DEBUG_WARN_ERR(ERR::LOGIC); /* hit supposedly unreachable code */\
for(;;){};\
abort();\
)
#endif
@@ -222,9 +216,6 @@ switch(x % 2)
* };
* @endcode
*
* This is preferable to inheritance from boost::noncopyable because it avoids
* ICC 11 W4 warnings about non-virtual dtors and suppression of the copy
* assignment operator.
*/
#define NONCOPYABLE(className) \
className(const className&) = delete; \
@@ -238,12 +229,6 @@ switch(x % 2)
className(className&&) = default; \
className& operator=(className&&) = default
#if ICC_VERSION
# define ASSUME_ALIGNED(ptr, multiple) __assume_aligned(ptr, multiple)
#else
# define ASSUME_ALIGNED(ptr, multiple)
#endif
// annotate printf-style functions for compile-time type checking.
// fmtpos is the index of the format argument, counting from 1 or
// (if it's a non-static class function) 2; the '...' is assumed
@@ -271,9 +256,7 @@ switch(x % 2)
/**
* prevent the compiler from reordering loads or stores across this point.
**/
#if ICC_VERSION
# define COMPILER_FENCE __memory_barrier()
#elif MSC_VERSION
#if MSC_VERSION
# include <intrin.h>
# pragma intrinsic(_ReadWriteBarrier)
# define COMPILER_FENCE _ReadWriteBarrier()
@@ -322,14 +305,6 @@ switch(x % 2)
// .. VC8 provides __restrict
#elif MSC_VERSION
# define RESTRICT __restrict
// .. ICC supports the keyword 'restrict' when run with the /Qrestrict option,
// but it always also supports __restrict__ or __restrict to be compatible
// with GCC/MSVC, so we'll use the underscored version. One of {GCC,MSC}_VERSION
// should have been defined in addition to ICC_VERSION, so we should be using
// one of the above cases (unless it's an old VS7.1-emulating ICC).
#elif ICC_VERSION
# error ICC_VERSION defined without either GCC_VERSION or an adequate MSC_VERSION
// .. unsupported; remove it from code
#else
# define RESTRICT
#endif
+1 -14
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -113,14 +113,6 @@ enum DataKind
//-----------------------------------------------------------------------------
#if ICC_VERSION
# pragma warning(push)
# pragma warning(disable:94) // the size of an array must be greater than zero
# pragma warning(disable:271) // trailing comma is nonstandard
# pragma warning(disable:418) // declaration requires a typedef name
# pragma warning(disable:791) // calling convention specified more than once
#endif
#pragma pack(push, 8) // seems to be required
#define _NO_CVCONST_H // request SymTagEnum be defined
@@ -128,11 +120,6 @@ enum DataKind
#pragma pack(pop)
#if ICC_VERSION
# pragma warning(pop)
#endif
//-----------------------------------------------------------------------------
// rationale: Debugging Tools For Windows includes newer header/lib files,
@@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,7 +24,7 @@
// raised when templates are instantiated (e.g. vfs_lookup.cpp),
// so include this header from such source files as well.
#include "lib/sysdep/compiler.h" // ICC_VERSION
#include "lib/sysdep/compiler.h" // MSC_VERSION
#include "lib/sysdep/arch.h" // ARCH_IA32
#if MSC_VERSION
@@ -41,19 +41,3 @@
# pragma warning(disable:4514) // unreferenced inlined function has been removed
# pragma warning(disable:4571) // Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
#endif
#if ICC_VERSION
# pragma warning(push)
# pragma warning(disable:82) // storage class is not first
# pragma warning(disable:193) // zero used for undefined preprocessing identifier
# pragma warning(disable:304) // access control not specified
# pragma warning(disable:367) // duplicate friend declaration
# pragma warning(disable:444) // destructor for base class is not virtual
# pragma warning(disable:522) // function redeclared inline after being called
# pragma warning(disable:811) // exception specification for implicitly declared virtual function is incompatible with that of overridden function
# pragma warning(disable:1879) // unimplemented pragma ignored
# pragma warning(disable:2270) // the declaration of the copy assignment operator has been suppressed
# pragma warning(disable:2273) // the declaration of the copy constructor has been suppressed
# if ARCH_IA32
# pragma warning(disable:693) // calling convention specified here is ignored
# endif
#endif
+1 -11
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -44,16 +44,6 @@
# pragma warning(disable:6246) // local declaration hides declaration of the same name in outer scope
# pragma warning(disable:6326) // potential comparison of a constant with another constant
# pragma warning(disable:6334) // sizeof operator applied to an expression with an operator might yield unexpected results
// .. Intel-specific
# if ICC_VERSION
# pragma warning(disable:383) // value copied to temporary, reference to temporary used
# pragma warning(disable:981) // operands are evaluated in unspecified order
# pragma warning(disable:1418) // external function definition with no prior declaration (raised for all non-static function templates)
# pragma warning(disable:1572) // floating-point equality and inequality comparisons are unreliable
# pragma warning(disable:1684) // conversion from pointer to same-sized integral type
# pragma warning(disable:1786) // function is deprecated (disabling 4996 isn't sufficient)
# pragma warning(disable:2415) // variable of static storage duration was declared but never referenced (raised by Boost)
# endif
// .. disabled by default in W4, ENABLE them
# pragma warning(default:4062) // enumerator is not handled
# pragma warning(default:4254) // [bit field] conversion, possible loss of data
-5
View File
@@ -54,11 +54,6 @@
// (as soon as possible so that headers below are covered)
#include "lib/pch/pch_warnings.h"
#if ICC_VERSION
#include <mathimf.h> // (must come before <cmath> or <math.h> (replaces them))
double __cdecl abs(double x); // not declared by mathimf
#endif
//
// headers made available everywhere for convenience
+4 -10
View File
@@ -1,4 +1,4 @@
/* Copyright (c) 2022 Wildfire Games.
/* Copyright (c) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -29,19 +29,13 @@
// detect compiler and its version (0 if not present, otherwise
// major*100 + minor). note that more than one *_VERSION may be
// non-zero due to interoperability (e.g. ICC with MSC).
// non-zero due to interoperability.
// .. VC
#ifdef _MSC_VER
# define MSC_VERSION _MSC_VER
#else
# define MSC_VERSION 0
#endif
// .. ICC (VC-compatible, GCC-compatible)
#if defined(__INTEL_COMPILER)
# define ICC_VERSION __INTEL_COMPILER
#else
# define ICC_VERSION 0
#endif
// .. LCC (Win32) and MCST LCC (E2K) compilers define same identifier (__LCC__)
#if defined(__LCC__) && !defined(__MCST__)
# define LCC_VERSION __LCC__
@@ -106,7 +100,7 @@
#ifndef COMPILER_HAS_SSE
# if GCC_VERSION && defined(__SSE__)
# define COMPILER_HAS_SSE 1
# elif MSC_VERSION // also includes ICC
# elif MSC_VERSION
# define COMPILER_HAS_SSE 1
# else
# define COMPILER_HAS_SSE 0
@@ -116,7 +110,7 @@
#ifndef COMPILER_HAS_SSE2
# if GCC_VERSION && defined(__SSE2__)
# define COMPILER_HAS_SSE2 1
# elif MSC_VERSION // also includes ICC
# elif MSC_VERSION
# define COMPILER_HAS_SSE2 1
# else
# define COMPILER_HAS_SSE2 0
-37
View File
@@ -1,37 +0,0 @@
/* Copyright (C) 2015 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// for each project that builds a shared-library, include this "header" in
// one source file that is on the linker command line.
// (avoids the ICC remark "Main entry point was not seen")
#if OS_WIN
#include "lib/sysdep/os/win/win.h"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD UNUSED(reason), LPVOID UNUSED(reserved))
{
// avoid unnecessary DLL_THREAD_ATTACH/DETACH calls
// (ignore failure - happens if the DLL uses TLS)
(void)DisableThreadLibraryCalls(hInstance);
return TRUE; // success (ignored unless reason == DLL_PROCESS_ATTACH)
}
#endif
+1 -2
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2024 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -384,7 +384,6 @@ static double MeasureRelativeDistance()
{
const size_t size = 32*MiB;
void* mem = vm::Allocate(size);
ASSUME_ALIGNED(mem, pageSize);
const uintptr_t previousProcessorMask = os_cpu_SetThreadAffinityMask(os_cpu_ProcessorMask());
@@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -42,7 +42,7 @@ typedef short int16_t;
typedef int int32_t;
#endif
#if MSC_VERSION || ICC_VERSION || LCC_VERSION
#if MSC_VERSION || LCC_VERSION
typedef __int64 int64_t;
#else
typedef long long int64_t;
@@ -51,7 +51,7 @@ typedef long long int64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#if MSC_VERSION || ICC_VERSION || LCC_VERSION
#if MSC_VERSION || LCC_VERSION
typedef unsigned __int64 uint64_t;
#else
typedef unsigned long long uint64_t;
+2 -9
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2023 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -40,14 +40,7 @@ const char* wversion_Family()
UNUSED2(RegQueryValueExW(hKey, L"CurrentVersion", 0, 0, reinterpret_cast<LPBYTE>(windowsVersionString), &size));
unsigned major = 0, minor = 0;
// ICC 11.1.082 generates incorrect code for the following:
// const int ret = swscanf_s(windowsVersionString, L"%u.%u", &major, &minor);
std::wstringstream ss(windowsVersionString);
ss >> major;
wchar_t dot;
ss >> dot;
ENSURE(dot == '.');
ss >> minor;
swscanf_s(windowsVersionString, L"%u.%u", &major, &minor);
ENSURE(4 <= major && major <= 0xFF);
ENSURE(minor <= 0xFF);
+1 -7
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2025 Wildfire Games.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -49,12 +49,6 @@
#else
# define STL_GCC 0
#endif
// .. ICC
#if defined(__INTEL_CXXLIB_ICC)
# define STL_ICC __INTEL_CXXLIB_ICC
#else
# define STL_ICC 0
#endif
// disable (slow!) iterator checks in release builds (unless someone already defined this)
-1
View File
@@ -331,7 +331,6 @@ void RunHardwareDetection(bool writeSystemInfoBeforeDetection, Renderer::Backend
Script::SetProperty(rq, settings, "build_version", std::wstring(build_version));
Script::SetProperty(rq, settings, "build_msc", (int)MSC_VERSION);
Script::SetProperty(rq, settings, "build_icc", (int)ICC_VERSION);
Script::SetProperty(rq, settings, "build_gcc", (int)GCC_VERSION);
Script::SetProperty(rq, settings, "build_clang", (int)CLANG_VERSION);