diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp index d34c84974a0bb7..9a2de7bf42009f 100644 --- a/src/coreclr/debug/di/rsmain.cpp +++ b/src/coreclr/debug/di/rsmain.cpp @@ -1646,7 +1646,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget, break; default: - __assume(0); + UNREACHABLE(); } #endif // FEATURE_INTEROP_DEBUGGING diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp index 8c3290211c2066..65e94cc28390df 100644 --- a/src/coreclr/debug/ee/debugger.cpp +++ b/src/coreclr/debug/ee/debugger.cpp @@ -8643,12 +8643,16 @@ int Debugger::NotifyUserOfFault(bool userBreakpoint, DebuggerLaunchSetting dls) if (userBreakpoint) { msg = "Application has encountered a user-defined breakpoint.\n\nProcess ID=0x%x (%d), Thread ID=0x%x (%d).\n\nClick ABORT to terminate the application.\nClick RETRY to debug the application.\nClick IGNORE to ignore the breakpoint."; +#ifdef HOST_WINDOWS flags |= MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION; +#endif } else { msg = "Application has generated an exception that could not be handled.\n\nProcess ID=0x%x (%d), Thread ID=0x%x (%d).\n\nClick OK to terminate the application.\nClick CANCEL to debug the application."; +#ifdef HOST_WINDOWS flags |= MB_OKCANCEL | MB_ICONEXCLAMATION; +#endif } // Format message string using optional parameters diff --git a/src/coreclr/debug/ee/debuggermessagebox.cpp b/src/coreclr/debug/ee/debuggermessagebox.cpp index 5814d17d11b295..af86529d3c5499 100644 --- a/src/coreclr/debug/ee/debuggermessagebox.cpp +++ b/src/coreclr/debug/ee/debuggermessagebox.cpp @@ -34,10 +34,12 @@ static void DbgPrintf(const LPCSTR szFormat, ...) } } +#ifndef HOST_UNIX typedef int (*MessageBoxWFnPtr)(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType); +#endif // !HOST_UNIX static int MessageBoxImpl( LPCWSTR title, // Dialog box title @@ -157,10 +159,12 @@ int NotifyUserOfFaultMessageBox( int result = IDCANCEL; +#ifdef HOST_WINDOWS // Add the MB_TASKMODAL style to indicate that the dialog should be displayed on top of the windows // owned by the current thread and should prevent interaction with them until dismissed. // Include in the MB_DEFAULT_DESKTOP_ONLY style. uType |= (MB_TASKMODAL | MB_DEFAULT_DESKTOP_ONLY); +#endif EX_TRY { diff --git a/src/coreclr/gc/env/gcenv.base.h b/src/coreclr/gc/env/gcenv.base.h index 2bcf98bd4e3a77..de2436b44f4bc7 100644 --- a/src/coreclr/gc/env/gcenv.base.h +++ b/src/coreclr/gc/env/gcenv.base.h @@ -21,23 +21,8 @@ #ifndef _MSC_VER #define __stdcall -#ifdef __GNUC__ -#define __forceinline __attribute__((always_inline)) inline -#else // __GNUC__ -#define __forceinline inline -#endif // __GNUC__ -// [LOCALGC TODO] is there a better place for this? -#define NOINLINE __attribute__((noinline)) -#else // !_MSC_VER -#define NOINLINE __declspec(noinline) #endif // _MSC_VER -#ifdef _MSC_VER -#define __UNREACHABLE() __assume(0) -#else -#define __UNREACHABLE() __builtin_unreachable() -#endif - #ifndef SIZE_T_MAX #define SIZE_T_MAX ((size_t)-1) #endif @@ -88,7 +73,6 @@ inline HRESULT HRESULT_FROM_WIN32(unsigned long x) #define FALSE false #define CALLBACK __stdcall -#define FORCEINLINE __forceinline #define INFINITE 0xFFFFFFFF @@ -103,12 +87,6 @@ inline HRESULT HRESULT_FROM_WIN32(unsigned long x) snprintf(string, sizeInBytes, format, ## __VA_ARGS__) #endif -#ifdef UNICODE -#define _tfopen _wfopen -#else -#define _tfopen fopen -#endif - #define WINAPI __stdcall typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)(void* lpThreadParameter); @@ -448,19 +426,12 @@ typedef DPTR(uint8_t) PTR_uint8_t; #define DATA_ALIGNMENT sizeof(uintptr_t) #define RAW_KEYWORD(x) x -#ifdef _MSC_VER -#define DECLSPEC_ALIGN(x) __declspec(align(x)) -#else -#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) -#endif - #ifndef _ASSERTE #define _ASSERTE(_expr) ASSERT(_expr) #endif #define CONSISTENCY_CHECK(_expr) ASSERT(_expr) #define COMPILER_ASSUME(cond) ASSERT(cond) #define EEPOLICY_HANDLE_FATAL_ERROR(error) ASSERT(!"EEPOLICY_HANDLE_FATAL_ERROR") -#define UI64(_literal) _literal##ULL class ObjHeader; class MethodTable; diff --git a/src/coreclr/gc/env/gcenv.interlocked.inl b/src/coreclr/gc/env/gcenv.interlocked.inl index 3e4d761bca0d02..89222c90a664f9 100644 --- a/src/coreclr/gc/env/gcenv.interlocked.inl +++ b/src/coreclr/gc/env/gcenv.interlocked.inl @@ -1,6 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// __forceinline implementation of the Interlocked class methods +// FORCEINLINE implementation of the Interlocked class methods // #ifndef __GCENV_INTERLOCKED_INL__ @@ -11,7 +11,7 @@ #endif // _MSC_VER #ifndef _MSC_VER -__forceinline void Interlocked::InterlockedOperationBarrier() +FORCEINLINE void Interlocked::InterlockedOperationBarrier() { #if defined(HOST_ARM64) || defined(HOST_LOONGARCH64) || defined(HOST_RISCV64) // See PAL_InterlockedOperationBarrier() in the PAL @@ -26,7 +26,7 @@ __forceinline void Interlocked::InterlockedOperationBarrier() // Return: // The resulting incremented value template -__forceinline T Interlocked::Increment(T volatile *addend) +FORCEINLINE T Interlocked::Increment(T volatile *addend) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -44,7 +44,7 @@ __forceinline T Interlocked::Increment(T volatile *addend) // Return: // The resulting decremented value template -__forceinline T Interlocked::Decrement(T volatile *addend) +FORCEINLINE T Interlocked::Decrement(T volatile *addend) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -63,7 +63,7 @@ __forceinline T Interlocked::Decrement(T volatile *addend) // Return: // The previous value of the destination template -__forceinline T Interlocked::Exchange(T volatile *destination, T value) +FORCEINLINE T Interlocked::Exchange(T volatile *destination, T value) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -84,7 +84,7 @@ __forceinline T Interlocked::Exchange(T volatile *destination, T value) // Return: // The original value of the destination template -__forceinline T Interlocked::CompareExchange(T volatile *destination, T exchange, T comparand) +FORCEINLINE T Interlocked::CompareExchange(T volatile *destination, T exchange, T comparand) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -103,7 +103,7 @@ __forceinline T Interlocked::CompareExchange(T volatile *destination, T exchange // Return: // The previous value of the addend template -__forceinline T Interlocked::ExchangeAdd(T volatile *addend, T value) +FORCEINLINE T Interlocked::ExchangeAdd(T volatile *addend, T value) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -116,7 +116,7 @@ __forceinline T Interlocked::ExchangeAdd(T volatile *addend, T value) } template -__forceinline T Interlocked::ExchangeAdd64(T volatile* addend, T value) +FORCEINLINE T Interlocked::ExchangeAdd64(T volatile* addend, T value) { #ifdef _MSC_VER static_assert(sizeof(int64_t) == sizeof(T), "Size of LONGLONG must be the same as size of T"); @@ -129,7 +129,7 @@ __forceinline T Interlocked::ExchangeAdd64(T volatile* addend, T value) } template -__forceinline T Interlocked::ExchangeAddPtr(T volatile* addend, T value) +FORCEINLINE T Interlocked::ExchangeAddPtr(T volatile* addend, T value) { #ifdef _MSC_VER #ifdef HOST_64BIT @@ -151,7 +151,7 @@ __forceinline T Interlocked::ExchangeAddPtr(T volatile* addend, T value) // destination - the first operand and the destination // value - second operand template -__forceinline void Interlocked::And(T volatile *destination, T value) +FORCEINLINE void Interlocked::And(T volatile *destination, T value) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -167,7 +167,7 @@ __forceinline void Interlocked::And(T volatile *destination, T value) // destination - the first operand and the destination // value - second operand template -__forceinline void Interlocked::Or(T volatile *destination, T value) +FORCEINLINE void Interlocked::Or(T volatile *destination, T value) { #ifdef _MSC_VER static_assert(sizeof(long) == sizeof(T), "Size of long must be the same as size of T"); @@ -185,7 +185,7 @@ __forceinline void Interlocked::Or(T volatile *destination, T value) // Return: // The previous value of the destination template -__forceinline T Interlocked::ExchangePointer(T volatile * destination, T value) +FORCEINLINE T Interlocked::ExchangePointer(T volatile * destination, T value) { #ifdef _MSC_VER #ifdef HOST_64BIT @@ -201,7 +201,7 @@ __forceinline T Interlocked::ExchangePointer(T volatile * destination, T value) } template -__forceinline T Interlocked::ExchangePointer(T volatile * destination, std::nullptr_t value) +FORCEINLINE T Interlocked::ExchangePointer(T volatile * destination, std::nullptr_t value) { #ifdef _MSC_VER #ifdef HOST_64BIT @@ -225,7 +225,7 @@ __forceinline T Interlocked::ExchangePointer(T volatile * destination, std::null // Return: // The original value of the destination template -__forceinline T Interlocked::CompareExchangePointer(T volatile *destination, T exchange, T comparand) +FORCEINLINE T Interlocked::CompareExchangePointer(T volatile *destination, T exchange, T comparand) { #ifdef _MSC_VER #ifdef HOST_64BIT @@ -241,7 +241,7 @@ __forceinline T Interlocked::CompareExchangePointer(T volatile *destination, T e } template -__forceinline T Interlocked::CompareExchangePointer(T volatile *destination, T exchange, std::nullptr_t comparand) +FORCEINLINE T Interlocked::CompareExchangePointer(T volatile *destination, T exchange, std::nullptr_t comparand) { #ifdef _MSC_VER #ifdef HOST_64BIT diff --git a/src/coreclr/gc/env/gcenv.unix.inl b/src/coreclr/gc/env/gcenv.unix.inl index d6e5ca796a1499..0e221e8a0a9596 100644 --- a/src/coreclr/gc/env/gcenv.unix.inl +++ b/src/coreclr/gc/env/gcenv.unix.inl @@ -11,7 +11,7 @@ extern uint32_t g_pageSizeUnixInl; #define OS_PAGE_SIZE GCToOSInterface::GetPageSize() #ifndef DACCESS_COMPILE -__forceinline size_t GCToOSInterface::GetPageSize() +FORCEINLINE size_t GCToOSInterface::GetPageSize() { return g_pageSizeUnixInl; } diff --git a/src/coreclr/gc/env/gcenv.windows.inl b/src/coreclr/gc/env/gcenv.windows.inl index df34e1aaa7c7ae..8ac51a19775076 100644 --- a/src/coreclr/gc/env/gcenv.windows.inl +++ b/src/coreclr/gc/env/gcenv.windows.inl @@ -9,7 +9,7 @@ #define OS_PAGE_SIZE GCToOSInterface::GetPageSize() -__forceinline size_t GCToOSInterface::GetPageSize() +FORCEINLINE size_t GCToOSInterface::GetPageSize() { return 0x1000; } diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 015e54a3d9f955..9da125a1cde4e2 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -5304,7 +5304,7 @@ struct initial_memory_details case 0: return block_size_normal; case 1: return block_size_large; case 2: return block_size_pinned; - default: __UNREACHABLE(); + default: UNREACHABLE(); } }; @@ -5317,7 +5317,7 @@ struct initial_memory_details case soh_gen2: return initial_normal_heap[h_number].memory_base; case loh_generation: return initial_large_heap[h_number].memory_base; case poh_generation: return initial_pinned_heap[h_number].memory_base; - default: __UNREACHABLE(); + default: UNREACHABLE(); } }; @@ -5330,7 +5330,7 @@ struct initial_memory_details case soh_gen2: return block_size_normal; case loh_generation: return block_size_large; case poh_generation: return block_size_pinned; - default: __UNREACHABLE(); + default: UNREACHABLE(); } }; diff --git a/src/coreclr/gc/gceventstatus.h b/src/coreclr/gc/gceventstatus.h index 9e689b008f8807..3c41d019e11725 100644 --- a/src/coreclr/gc/gceventstatus.h +++ b/src/coreclr/gc/gceventstatus.h @@ -60,7 +60,7 @@ class GCEventStatus * IsEnabled queries whether or not the given level and keyword are * enabled on the given provider, returning true if they are. */ - __forceinline static bool IsEnabled(GCEventProvider provider, GCEventKeyword keyword, GCEventLevel level) + FORCEINLINE static bool IsEnabled(GCEventProvider provider, GCEventKeyword keyword, GCEventLevel level) { assert(level >= GCEventLevel_None && level < GCEventLevel_Max); diff --git a/src/coreclr/gc/handletablecore.cpp b/src/coreclr/gc/handletablecore.cpp index 76046964b4ef3d..2a5b36200b312e 100644 --- a/src/coreclr/gc/handletablecore.cpp +++ b/src/coreclr/gc/handletablecore.cpp @@ -685,7 +685,7 @@ void SegmentRemoveFreeBlocks(TableSegment *pSegment, uint32_t uType, BOOL *pfSca #ifdef HANDLE_OPTIMIZE_FOR_64_HANDLE_BLOCKS // determine whether this block is empty - if (((uint64_t*)pSegment->rgFreeMask)[uBlock] == UI64(0xFFFFFFFFFFFFFFFF)) + if (((uint64_t*)pSegment->rgFreeMask)[uBlock] == 0xFFFFFFFFFFFFFFFFULL) #else // assume this block is empty until we know otherwise BOOL fEmpty = TRUE; @@ -1039,7 +1039,7 @@ void SegmentResortChains(TableSegment *pSegment) { #ifdef HANDLE_OPTIMIZE_FOR_64_HANDLE_BLOCKS // determine whether this block is empty - if (((uint64_t*)pSegment->rgFreeMask)[uBlock] == UI64(0xFFFFFFFFFFFFFFFF)) + if (((uint64_t*)pSegment->rgFreeMask)[uBlock] == 0xFFFFFFFFFFFFFFFFULL) #else // assume this block is empty until we know otherwise BOOL fEmpty = TRUE; diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp index 682c6adac7807c..e67e8a8d818d4c 100644 --- a/src/coreclr/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/gc/unix/gcenv.unix.cpp @@ -36,10 +36,6 @@ #undef min #undef max -#ifndef __has_cpp_attribute -#define __has_cpp_attribute(x) (0) -#endif - #include #if HAVE_SYS_TIME_H diff --git a/src/coreclr/gc/vxsort/defs.h b/src/coreclr/gc/vxsort/defs.h index d6373a21ad2699..a2e0a7af152ae9 100644 --- a/src/coreclr/gc/vxsort/defs.h +++ b/src/coreclr/gc/vxsort/defs.h @@ -4,6 +4,8 @@ #ifndef VXSORT_DEFS_H #define VXSORT_DEFS_H +#include + #if _MSC_VER #ifdef _M_X86 #define ARCH_X86 @@ -29,22 +31,18 @@ #ifdef _MSC_VER #ifdef __clang__ #define mess_up_cmov() -#define INLINE __attribute__((always_inline)) -#define NOINLINE __attribute__((noinline)) #else // MSVC #include #define mess_up_cmov() _ReadBarrier(); -#define INLINE __forceinline -#define NOINLINE __declspec(noinline) #endif #else // GCC + Clang #define mess_up_cmov() -#define INLINE __attribute__((always_inline)) -#define NOINLINE __attribute__((noinline)) #endif +#define INLINE FORCEINLINE + using std::max; using std::min; #endif // VXSORT_DEFS_H diff --git a/src/coreclr/gcinfo/gcinfodumper.cpp b/src/coreclr/gcinfo/gcinfodumper.cpp index c22850c2b0f10c..4f0591528dc820 100644 --- a/src/coreclr/gcinfo/gcinfodumper.cpp +++ b/src/coreclr/gcinfo/gcinfodumper.cpp @@ -17,7 +17,7 @@ #ifdef HOST_64BIT // All stack offsets are INT32's, so this guarantees a disjoint range of // addresses for each register. -#define ADDRESS_SPACING UI64(0x100000000) +#define ADDRESS_SPACING 0x100000000ULL #elif defined(TARGET_ARM) #define ADDRESS_SPACING 0x100000 #else diff --git a/src/coreclr/ilasm/grammar_after.cpp b/src/coreclr/ilasm/grammar_after.cpp index ac43bd8faace16..79637ea1332db5 100644 --- a/src/coreclr/ilasm/grammar_after.cpp +++ b/src/coreclr/ilasm/grammar_after.cpp @@ -1200,8 +1200,8 @@ int yylex() begNum = curPos; { uint64_t i64 = str2uint64(begNum, const_cast(&curPos), radix); - uint64_t mask64 = neg ? UI64(0xFFFFFFFF80000000) : UI64(0xFFFFFFFF00000000); - uint64_t largestNegVal32 = UI64(0x0000000080000000); + uint64_t mask64 = neg ? 0xFFFFFFFF80000000ULL : 0xFFFFFFFF00000000ULL; + uint64_t largestNegVal32 = 0x0000000080000000ULL; if ((i64 & mask64) && (i64 != largestNegVal32)) { yylval.int64 = new int64_t(i64); diff --git a/src/coreclr/ilasm/method.hpp b/src/coreclr/ilasm/method.hpp index 0f6fc2ccadc9a3..dfd22c1f79691f 100644 --- a/src/coreclr/ilasm/method.hpp +++ b/src/coreclr/ilasm/method.hpp @@ -56,7 +56,7 @@ struct ARG_NAME_LIST DWORD dwAttr; CustomDescrList CustDList; ARG_NAME_LIST *pNext; - __forceinline ARG_NAME_LIST(int i, LPCUTF8 sz, BinStr *pbSig, BinStr *pbMarsh, DWORD attr) + FORCEINLINE ARG_NAME_LIST(int i, LPCUTF8 sz, BinStr *pbSig, BinStr *pbMarsh, DWORD attr) { nNum = i; //dwName = (DWORD)strlen(sz); diff --git a/src/coreclr/ilasm/writer.cpp b/src/coreclr/ilasm/writer.cpp index e718839a8664e9..cab91df8cb4c32 100644 --- a/src/coreclr/ilasm/writer.cpp +++ b/src/coreclr/ilasm/writer.cpp @@ -1238,7 +1238,7 @@ HRESULT Assembler::CreatePEFile(_In_ __nullterminated WCHAR *pwzOutputFilename) if(m_dwCeeFileFlags & ICEE_CREATE_FILE_PE64) { ULONGLONG *pdw = new ULONGLONG[N]; - for(i=0; i struct make_void { using type = void; }; @@ -543,9 +542,6 @@ CHECK CheckValue(TYPENAME &val) // to make sure it is always true. //-------------------------------------------------------------------------------- -#define UNREACHABLE() \ - UNREACHABLE_MSG("") - #define UNREACHABLE_RET() \ do { \ UNREACHABLE(); \ @@ -558,23 +554,6 @@ CHECK CheckValue(TYPENAME &val) return 0; \ } while (0) -#ifdef _DEBUG_IMPL - -// Note that the "do { } while (0)" syntax trick here doesn't work, as the compiler -// gives an error that the while(0) is unreachable code -#define UNREACHABLE_MSG(_message) \ -{ \ - CHECK _check; \ - _check.Setup(_message, "", __FILE__, __LINE__); \ - _check.Trigger("Reached the \"unreachable\""); \ -} __UNREACHABLE() - -#else - -#define UNREACHABLE_MSG(_message) __UNREACHABLE() - -#endif - //-------------------------------------------------------------------------------- // STRESS_CHECK represents a check which is included in a free build // @todo: behavior on trigger diff --git a/src/coreclr/inc/clrtypes.h b/src/coreclr/inc/clrtypes.h index 6238201535dcd6..ecbbb70982cca4 100644 --- a/src/coreclr/inc/clrtypes.h +++ b/src/coreclr/inc/clrtypes.h @@ -11,12 +11,7 @@ #ifndef CLRTYPES_H_ #define CLRTYPES_H_ -#if defined(_MSC_VER) && !defined(SOURCE_FORMATTING) - // Prefer intsafe.h when available, which defines many of the MAX/MIN - // values below (which is why they are in #ifndef blocks). - #include -#endif - +#include #include "crtwrap.h" #include "winwrap.h" #include "staticcontract.h" @@ -27,60 +22,6 @@ #define POINTER_BITS (32) #endif -// ================================================================================ -// Integral types - use these for all integral types -// These types are in ALL_CAPS. Each type has a _MIN and _MAX defined for it. -// ================================================================================ - -// -------------------------------------------------------------------------------- -// Use these types for fixed size integers: -// INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 -// -------------------------------------------------------------------------------- - -#ifndef INT8_MAX - typedef signed char INT8; - typedef unsigned char UINT8; - typedef short INT16; - typedef unsigned short UINT16; - typedef int INT32; - typedef unsigned int UINT32; - typedef __int64 INT64; - typedef unsigned __int64 UINT64; - - #ifdef _MSC_VER - /* These macros must exactly match those in the Windows SDK's intsafe.h */ - #define INT8_MIN (-127i8 - 1) - #define INT16_MIN (-32767i16 - 1) - #define INT32_MIN (-2147483647i32 - 1) - #define INT64_MIN (-9223372036854775807i64 - 1) - - #define INT8_MAX 127i8 - #define INT16_MAX 32767i16 - #define INT32_MAX 2147483647i32 - #define INT64_MAX 9223372036854775807i64 - - #define UINT8_MAX 0xffui8 - #define UINT16_MAX 0xffffui16 - #define UINT32_MAX 0xffffffffui32 - #define UINT64_MAX 0xffffffffffffffffui64 - #else - #define INT8_MIN ((INT8)0x80) - #define INT16_MIN ((INT16)0x8000) - #define INT32_MIN ((INT32)0x80000000) - #define INT64_MIN ((INT64) I64(0x8000000000000000)) - - #define INT8_MAX ((INT8)0x7f) - #define INT16_MAX ((INT16)0x7fff) - #define INT32_MAX ((INT32)0x7fffffff) - #define INT64_MAX ((INT64) I64(0x7fffffffffffffff)) - - #define UINT8_MAX ((UINT8)0xffU) - #define UINT16_MAX ((UINT16)0xffffU) - #define UINT32_MAX ((UINT32)0xffffffffU) - #define UINT64_MAX ((UINT64) UI64(0xffffffffffffffff)) - #endif -#endif // !INT8_MAX - // UINTX_MINs aren't defined in standard header files, // so definition must be separately predicated. #ifndef UINT8_MIN @@ -93,7 +34,7 @@ #define UINT8_MIN ((UINT8)0U) #define UINT16_MIN ((UINT16)0U) #define UINT32_MIN ((UINT32)0U) - #define UINT64_MIN ((UINT64) UI64(0)) + #define UINT64_MIN ((UINT64)0ULL) #endif #endif @@ -275,7 +216,7 @@ static_assert(sizeof(CLR_BOOL) == 1); #define CLR_BOOL_MIN BOOL_MIN #define CLR_NAN_32 0xFFC00000 -#define CLR_NAN_64 I64(0xFFF8000000000000) +#define CLR_NAN_64 0xFFF8000000000000LL // ================================================================================ // Simple utility functions diff --git a/src/coreclr/inc/cor.h b/src/coreclr/inc/cor.h index d4fe6b0275a0d2..74dceb2a4107e5 100644 --- a/src/coreclr/inc/cor.h +++ b/src/coreclr/inc/cor.h @@ -1657,14 +1657,6 @@ typedef enum //***************************************************************************** //***************************************************************************** -#ifndef FORCEINLINE - #if _MSC_VER < 1200 - #define FORCEINLINE inline - #else - #define FORCEINLINE __forceinline - #endif -#endif - // We need a version that is FORCEINLINE on retail and NOINLINE on debug @@ -1676,16 +1668,6 @@ typedef enum #endif #endif -#ifndef NOINLINE -#ifdef _MSC_VER -#define NOINLINE __declspec(noinline) -#elif defined __GNUC__ -#define NOINLINE __attribute__ ((noinline)) -#else -#define NOINLINE -#endif -#endif // !NOINLINE - // return true if it is a primitive type, i.e. only need to store CorElementType FORCEINLINE int CorIsPrimitiveType(CorElementType elementtype) { diff --git a/src/coreclr/inc/corhlpr.h b/src/coreclr/inc/corhlpr.h index 0bd3b1e1dfe854..9f5189858b695d 100644 --- a/src/coreclr/inc/corhlpr.h +++ b/src/coreclr/inc/corhlpr.h @@ -21,7 +21,6 @@ #include "cor.h" #include "corhdr.h" #include "corerror.h" -#include "unreachable.h" #include using std::nothrow; diff --git a/src/coreclr/inc/gcinfodecoder.h b/src/coreclr/inc/gcinfodecoder.h index 1a4e4c2ccbea0f..d39ea72c7f4ec3 100644 --- a/src/coreclr/inc/gcinfodecoder.h +++ b/src/coreclr/inc/gcinfodecoder.h @@ -300,7 +300,7 @@ class BitStreamReader } // NOTE: This routine is perf-critical - __forceinline size_t Read( int numBits ) + FORCEINLINE size_t Read( int numBits ) { SUPPORTS_DAC; @@ -325,7 +325,7 @@ class BitStreamReader // This version reads one bit // NOTE: This routine is perf-critical - __forceinline size_t ReadOneFast() + FORCEINLINE size_t ReadOneFast() { SUPPORTS_DAC; @@ -346,13 +346,13 @@ class BitStreamReader } - __forceinline size_t GetCurrentPos() + FORCEINLINE size_t GetCurrentPos() { SUPPORTS_DAC; return (size_t) ((m_pCurrent - m_pBuffer) * BITS_PER_SIZE_T + m_RelPos - m_InitialRelPos); } - __forceinline void SetCurrentPos( size_t pos ) + FORCEINLINE void SetCurrentPos( size_t pos ) { size_t adjPos = pos + m_InitialRelPos; m_pCurrent = m_pBuffer + adjPos / BITS_PER_SIZE_T; @@ -364,7 +364,7 @@ class BitStreamReader _ASSERTE(GetCurrentPos() == pos); } - __forceinline void Skip( SSIZE_T numBitsToSkip ) + FORCEINLINE void Skip( SSIZE_T numBitsToSkip ) { SUPPORTS_DAC; @@ -416,7 +416,7 @@ class BitStreamReader } } - __forceinline size_t DecodeVarLengthUnsigned(int base) + FORCEINLINE size_t DecodeVarLengthUnsigned(int base) { _ASSERTE((base > 0) && (base < (int)BITS_PER_SIZE_T)); diff --git a/src/coreclr/inc/palclr.h b/src/coreclr/inc/palclr.h index 6985ced7f39dd5..14a83103d1798f 100644 --- a/src/coreclr/inc/palclr.h +++ b/src/coreclr/inc/palclr.h @@ -11,6 +11,8 @@ #ifndef __PALCLR_H__ #define __PALCLR_H__ +#include + #if defined(HOST_WINDOWS) // This macro is used to standardize the wide character string literals between UNIX and Windows. @@ -39,14 +41,6 @@ #endif // !_MSC_VER #endif // !NOTHROW_DECL -#ifndef NOINLINE -#ifdef _MSC_VER -#define NOINLINE __declspec(noinline) -#else -#define NOINLINE __attribute__((noinline)) -#endif // !_MSC_VER -#endif // !NOINLINE - #ifdef _MSC_VER #define EMPTY_BASES_DECL __declspec(empty_bases) #else @@ -179,46 +173,6 @@ #endif -// PAL Numbers -// Used to ensure cross-compiler compatibility when declaring large -// integer constants. 64-bit integer constants should be wrapped in the -// declarations listed here. -// -// Each of the #defines here is wrapped to avoid conflicts with pal.h. - -#if defined(_MSC_VER) - -// MSVC's way of declaring large integer constants -// If you define these in one step, without the _HELPER macros, you -// get extra whitespace when composing these with other concatenating macros. -#ifndef I64 -#define I64_HELPER(x) x ## i64 -#define I64(x) I64_HELPER(x) -#endif - -#ifndef UI64 -#define UI64_HELPER(x) x ## ui64 -#define UI64(x) UI64_HELPER(x) -#endif - -#else - -// GCC's way of declaring large integer constants -// If you define these in one step, without the _HELPER macros, you -// get extra whitespace when composing these with other concatenating macros. -#ifndef I64 -#define I64_HELPER(x) x ## LL -#define I64(x) I64_HELPER(x) -#endif - -#ifndef UI64 -#define UI64_HELPER(x) x ## ULL -#define UI64(x) UI64_HELPER(x) -#endif - -#endif - - // PAL SEH // Macros for portable exception handling. The Win32 SEH is emulated using // these macros and setjmp/longjmp on Unix diff --git a/src/coreclr/inc/sbuffer.inl b/src/coreclr/inc/sbuffer.inl index af4890cd8199d0..82300b7698fff0 100644 --- a/src/coreclr/inc/sbuffer.inl +++ b/src/coreclr/inc/sbuffer.inl @@ -925,7 +925,7 @@ inline void SBuffer::TweakSize(COUNT_T size) #ifdef SBUFFER_CANARY_CHECKS // The value we place at the start/end of the buffer, -static const UINT64 SBUFFER_CANARY_VALUE = UI64(0xD00BED00BED00BAA); +static const UINT64 SBUFFER_CANARY_VALUE = 0xD00BED00BED00BAAULL; // Expose the quantity of padding needed when providing a prealloced // buffer. This is an unrolled version of the actualAllocation calculated diff --git a/src/coreclr/inc/unreachable.h b/src/coreclr/inc/unreachable.h deleted file mode 100644 index 7cb857a176efa6..00000000000000 --- a/src/coreclr/inc/unreachable.h +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// --------------------------------------------------------------------------- -// unreachable.h -// --------------------------------------------------------------------------- - - -#ifndef __UNREACHABLE_H__ -#define __UNREACHABLE_H__ - -#if defined(_MSC_VER) -#define __UNREACHABLE() __assume(0) -#else -#define __UNREACHABLE() __builtin_unreachable() -#endif - -#endif // __UNREACHABLE_H__ - diff --git a/src/coreclr/inc/utilcode.h b/src/coreclr/inc/utilcode.h index 0ed568eedbb527..8ec93ff9bba782 100644 --- a/src/coreclr/inc/utilcode.h +++ b/src/coreclr/inc/utilcode.h @@ -142,13 +142,6 @@ typedef LPSTR LPUTF8; #include "stdmacros.h" //********** Macros. ********************************************************** -#ifndef FORCEINLINE - #if _MSC_VER < 1200 - #define FORCEINLINE inline - #else - #define FORCEINLINE __forceinline - #endif -#endif #ifndef DEBUG_NOINLINE #if defined(_DEBUG) diff --git a/src/coreclr/jit/codegen.h b/src/coreclr/jit/codegen.h index 6fadbfa9aede89..e47fe8ab57bbe6 100644 --- a/src/coreclr/jit/codegen.h +++ b/src/coreclr/jit/codegen.h @@ -1044,7 +1044,7 @@ class CodeGen final : public CodeGenInterface // // Return Value: // None. - __forceinline void genUpdateLifeStore(GenTree* tree, regNumber targetReg, LclVarDsc* varDsc) + FORCEINLINE void genUpdateLifeStore(GenTree* tree, regNumber targetReg, LclVarDsc* varDsc) { if (targetReg != REG_NA) { diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index 1c1c9e0225033f..12280cde617228 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -3605,7 +3605,7 @@ inline regNumber genMapFloatRegArgNumToRegNum(unsigned argNum) #endif } -__forceinline regNumber genMapRegArgNumToRegNum(unsigned argNum, var_types type, CorInfoCallConvExtension callConv) +FORCEINLINE regNumber genMapRegArgNumToRegNum(unsigned argNum, var_types type, CorInfoCallConvExtension callConv) { if (varTypeUsesFloatArgReg(type)) { @@ -3642,7 +3642,7 @@ inline regMaskTP genMapFloatRegArgNumToRegMask(unsigned argNum) #endif } -__forceinline regMaskTP genMapArgNumToRegMask(unsigned argNum, var_types type) +FORCEINLINE regMaskTP genMapArgNumToRegMask(unsigned argNum, var_types type) { regMaskTP result; if (varTypeUsesFloatArgReg(type)) diff --git a/src/coreclr/jit/hashbv.h b/src/coreclr/jit/hashbv.h index 232c35d6394597..688718244659d5 100644 --- a/src/coreclr/jit/hashbv.h +++ b/src/coreclr/jit/hashbv.h @@ -194,7 +194,7 @@ class hashBv void dump(); void dumpFancy(); #endif // DEBUG - __forceinline int hashtable_size() const + FORCEINLINE int hashtable_size() const { return 1 << this->log2_hashSize; } diff --git a/src/coreclr/md/inc/metamodel.h b/src/coreclr/md/inc/metamodel.h index 942a4841279143..22ace7113f2aea 100644 --- a/src/coreclr/md/inc/metamodel.h +++ b/src/coreclr/md/inc/metamodel.h @@ -280,7 +280,7 @@ class CMiniMdSchemaBase private: FORCEINLINE uint64_t BIT(ULONG ixBit) { _ASSERTE(ixBit < (sizeof(int64_t)*CHAR_BIT)); - return UI64(1) << ixBit; } + return 1ULL << ixBit; } }; diff --git a/src/coreclr/nativeaot/Runtime/CommonMacros.h b/src/coreclr/nativeaot/Runtime/CommonMacros.h index 13d065c303eb25..e2bea3c2af5fcf 100644 --- a/src/coreclr/nativeaot/Runtime/CommonMacros.h +++ b/src/coreclr/nativeaot/Runtime/CommonMacros.h @@ -37,33 +37,7 @@ #endif // _MSC_VER -#ifndef offsetof -#define offsetof(s,m) (uintptr_t)( (intptr_t)&reinterpret_cast((((s *)0)->m)) ) -#endif // offsetof - -#ifdef __GNUC__ -#ifdef HOST_64BIT -#define __int64 long -#else // HOST_64BIT -#define __int64 long long -#endif // HOST_64BIT -#endif // __GNUC__ - -#ifndef FORCEINLINE -#define FORCEINLINE __forceinline -#endif - -#ifdef __GNUC__ -#define __forceinline __attribute__((always_inline)) inline -#endif // __GNUC__ - -#ifndef NOINLINE -#ifdef _MSC_VER -#define NOINLINE __declspec(noinline) -#else -#define NOINLINE __attribute__((noinline)) -#endif -#endif +#include #ifndef __GCENV_BASE_INCLUDED__ @@ -97,39 +71,17 @@ inline bool IS_ALIGNED(T* val, uintptr_t alignment); //------------------------------------------------------------------------------------------------- // Platform-specific defines -#if defined(HOST_AMD64) - -#define LOG2_PTRSIZE 3 -#define POINTER_SIZE 8 - -#elif defined(HOST_X86) - -#define LOG2_PTRSIZE 2 -#define POINTER_SIZE 4 - -#elif defined(HOST_ARM) - -#define LOG2_PTRSIZE 2 -#define POINTER_SIZE 4 - -#elif defined(HOST_ARM64) +#ifdef HOST_64BIT #define LOG2_PTRSIZE 3 #define POINTER_SIZE 8 -#elif defined (HOST_WASM) +#else // HOST_64BIT #define LOG2_PTRSIZE 2 #define POINTER_SIZE 4 -#elif defined(HOST_LOONGARCH64) || defined (HOST_RISCV64) - -#define LOG2_PTRSIZE 3 -#define POINTER_SIZE 8 - -#else -#error Unsupported target architecture -#endif +#endif // HOST_64BIT #ifndef __GCENV_BASE_INCLUDED__ @@ -331,33 +283,4 @@ extern uint64_t g_startupTimelineEvents[NUM_STARTUP_TIMELINE_EVENTS]; #define STARTUP_TIMELINE_EVENT(eventid) #endif // PROFILE_STARTUP -// PAL Numbers -// Used to ensure cross-compiler compatibility when declaring large -// integer constants. 64-bit integer constants should be wrapped in the -// declarations listed here. -// -// Each of the #defines here is wrapped to avoid conflicts with pal.h. - -#if defined(_MSC_VER) - -// MSVC's way of declaring large integer constants -// If you define these in one step, without the _HELPER macros, you -// get extra whitespace when composing these with other concatenating macros. -#ifndef I64 -#define I64_HELPER(x) x ## i64 -#define I64(x) I64_HELPER(x) -#endif - -#else - -// GCC's way of declaring large integer constants -// If you define these in one step, without the _HELPER macros, you -// get extra whitespace when composing these with other concatenating macros. -#ifndef I64 -#define I64_HELPER(x) x ## LL -#define I64(x) I64_HELPER(x) -#endif - -#endif - #endif // __COMMONMACROS_H__ diff --git a/src/coreclr/nativeaot/Runtime/PalLimitedContext.h b/src/coreclr/nativeaot/Runtime/PalLimitedContext.h index c5e36453687aef..cf8e442b126b9e 100644 --- a/src/coreclr/nativeaot/Runtime/PalLimitedContext.h +++ b/src/coreclr/nativeaot/Runtime/PalLimitedContext.h @@ -6,14 +6,7 @@ #define PAL_LIMITED_CONTEXT_INCLUDED #include "rhassert.h" - -#ifndef DECLSPEC_ALIGN -#ifdef _MSC_VER -#define DECLSPEC_ALIGN(x) __declspec(align(x)) -#else -#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) -#endif -#endif // DECLSPEC_ALIGN +#include #ifdef HOST_AMD64 #define AMD64_ALIGN_16 DECLSPEC_ALIGN(16) diff --git a/src/coreclr/nativeaot/Runtime/inc/MethodTable.inl b/src/coreclr/nativeaot/Runtime/inc/MethodTable.inl index 663cce4c6d72cb..2e0a29e7d08932 100644 --- a/src/coreclr/nativeaot/Runtime/inc/MethodTable.inl +++ b/src/coreclr/nativeaot/Runtime/inc/MethodTable.inl @@ -39,7 +39,7 @@ inline MethodTable* MethodTable::GetDynamicTemplateType() #endif // !defined(DACCESS_COMPILE) // Calculate the offset of a field of the MethodTable that has a variable offset. -__forceinline uint32_t MethodTable::GetFieldOffset(EETypeField eField) +FORCEINLINE uint32_t MethodTable::GetFieldOffset(EETypeField eField) { // First part of MethodTable consists of the fixed portion followed by the vtable. uint32_t cbOffset = offsetof(MethodTable, m_VTable) + (sizeof(UIntTarget) * m_usNumVtableSlots); diff --git a/src/coreclr/nativeaot/Runtime/rhassert.h b/src/coreclr/nativeaot/Runtime/rhassert.h index de725ae26bdafa..268f36551acde4 100644 --- a/src/coreclr/nativeaot/Runtime/rhassert.h +++ b/src/coreclr/nativeaot/Runtime/rhassert.h @@ -3,11 +3,7 @@ #ifndef __RHASSERT_H__ #define __RHASSERT_H__ -#ifdef _MSC_VER -#define ASSUME(expr) __assume(expr) -#else // _MSC_VER -#define ASSUME(expr) do { if (!(expr)) __builtin_unreachable(); } while (0) -#endif // _MSC_VER +#include #if defined(_DEBUG) && !defined(DACCESS_COMPILE) @@ -50,15 +46,12 @@ void Assert(const char * expr, const char * file, unsigned int line_num, const c #define PORTABILITY_ASSERT(message) \ ASSERT_UNCONDITIONALLY(message); \ - ASSUME(0); \ + UNREACHABLE(); \ -#define UNREACHABLE() \ - ASSERT_UNCONDITIONALLY("UNREACHABLE"); \ - ASSUME(0); \ - -#define UNREACHABLE_MSG(message) \ - ASSERT_UNCONDITIONALLY(message); \ - ASSUME(0); \ +#ifdef assert +#undef assert +#define assert(_expr) ASSERT(_expr) +#endif #ifdef HOST_WINDOWS #define RhFailFast() ::RaiseFailFastException(NULL, NULL, FAIL_FAST_GENERATE_EXCEPTION_ADDRESS) diff --git a/src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.cpp b/src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.cpp index 7f2d17b3f4376c..8ead6c24ba94df 100644 --- a/src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.cpp +++ b/src/coreclr/nativeaot/Runtime/unix/UnwindHelpers.cpp @@ -4,6 +4,7 @@ #include "common.h" #include "daccess.h" #include "rhassert.h" +#include #define UNW_STEP_SUCCESS 1 #define UNW_STEP_END 0 diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index f48f662fac9cf1..6276b907f2ddfc 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -121,12 +121,6 @@ extern bool g_arm64_atomics_present; #define LANG_ENGLISH 0x09 /******************* Compiler-specific glue *******************************/ -#if defined(_MSC_VER) -#define DECLSPEC_ALIGN(x) __declspec(align(x)) -#else -#define DECLSPEC_ALIGN(x) __attribute__ ((aligned(x))) -#endif - #define DECLSPEC_NORETURN PAL_NORETURN #define EMPTY_BASES_DECL @@ -143,14 +137,6 @@ extern bool g_arm64_atomics_present; #define UNALIGNED -#ifndef FORCEINLINE -#if _MSC_VER < 1200 -#define FORCEINLINE inline -#else -#define FORCEINLINE __forceinline -#endif -#endif - #ifndef NOOPT_ATTRIBUTE #if defined(__llvm__) #define NOOPT_ATTRIBUTE optnone @@ -159,10 +145,6 @@ extern bool g_arm64_atomics_present; #endif #endif -#ifndef __has_cpp_attribute -#define __has_cpp_attribute(x) (0) -#endif - /******************* PAL-Specific Entrypoints *****************************/ #define DLL_PROCESS_ATTACH 1 @@ -413,29 +395,11 @@ PAL_PerfJitDump_Finish(); /******************* winuser.h Entrypoints *******************************/ -#define MB_OKCANCEL 0x00000001L -#define MB_ABORTRETRYIGNORE 0x00000002L - -#define MB_ICONEXCLAMATION 0x00000030L - -#define MB_TASKMODAL 0x00002000L - -#define MB_DEFAULT_DESKTOP_ONLY 0x00020000L - #define IDOK 1 #define IDCANCEL 2 #define IDABORT 3 #define IDRETRY 4 -// From win32.h -#ifndef _CRTIMP -#ifdef __GNUC__ -#define _CRTIMP -#else // __GNUC__ -#define _CRTIMP __declspec(dllimport) -#endif // __GNUC__ -#endif // _CRTIMP - /******************* winbase.h Entrypoints and defines ************************/ typedef struct _SECURITY_ATTRIBUTES { DWORD nLength; @@ -443,8 +407,6 @@ typedef struct _SECURITY_ATTRIBUTES { BOOL bInheritHandle; } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; -#define _SH_DENYWR 0x20 /* deny write mode */ - #define FILE_READ_DATA ( 0x0001 ) // file & pipe #define FILE_APPEND_DATA ( 0x0004 ) // file @@ -1221,12 +1183,12 @@ typedef struct _KNONVOLATILE_CONTEXT_POINTERS { #define XSTATE_AVX512_ZMM (7) #define XSTATE_APX (19) -#define XSTATE_MASK_GSSE (UI64(1) << (XSTATE_GSSE)) +#define XSTATE_MASK_GSSE (1ULL << (XSTATE_GSSE)) #define XSTATE_MASK_AVX (XSTATE_MASK_GSSE) -#define XSTATE_MASK_AVX512 ((UI64(1) << (XSTATE_AVX512_KMASK)) | \ - (UI64(1) << (XSTATE_AVX512_ZMM_H)) | \ - (UI64(1) << (XSTATE_AVX512_ZMM))) -#define XSTATE_MASK_APX (UI64(1) << (XSTATE_APX)) +#define XSTATE_MASK_AVX512 ((1ULL << (XSTATE_AVX512_KMASK)) | \ + (1ULL << (XSTATE_AVX512_ZMM_H)) | \ + (1ULL << (XSTATE_AVX512_ZMM))) +#define XSTATE_MASK_APX (1ULL << (XSTATE_APX)) typedef struct DECLSPEC_ALIGN(16) _M128A { ULONGLONG Low; @@ -1708,7 +1670,7 @@ typedef struct _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY { #define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE #define XSTATE_ARM64_SVE (2) -#define XSTATE_MASK_ARM64_SVE (UI64(1) << (XSTATE_ARM64_SVE)) +#define XSTATE_MASK_ARM64_SVE (1ULL << (XSTATE_ARM64_SVE)) // // This flag is set by the unwinder if it has unwound to a call diff --git a/src/coreclr/pal/inc/pal_mstypes.h b/src/coreclr/pal/inc/pal_mstypes.h index a0762726ba18e9..631c416ce45924 100644 --- a/src/coreclr/pal/inc/pal_mstypes.h +++ b/src/coreclr/pal/inc/pal_mstypes.h @@ -71,16 +71,10 @@ extern "C" { #define CALLBACK __cdecl -#if !defined(_declspec) -#define _declspec(e) __declspec(e) -#endif - #if defined(_VAC_) && defined(__cplusplus) #define __inline inline #endif - -#define __forceinline inline - + #define PALIMPORT #ifndef DLLEXPORT @@ -103,13 +97,6 @@ extern "C" { #define OPTIONAL #define FAR -#ifdef UNICODE -#define __TEXT(x) L##x -#else -#define __TEXT(x) x -#endif -#define TEXT(x) __TEXT(x) - //////////////////////////////////////////////////////////////////////// // Some special values //////////////////////////////////////////////////////////////////////// @@ -122,27 +109,10 @@ extern "C" { #define FALSE 0 #endif -//////////////////////////////////////////////////////////////////////// -// Misc. type helpers -//////////////////////////////////////////////////////////////////////// - -// GCC's way of declaring large integer constants -// If you define these in one step, without the _HELPER macros, you -// get extra whitespace when composing these with other concatenating macros. -#define I64_HELPER(x) x ## LL -#define I64(x) I64_HELPER(x) - -#define UI64_HELPER(x) x ## ULL -#define UI64(x) UI64_HELPER(x) - //////////////////////////////////////////////////////////////////////// // Misc. types //////////////////////////////////////////////////////////////////////// -#if HOST_64BIT -typedef long double LONG_DOUBLE; -#endif - typedef void VOID; typedef int LONG; // NOTE: diff from windows.h, for LP64 compat @@ -162,11 +132,9 @@ typedef unsigned short USHORT; typedef USHORT *PUSHORT; typedef unsigned char UCHAR; typedef UCHAR *PUCHAR; -typedef char *PSZ; typedef ULONGLONG DWORDLONG; typedef unsigned int DWORD; // NOTE: diff from windows.h, for LP64 compat -typedef unsigned int DWORD32, *PDWORD32; typedef int BOOL; typedef unsigned char BYTE; @@ -248,10 +216,6 @@ typedef LONG_PTR LPARAM; typedef char16_t WCHAR; typedef DWORD LCID; -typedef PDWORD PLCID; -typedef WORD LANGID; - -typedef DWORD LCTYPE; typedef WCHAR *PWCHAR; typedef WCHAR *LPWCH, *PWCH; @@ -288,8 +252,6 @@ typedef CONST TCHAR *LPCTSTR; #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) typedef VOID *HANDLE; -typedef HANDLE HWND; -typedef struct __PAL_RemoteHandle__ { HANDLE h; } *RHANDLE; typedef HANDLE *PHANDLE; typedef HANDLE *LPHANDLE; #define INVALID_HANDLE_VALUE ((VOID *)(-1)) @@ -297,9 +259,6 @@ typedef HANDLE *LPHANDLE; #define INVALID_FILE_ATTRIBUTES ((DWORD) -1) typedef HANDLE HMODULE; typedef HANDLE HINSTANCE; -typedef HANDLE HGLOBAL; -typedef HANDLE HLOCAL; -typedef HANDLE HRSRC; typedef LONG HRESULT; typedef LONG NTSTATUS; diff --git a/src/coreclr/pal/inc/rt/palrt.h b/src/coreclr/pal/inc/rt/palrt.h index 45ed97d670f7ee..746f219a57c4b0 100644 --- a/src/coreclr/pal/inc/rt/palrt.h +++ b/src/coreclr/pal/inc/rt/palrt.h @@ -129,22 +129,12 @@ typedef enum tagEFaultRepRetVal #define _WINNT_ -#ifndef offsetof -#define offsetof(type, field) __builtin_offsetof(type, field) -#endif - #define CONTAINING_RECORD(address, type, field) \ ((type *)((LONG_PTR)(address) - offsetof(type, field))) #define ARGUMENT_PRESENT(ArgumentPointer) (\ (CHAR *)(ArgumentPointer) != (CHAR *)(NULL) ) -#if defined(HOST_64BIT) -#define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG) -#else -#define MAX_NATURAL_ALIGNMENT sizeof(ULONG) -#endif - #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name #ifndef COM_NO_WINDOWS_H @@ -320,11 +310,6 @@ typedef struct tagDEC { #define DECIMAL_SETZERO(dec) {DECIMAL_LO32(dec) = 0; DECIMAL_MID32(dec) = 0; DECIMAL_HI32(dec) = 0; DECIMAL_SIGNSCALE(dec) = 0;} -typedef struct tagBLOB { - ULONG cbSize; - BYTE *pBlobData; -} BLOB, *LPBLOB; - interface IStream; interface IRecordInfo; @@ -658,17 +643,6 @@ inline errno_t __cdecl _fopen_unsafe(FILE * *ff, const char *fileName, const cha /******************* misc ***************************************/ -#ifdef __cplusplus -namespace std -{ - typedef decltype(nullptr) nullptr_t; -} - -extern "C++" -template< class T > -typename std::remove_reference::type&& move( T&& t ); -#endif // __cplusplus - #define __RPC__out #define __RPC__in #define __RPC__deref_out_opt @@ -680,8 +654,6 @@ typename std::remove_reference::type&& move( T&& t ); #define __RPC__inout #define __RPC__deref_out_ecount_full_opt(x) -typedef HANDLE HWND; - typedef struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; struct _LIST_ENTRY *Blink; @@ -1025,8 +997,6 @@ typedef struct _EXCEPTION_REGISTRATION_RECORD EXCEPTION_REGISTRATION_RECORD; typedef EXCEPTION_REGISTRATION_RECORD *PEXCEPTION_REGISTRATION_RECORD; typedef LPVOID HKEY; -typedef LPVOID PACL; -typedef LPVOID LPBC; typedef LPVOID PSECURITY_DESCRIPTOR; typedef struct _EXCEPTION_RECORD64 { diff --git a/src/coreclr/pal/src/arch/arm64/asmconstants.h b/src/coreclr/pal/src/arch/arm64/asmconstants.h index c99cb4bed9cdc4..63b316f4558598 100644 --- a/src/coreclr/pal/src/arch/arm64/asmconstants.h +++ b/src/coreclr/pal/src/arch/arm64/asmconstants.h @@ -25,7 +25,7 @@ #define CONTEXT_XSTATE CONTEXT_ARM64_XSTATE #define XSTATE_ARM64_SVE_BIT (2) -#define XSTATE_MASK_ARM64_SVE (UI64(1) << (XSTATE_ARM64_SVE_BIT)) +#define XSTATE_MASK_ARM64_SVE (1ULL << (XSTATE_ARM64_SVE_BIT)) #define CONTEXT_ContextFlags 0 #define CONTEXT_Cpsr CONTEXT_ContextFlags+4 diff --git a/src/coreclr/pal/src/include/pal/palinternal.h b/src/coreclr/pal/src/include/pal/palinternal.h index 603ea73b008270..8c610758a998d5 100644 --- a/src/coreclr/pal/src/include/pal/palinternal.h +++ b/src/coreclr/pal/src/include/pal/palinternal.h @@ -219,8 +219,6 @@ function_name() to call the system's implementation #define INFTIM -1 #endif // !HAVE_INFTIM -#define OffsetOf(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER) - #undef assert #define assert (Use__ASSERTE_instead_of_assert) assert diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp index a6348c982bc245..4a18e57ac817f9 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp @@ -36,7 +36,7 @@ PALTEST(c_runtime_sscanf_s_test4_paltest_sscanf_test4, "c_runtime/sscanf_s/test4 DoNumTest("65536", "%ld", 65536); DoNumTest("-1", "%Ld", -1); DoNumTest("65536", "%Ld", 65536); - DoI64NumTest("4294967296", "%I64d", I64(4294967296)); + DoI64NumTest("4294967296", "%I64d", 4294967296LL); PAL_Terminate(); return PASS; diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp index 4679714df8a3b6..a61855591d2732 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp @@ -35,7 +35,7 @@ PALTEST(c_runtime_sscanf_s_test5_paltest_sscanf_test5, "c_runtime/sscanf_s/test5 DoNumTest("65536", "%li", 65536); DoNumTest("-1", "%Li", -1); DoNumTest("65536", "%Li", 65536); - DoI64NumTest("4294967296", "%I64i", I64(4294967296)); + DoI64NumTest("4294967296", "%I64i", 4294967296LL); PAL_Terminate(); return PASS; diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp index 56e0e778f0ecb9..330ebc52173bfb 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp @@ -35,7 +35,7 @@ PALTEST(c_runtime_sscanf_s_test6_paltest_sscanf_test6, "c_runtime/sscanf_s/test6 DoNumTest("200000", "%lo", 65536); DoNumTest("-1", "%Lo", -1); DoNumTest("200000", "%Lo", 65536); - DoI64NumTest("40000000000", "%I64o", I64(4294967296)); + DoI64NumTest("40000000000", "%I64o", 4294967296LL); PAL_Terminate(); return PASS; diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp index 5be10dcc50d4df..8df467fb81d8f4 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp @@ -35,7 +35,7 @@ PALTEST(c_runtime_sscanf_s_test7_paltest_sscanf_test7, "c_runtime/sscanf_s/test7 DoNumTest("10000", "%lx", 65536); DoNumTest("-1", "%Lx", -1); DoNumTest("10000", "%Lx", 65536); - DoI64NumTest("100000000", "%I64x", I64(4294967296)); + DoI64NumTest("100000000", "%I64x", 4294967296LL); PAL_Terminate(); return PASS; diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp index c5c0b9122d9114..d1ac33bb37cc32 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp @@ -35,7 +35,7 @@ PALTEST(c_runtime_sscanf_s_test8_paltest_sscanf_test8, "c_runtime/sscanf_s/test8 DoNumTest("65536", "%lu", 65536); DoNumTest("-1", "%Lu", -1); DoNumTest("65536", "%Lu", 65536); - DoI64NumTest("4294967296", "%I64u", I64(4294967296)); + DoI64NumTest("4294967296", "%I64u", 4294967296LL); PAL_Terminate(); return PASS; diff --git a/src/coreclr/utilcode/opinfo.cpp b/src/coreclr/utilcode/opinfo.cpp index 0dc1086b40908f..55d4aea1e80da6 100644 --- a/src/coreclr/utilcode/opinfo.cpp +++ b/src/coreclr/utilcode/opinfo.cpp @@ -9,6 +9,7 @@ #include // for debugMacros.h #include "debugmacros.h" // for ASSERTE #include "opinfo.h" +#include "check.h" OpInfo::OpInfoData OpInfo::table[] = { @@ -109,11 +110,7 @@ const BYTE* OpInfo::fetch(const BYTE* instrPtr, OpArgsVal* args) { args->phi.vars = (unsigned short*) instrPtr; instrPtr += (2 * args->phi.count); break; default: -#ifdef _DEBUG - _ASSERTE(!"BadType"); -#else - __assume(0); // we are really certain the default case does not happen -#endif + UNREACHABLE(); // we are really certain the default case does not happen break; } return(instrPtr); diff --git a/src/coreclr/utilcode/stresslog.cpp b/src/coreclr/utilcode/stresslog.cpp index 3fd772c41e92b5..c8d98427363a40 100644 --- a/src/coreclr/utilcode/stresslog.cpp +++ b/src/coreclr/utilcode/stresslog.cpp @@ -35,7 +35,7 @@ thread_local bool t_triedToCreateThreadStressLog; variable-speed CPUs (for power management), this is not accurate, but may be good enough. */ -__forceinline +FORCEINLINE #ifdef HOST_WINDOWS __declspec(naked) #else diff --git a/src/coreclr/vm/comdatetime.cpp b/src/coreclr/vm/comdatetime.cpp index bc6b63eab6cb9e..376dca4eab3267 100644 --- a/src/coreclr/vm/comdatetime.cpp +++ b/src/coreclr/vm/comdatetime.cpp @@ -41,7 +41,7 @@ const double COMDateTime::OADateMaxAsDouble = 2958466.0; const INT64 COMDateTime::MaxTicks = DaysTo10000 * TicksPerDay; const INT64 COMDateTime::MaxMillis = DaysTo10000 * MillisPerDay; -const INT64 TicksMask = I64(0x3FFFFFFFFFFFFFFF); +const INT64 TicksMask = 0x3FFFFFFFFFFFFFFFLL; // This function is duplicated in DateTime.cs INT64 COMDateTime::DoubleDateToTicks(const double d) diff --git a/src/coreclr/vm/common.h b/src/coreclr/vm/common.h index 858f6523bb7f05..bf6f41d7e33927 100644 --- a/src/coreclr/vm/common.h +++ b/src/coreclr/vm/common.h @@ -91,7 +91,7 @@ using std::min; #include "stdmacros.h" -#define POISONC ((UINT_PTR)((sizeof(int *) == 4)?0xCCCCCCCCL:I64(0xCCCCCCCCCCCCCCCC))) +#define POISONC ((UINT_PTR)((sizeof(int *) == 4)?0xCCCCCCCCL:0xCCCCCCCCCCCCCCCCLL)) #include "switches.h" #include "holder.h" diff --git a/src/coreclr/vm/contractimpl.h b/src/coreclr/vm/contractimpl.h index a9466cfe72ebac..5b3a1f2ee53e8b 100644 --- a/src/coreclr/vm/contractimpl.h +++ b/src/coreclr/vm/contractimpl.h @@ -183,26 +183,26 @@ struct DispatchToken static const UINT_PTR INVALID_TOKEN = 0x7FFFFFFF; #endif // FEATURE_CACHED_INTERFACE_DISPATCH #else //TARGET_64BIT - static const UINT_PTR MASK_SLOT_NUMBER = UI64(0x000000000000FFFF); + static const UINT_PTR MASK_SLOT_NUMBER = 0x000000000000FFFFULL; static const UINT_PTR SHIFT_TYPE_ID = 0x20; static const UINT_PTR SHIFT_SLOT_NUMBER = 0x0; #ifdef FEATURE_CACHED_INTERFACE_DISPATCH #ifdef FAT_DISPATCH_TOKENS - static const UINT_PTR MASK_TYPE_ID = UI64(0x000000003FFFFFFF); - static const UINT_PTR FAT_TOKEN_FLAG = UI64(0x4000000000000000); - static const UINT_PTR DISPATCH_TOKEN_FLAG= UI64(0x8000000000000000); + static const UINT_PTR MASK_TYPE_ID = 0x000000003FFFFFFFULL; + static const UINT_PTR FAT_TOKEN_FLAG = 0x4000000000000000ULL; + static const UINT_PTR DISPATCH_TOKEN_FLAG= 0x8000000000000000ULL; #else - static const UINT_PTR MASK_TYPE_ID = UI64(0x000000007FFFFFFF); - static const UINT_PTR DISPATCH_TOKEN_FLAG= UI64(0x8000000000000000); + static const UINT_PTR MASK_TYPE_ID = 0x000000007FFFFFFFULL; + static const UINT_PTR DISPATCH_TOKEN_FLAG= 0x8000000000000000ULL; #endif // FAT_DISPATCH_TOKENS #else // FEATURE_CACHED_INTERFACE_DISPATCH #ifdef FAT_DISPATCH_TOKENS - static const UINT_PTR MASK_TYPE_ID = UI64(0x000000007FFFFFFF); - static const UINT_PTR FAT_TOKEN_FLAG = UI64(0x8000000000000000); + static const UINT_PTR MASK_TYPE_ID = 0x000000007FFFFFFFULL; + static const UINT_PTR FAT_TOKEN_FLAG = 0x8000000000000000ULL; #else - static const UINT_PTR MASK_TYPE_ID = UI64(0x00000000FFFFFFFF); + static const UINT_PTR MASK_TYPE_ID = 0x00000000FFFFFFFFULL; #endif // FAT_DISPATCH_TOKENS #endif // FEATURE_CACHED_INTERFACE_DISPATCH diff --git a/src/coreclr/vm/gc_unwind_x86.inl b/src/coreclr/vm/gc_unwind_x86.inl index 852cd40a024af6..0e240a1869409a 100644 --- a/src/coreclr/vm/gc_unwind_x86.inl +++ b/src/coreclr/vm/gc_unwind_x86.inl @@ -36,7 +36,7 @@ static bool trEnumGCRefs = false; static bool dspPtr = false; // prints the live ptrs as reported #endif -__forceinline unsigned decodeUnsigned(PTR_CBYTE& src) +FORCEINLINE unsigned decodeUnsigned(PTR_CBYTE& src) { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; @@ -67,7 +67,7 @@ __forceinline unsigned decodeUnsigned(PTR_CBYTE& src) return value; } -__forceinline int decodeSigned(PTR_CBYTE& src) +FORCEINLINE int decodeSigned(PTR_CBYTE& src) { LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; diff --git a/src/coreclr/vm/gcenv.h b/src/coreclr/vm/gcenv.h index 35bf026c5d4525..79c52e5eee9c28 100644 --- a/src/coreclr/vm/gcenv.h +++ b/src/coreclr/vm/gcenv.h @@ -61,8 +61,4 @@ namespace ETW } GC_ROOT_KIND; }; -#ifdef TARGET_UNIX -#define _tfopen _wfopen -#endif - #endif // GCENV_H_ diff --git a/src/coreclr/vm/hash.h b/src/coreclr/vm/hash.h index 99e4dfd9ef7d31..a3d1fcd3dcf955 100644 --- a/src/coreclr/vm/hash.h +++ b/src/coreclr/vm/hash.h @@ -59,7 +59,7 @@ class Bucket UPTR m_rgKeys[SLOTS_PER_BUCKET]; UPTR m_rgValues[SLOTS_PER_BUCKET]; -#define VALUE_MASK (sizeof(LPVOID) == 4 ? 0x7FFFFFFF : I64(0x7FFFFFFFFFFFFFFF)) +#define VALUE_MASK (sizeof(LPVOID) == 4 ? 0x7FFFFFFF : 0x7FFFFFFFFFFFFFFFLL) void SetValue (UPTR value, UPTR i) { diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index 9937b90cb2e03d..e161f01e0855a2 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -3794,61 +3794,61 @@ public : enum_flag_TokenMask = 0xFFFFFF00, }; // enum WFLAGS2_ENUM - __forceinline void ClearFlag(WFLAGS_LOW_ENUM flag) + FORCEINLINE void ClearFlag(WFLAGS_LOW_ENUM flag) { _ASSERTE(!IsStringOrArray()); m_dwFlags &= ~flag; } - __forceinline void SetFlag(WFLAGS_LOW_ENUM flag) + FORCEINLINE void SetFlag(WFLAGS_LOW_ENUM flag) { _ASSERTE(!IsStringOrArray()); m_dwFlags |= flag; } - __forceinline DWORD GetFlag(WFLAGS_LOW_ENUM flag) const + FORCEINLINE DWORD GetFlag(WFLAGS_LOW_ENUM flag) const { SUPPORTS_DAC; return (IsStringOrArray() ? (enum_flag_StringArrayValues & flag) : (m_dwFlags & flag)); } - __forceinline BOOL TestFlagWithMask(WFLAGS_LOW_ENUM mask, WFLAGS_LOW_ENUM flag) const + FORCEINLINE BOOL TestFlagWithMask(WFLAGS_LOW_ENUM mask, WFLAGS_LOW_ENUM flag) const { LIMITED_METHOD_DAC_CONTRACT; return (IsStringOrArray() ? (((DWORD)enum_flag_StringArrayValues & (DWORD)mask) == (DWORD)flag) : ((m_dwFlags & (DWORD)mask) == (DWORD)flag)); } - __forceinline void ClearFlag(WFLAGS_HIGH_ENUM flag) + FORCEINLINE void ClearFlag(WFLAGS_HIGH_ENUM flag) { m_dwFlags &= ~flag; } - __forceinline void SetFlag(WFLAGS_HIGH_ENUM flag) + FORCEINLINE void SetFlag(WFLAGS_HIGH_ENUM flag) { m_dwFlags |= flag; } - __forceinline DWORD GetFlag(WFLAGS_HIGH_ENUM flag) const + FORCEINLINE DWORD GetFlag(WFLAGS_HIGH_ENUM flag) const { LIMITED_METHOD_DAC_CONTRACT; return m_dwFlags & flag; } - __forceinline BOOL TestFlagWithMask(WFLAGS_HIGH_ENUM mask, WFLAGS_HIGH_ENUM flag) const + FORCEINLINE BOOL TestFlagWithMask(WFLAGS_HIGH_ENUM mask, WFLAGS_HIGH_ENUM flag) const { LIMITED_METHOD_DAC_CONTRACT; return ((m_dwFlags & (DWORD)mask) == (DWORD)flag); } - __forceinline void ClearFlag(WFLAGS2_ENUM flag) + FORCEINLINE void ClearFlag(WFLAGS2_ENUM flag) { m_dwFlags2 &= ~flag; } - __forceinline void SetFlag(WFLAGS2_ENUM flag) + FORCEINLINE void SetFlag(WFLAGS2_ENUM flag) { m_dwFlags2 |= flag; } - __forceinline DWORD GetFlag(WFLAGS2_ENUM flag) const + FORCEINLINE DWORD GetFlag(WFLAGS2_ENUM flag) const { LIMITED_METHOD_DAC_CONTRACT; return m_dwFlags2 & flag; } - __forceinline BOOL TestFlagWithMask(WFLAGS2_ENUM mask, WFLAGS2_ENUM flag) const + FORCEINLINE BOOL TestFlagWithMask(WFLAGS2_ENUM mask, WFLAGS2_ENUM flag) const { return (m_dwFlags2 & (DWORD)mask) == (DWORD)flag; } @@ -3917,12 +3917,12 @@ public : TADDR m_pCanonMT; }; - __forceinline static LowBits union_getLowBits(TADDR pCanonMT) + FORCEINLINE static LowBits union_getLowBits(TADDR pCanonMT) { LIMITED_METHOD_DAC_CONTRACT; return LowBits(pCanonMT & UNION_MASK); } - __forceinline static TADDR union_getPointer(TADDR pCanonMT) + FORCEINLINE static TADDR union_getPointer(TADDR pCanonMT) { LIMITED_METHOD_DAC_CONTRACT; return (pCanonMT & ~UNION_MASK); diff --git a/src/coreclr/vm/nativelibrary.cpp b/src/coreclr/vm/nativelibrary.cpp index 534e25db221cc1..dec0e92964cd8f 100644 --- a/src/coreclr/vm/nativelibrary.cpp +++ b/src/coreclr/vm/nativelibrary.cpp @@ -123,7 +123,7 @@ namespace } #endif // TARGET_UNIX - __UNREACHABLE(); + UNREACHABLE(); } private: diff --git a/src/coreclr/vm/object.inl b/src/coreclr/vm/object.inl index 467ec47a1b3be4..a1bedd6e9d9826 100644 --- a/src/coreclr/vm/object.inl +++ b/src/coreclr/vm/object.inl @@ -46,14 +46,14 @@ inline SIZE_T Object::GetSize() return s; } -__forceinline /*static*/ DWORD StringObject::GetBaseSize() +FORCEINLINE /*static*/ DWORD StringObject::GetBaseSize() { LIMITED_METHOD_DAC_CONTRACT; return OBJECT_BASESIZE + sizeof(DWORD) /* length */ + sizeof(WCHAR) /* null terminator */; } -__forceinline /*static*/ SIZE_T StringObject::GetSize(DWORD strLen) +FORCEINLINE /*static*/ SIZE_T StringObject::GetSize(DWORD strLen) { LIMITED_METHOD_DAC_CONTRACT; @@ -231,7 +231,7 @@ inline TypeHandle ArrayBase::GetArrayElementTypeHandle() const //=============================================================================== // Returns true if this pMT is Nullable for T is equivalent to paramMT -__forceinline BOOL Nullable::IsNullableForType(TypeHandle type, MethodTable* paramMT) +FORCEINLINE BOOL Nullable::IsNullableForType(TypeHandle type, MethodTable* paramMT) { if (type.IsTypeDesc()) return FALSE; diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp index 4a2c122d453e2f..7e556af2110ce2 100644 --- a/src/coreclr/vm/threadsuspend.cpp +++ b/src/coreclr/vm/threadsuspend.cpp @@ -2728,7 +2728,7 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) RestoreContextSimulated(pThread, pCtx, &frame, dwLastError); // we never return to the caller. - __UNREACHABLE(); + UNREACHABLE(); } #endif // TARGET_X86 @@ -2774,7 +2774,7 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason) #endif // we never return to the caller. - __UNREACHABLE(); + UNREACHABLE(); } //**************************************************************************************** diff --git a/src/coreclr/vm/vars.hpp b/src/coreclr/vm/vars.hpp index 9e98fbb87cb999..e79b690771dc9a 100644 --- a/src/coreclr/vm/vars.hpp +++ b/src/coreclr/vm/vars.hpp @@ -553,7 +553,7 @@ GVAL_DECL(SIZE_T, g_runtimeVirtualSize); #endif #ifndef MAXULONGLONG -#define MAXULONGLONG UI64(0xffffffffffffffff) +#define MAXULONGLONG 0xffffffffffffffffULL #endif //----------------------------------------------------------------------------- diff --git a/src/mono/mono/utils/dlmalloc.c b/src/mono/mono/utils/dlmalloc.c index 53fbd2adf2bf85..972c7a61af4ed7 100644 --- a/src/mono/mono/utils/dlmalloc.c +++ b/src/mono/mono/utils/dlmalloc.c @@ -1169,6 +1169,7 @@ int mspace_mallopt(int, int); #ifndef LACKS_STDLIB_H #include /* for abort() */ #endif /* LACKS_STDLIB_H */ +#undef assert #ifdef DEBUG #if ABORT_ON_ASSERT_FAILURE #define assert(x) if(!(x)) ABORT diff --git a/src/native/minipal/utils.h b/src/native/minipal/utils.h index 23a6a643601d1e..97758ffcf0f8a8 100644 --- a/src/native/minipal/utils.h +++ b/src/native/minipal/utils.h @@ -4,6 +4,10 @@ #ifndef HAVE_MINIPAL_UTILS_H #define HAVE_MINIPAL_UTILS_H +#ifndef assert +#include +#endif + #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) // Number of characters in a string literal. Excludes terminating NULL. @@ -38,6 +42,35 @@ # define FALLTHROUGH #endif +#ifdef _MSC_VER +#define UNREACHABLE_MSG(message) \ + do { \ + assert(!#message); \ + __assume(0); \ + } while (0) +#else +#define UNREACHABLE_MSG(message) \ + do { \ + assert(!#message); \ + __builtin_unreachable(); \ + } while (0) +#endif +#define UNREACHABLE() UNREACHABLE_MSG("Unreachable reached") + +#if defined(_MSC_VER) +#define NOINLINE __declspec(noinline) +#define FORCEINLINE __forceinline +#else +#define NOINLINE __attribute__((noinline)) +#define FORCEINLINE __attribute__((always_inline)) inline +#endif + +#ifdef _MSC_VER +#define DECLSPEC_ALIGN(x) __declspec(align(x)) +#else +#define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) +#endif + #if defined(_MSC_VER) #define LIBC_CALLBACK __cdecl #else