mirror of
https://github.com/reactos/reactos.git
synced 2025-04-18 19:47:14 +00:00
Remove some stuff added for old GCC versions.
svn path=/trunk/; revision=60833
This commit is contained in:
parent
5385764edf
commit
755334ff27
10 changed files with 18 additions and 91 deletions
|
@ -78,4 +78,4 @@ set(_VS_ANALYZE_ FALSE CACHE BOOL
|
|||
endif()
|
||||
|
||||
set(USE_DUMMY_PSEH FALSE CACHE BOOL
|
||||
"Whether to disable PSEH support.")
|
||||
"Whether to disable PSEH support.")
|
||||
|
|
|
@ -61,14 +61,10 @@ else()
|
|||
add_compile_flags("-march=${OARCH}")
|
||||
endif()
|
||||
|
||||
# Warnings
|
||||
add_compile_flags("-Werror -Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-unused-value")
|
||||
|
||||
if(GCC_VERSION VERSION_LESS 4.7)
|
||||
add_compile_flags("-Wno-error=uninitialized")
|
||||
elseif(GCC_VERSION VERSION_EQUAL 4.7 OR GCC_VERSION VERSION_GREATER 4.7)
|
||||
add_compile_flags("-Wno-error=unused-but-set-variable -Wno-maybe-uninitialized -Wno-error=narrowing")
|
||||
endif()
|
||||
# Warnings, errors
|
||||
add_compile_flags("-Werror -Wall -Wpointer-arith")
|
||||
add_compile_flags("-Wno-char-subscripts -Wno-multichar -Wno-unused-value -Wno-maybe-uninitialized")
|
||||
add_compile_flags("-Wno-error=unused-but-set-variable -Wno-error=narrowing")
|
||||
|
||||
if(ARCH STREQUAL "amd64")
|
||||
add_compile_flags("-Wno-format")
|
||||
|
@ -82,7 +78,7 @@ if(OPTIMIZE STREQUAL "1")
|
|||
elseif(OPTIMIZE STREQUAL "2")
|
||||
add_compile_flags("-Os")
|
||||
elseif(OPTIMIZE STREQUAL "3")
|
||||
add_compile_flags("-O1 -fno-inline-functions-called-once -fno-tree-sra")
|
||||
add_compile_flags("-Og")
|
||||
elseif(OPTIMIZE STREQUAL "4")
|
||||
add_compile_flags("-O1")
|
||||
elseif(OPTIMIZE STREQUAL "5")
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
/* BUGBUG: only good for use in macros. Cannot be taken the address of */
|
||||
#define __noop(...) ((void)0)
|
||||
|
||||
/* TODO: __assume. GCC only supports the weaker __builtin_expect */
|
||||
#define __assume(x) if (!(x)) __builtin_unreachable()
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -785,7 +785,7 @@ PPC_QUAL long _InterlockedAddLargeStatistic(volatile long long * const Addend, c
|
|||
/* BUGBUG: only good for use in macros. Cannot be taken the address of */
|
||||
#define __noop(...) ((void)0)
|
||||
|
||||
/* TODO: __assume. GCC only supports the weaker __builtin_expect */
|
||||
#define __assume(x) if (!(x)) __builtin_unreachable()
|
||||
|
||||
#endif
|
||||
/* EOF */
|
||||
|
|
|
@ -44,16 +44,6 @@
|
|||
RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENTION_LOCK)
|
||||
#define RTL_SRWLOCK_BITS 4
|
||||
|
||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40300) || \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ == 40303)
|
||||
/* This macro will cause the code to assert if compiled with a buggy
|
||||
version of GCC that doesn't align the wait blocks properly on the stack! */
|
||||
#define ASSERT_SRW_WAITBLOCK(ptr) \
|
||||
ASSERT(((ULONG_PTR)ptr & ((1 << RTL_SRWLOCK_BITS) - 1)) == 0)
|
||||
#else
|
||||
#define ASSERT_SRW_WAITBLOCK(ptr) ((void)0)
|
||||
#endif
|
||||
|
||||
typedef struct _RTLP_SRWLOCK_SHARED_WAKE
|
||||
{
|
||||
LONG Wake;
|
||||
|
@ -231,7 +221,6 @@ RtlpAcquireWaitBlockLock(IN OUT PRTL_SRWLOCK SRWLock)
|
|||
|
||||
WaitBlock = (PRTLP_SRWLOCK_WAITBLOCK)(PrevValue & ~RTL_SRWLOCK_MASK);
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(WaitBlock);
|
||||
return WaitBlock;
|
||||
}
|
||||
|
||||
|
@ -395,8 +384,6 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
|||
|
||||
Shared->LastSharedWake = &SharedWake;
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(Shared);
|
||||
|
||||
RtlpReleaseWaitBlockLock(SRWLock);
|
||||
|
||||
RtlpAcquireSRWLockSharedWait(SRWLock,
|
||||
|
@ -467,8 +454,6 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
|||
Shared->LastSharedWake->Next = &SharedWake;
|
||||
}
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(Shared);
|
||||
|
||||
Shared->SharedCount++;
|
||||
Shared->LastSharedWake = &SharedWake;
|
||||
|
||||
|
@ -496,8 +481,6 @@ RtlAcquireSRWLockShared(IN OUT PRTL_SRWLOCK SRWLock)
|
|||
StackWaitBlock.SharedWakeChain = &SharedWake;
|
||||
StackWaitBlock.LastSharedWake = &SharedWake;
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||
|
||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
||||
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||
(PVOID)NewValue,
|
||||
|
@ -635,8 +618,6 @@ RtlAcquireSRWLockExclusive(IN OUT PRTL_SRWLOCK SRWLock)
|
|||
StackWaitBlock.Last = &StackWaitBlock;
|
||||
StackWaitBlock.Wake = 0;
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||
|
||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_SHARED | RTL_SRWLOCK_CONTENDED | RTL_SRWLOCK_OWNED;
|
||||
|
||||
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||
|
@ -666,8 +647,6 @@ AddWaitBlock:
|
|||
StackWaitBlock.Last = &StackWaitBlock;
|
||||
StackWaitBlock.Wake = 0;
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||
|
||||
First = RtlpAcquireWaitBlockLock(SRWLock);
|
||||
if (First != NULL)
|
||||
{
|
||||
|
@ -694,8 +673,6 @@ AddWaitBlock:
|
|||
StackWaitBlock.Last = &StackWaitBlock;
|
||||
StackWaitBlock.Wake = 0;
|
||||
|
||||
ASSERT_SRW_WAITBLOCK(&StackWaitBlock);
|
||||
|
||||
NewValue = (ULONG_PTR)&StackWaitBlock | RTL_SRWLOCK_OWNED | RTL_SRWLOCK_CONTENDED;
|
||||
if ((LONG_PTR)InterlockedCompareExchangePointer(&SRWLock->Ptr,
|
||||
(PVOID)NewValue,
|
||||
|
|
|
@ -845,23 +845,23 @@ ExpBlockOnLockedHandleEntry(IN PHANDLE_TABLE HandleTable,
|
|||
IN PHANDLE_TABLE_ENTRY HandleTableEntry)
|
||||
{
|
||||
LONG_PTR OldValue;
|
||||
DEFINE_WAIT_BLOCK(WaitBlock);
|
||||
EX_PUSH_LOCK_WAIT_BLOCK WaitBlock;
|
||||
|
||||
/* Block on the pushlock */
|
||||
ExBlockPushLock(&HandleTable->HandleContentionEvent, WaitBlock);
|
||||
ExBlockPushLock(&HandleTable->HandleContentionEvent, &WaitBlock);
|
||||
|
||||
/* Get the current value and check if it's been unlocked */
|
||||
OldValue = HandleTableEntry->Value;
|
||||
if (!(OldValue) || (OldValue & EXHANDLE_TABLE_ENTRY_LOCK_BIT))
|
||||
{
|
||||
/* Unblock the pushlock and return */
|
||||
ExfUnblockPushLock(&HandleTable->HandleContentionEvent, WaitBlock);
|
||||
ExfUnblockPushLock(&HandleTable->HandleContentionEvent, &WaitBlock);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Wait for it to be unblocked */
|
||||
ExWaitForUnblockPushLock(&HandleTable->HandleContentionEvent,
|
||||
WaitBlock);
|
||||
&WaitBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -472,7 +472,8 @@ ExfAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
|
|||
{
|
||||
EX_PUSH_LOCK OldValue = *PushLock, NewValue, TempValue;
|
||||
BOOLEAN NeedWake;
|
||||
DEFINE_WAIT_BLOCK(WaitBlock);
|
||||
EX_PUSH_LOCK_WAIT_BLOCK Block;
|
||||
PEX_PUSH_LOCK_WAIT_BLOCK WaitBlock = &Block;
|
||||
|
||||
/* Start main loop */
|
||||
for (;;)
|
||||
|
@ -645,7 +646,8 @@ ExfAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
|
|||
{
|
||||
EX_PUSH_LOCK OldValue = *PushLock, NewValue;
|
||||
BOOLEAN NeedWake;
|
||||
DEFINE_WAIT_BLOCK(WaitBlock);
|
||||
EX_PUSH_LOCK_WAIT_BLOCK Block;
|
||||
PEX_PUSH_LOCK_WAIT_BLOCK WaitBlock = &Block;
|
||||
|
||||
/* Start main loop */
|
||||
for (;;)
|
||||
|
|
|
@ -295,11 +295,6 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject,
|
|||
ASSERT(FileObject);
|
||||
ASSERT(FileObject->FsContext);
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ == 405)
|
||||
/* Silence incorrect GCC 4.5.x warning */
|
||||
OldFileSize.LowPart = 0;
|
||||
#endif
|
||||
|
||||
/* Initialize some of the vars and pointers */
|
||||
NewSize.QuadPart = 0;
|
||||
Offset.QuadPart = FileOffset->QuadPart + Length;
|
||||
|
@ -547,11 +542,6 @@ FsRtlCopyWrite(IN PFILE_OBJECT FileObject,
|
|||
{
|
||||
LARGE_INTEGER OldFileSize;
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ == 405)
|
||||
/* Silence incorrect GCC 4.5.x warning */
|
||||
OldFileSize.QuadPart = 0;
|
||||
#endif
|
||||
|
||||
/* Sanity check */
|
||||
ASSERT(!KeIsExecutingDpc());
|
||||
|
||||
|
|
|
@ -98,34 +98,6 @@ typedef struct _HARDERROR_USER_PARAMETERS
|
|||
#define MAX_MID_INDEX (MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
|
||||
#define MAX_HIGH_INDEX (MID_LEVEL_ENTRIES * MID_LEVEL_ENTRIES * LOW_LEVEL_ENTRIES)
|
||||
|
||||
//
|
||||
// Detect old GCC
|
||||
//
|
||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40300) || \
|
||||
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ == 40303)
|
||||
|
||||
#define DEFINE_WAIT_BLOCK(x) \
|
||||
struct _AlignHack \
|
||||
{ \
|
||||
UCHAR Hack[15]; \
|
||||
EX_PUSH_LOCK_WAIT_BLOCK UnalignedBlock; \
|
||||
} WaitBlockBuffer; \
|
||||
PEX_PUSH_LOCK_WAIT_BLOCK x = (PEX_PUSH_LOCK_WAIT_BLOCK) \
|
||||
((ULONG_PTR)&WaitBlockBuffer.UnalignedBlock &~ 0xF);
|
||||
|
||||
#else
|
||||
|
||||
//
|
||||
// This is only for compatibility; the compiler will optimize the extra
|
||||
// local variable (the actual pointer) away, so we don't take any perf hit
|
||||
// by doing this.
|
||||
//
|
||||
#define DEFINE_WAIT_BLOCK(x) \
|
||||
EX_PUSH_LOCK_WAIT_BLOCK WaitBlockBuffer; \
|
||||
PEX_PUSH_LOCK_WAIT_BLOCK x = &WaitBlockBuffer;
|
||||
|
||||
#endif
|
||||
|
||||
#define ExpChangeRundown(x, y, z) (ULONG_PTR)InterlockedCompareExchangePointer(&x->Ptr, (PVOID)y, (PVOID)z)
|
||||
#define ExpChangePushlock(x, y, z) InterlockedCompareExchangePointer((PVOID*)x, (PVOID)y, (PVOID)z)
|
||||
#define ExpSetRundown(x, y) InterlockedExchangePointer(&x->Ptr, (PVOID)y)
|
||||
|
|
|
@ -10,20 +10,10 @@
|
|||
|
||||
#define TRAP_DEBUG 0
|
||||
|
||||
//
|
||||
// Unreachable code hint for GCC 4.5.x, older GCC versions, and MSVC
|
||||
//
|
||||
#ifdef __GNUC__
|
||||
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 405
|
||||
#define UNREACHABLE __builtin_unreachable()
|
||||
#else
|
||||
#define UNREACHABLE __builtin_trap()
|
||||
#endif
|
||||
#elif _MSC_VER
|
||||
#define UNREACHABLE __assume(0)
|
||||
|
||||
#if _MSC_VER
|
||||
#define __builtin_expect(a,b) (a)
|
||||
#else
|
||||
#define UNREACHABLE
|
||||
#endif
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue