headers/wdm: Remove local definitions of `InterlockedBitTestAndSet()` and `InterlockedBitTestAndReset()`
Previously, these caused errors when compiled as C++:
In file included from test1.cpp:1:
C:/MSYS64/ucrt64/include/ddk/wdm.h:205:1: error: 'BOOLEAN InterlockedBitTestAndSet(volatile LONG*, LONG)' redeclared inline without 'gnu_inline' attribute
205 | InterlockedBitTestAndSet(
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/MSYS64/ucrt64/include/intrin.h:41,
from C:/MSYS64/ucrt64/include/ddk/wdm.h:68:
C:/MSYS64/ucrt64/include/psdk_inc/intrin-impl.h:1850:1: note: 'unsigned char InterlockedBitTestAndSet(volatile long int*, long int)' previously defined here
1850 | __buildbittesti(InterlockedBitTestAndSet, __LONG32, "lock bts{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
| ^~~~~~~~~~~~~~~
C:/MSYS64/ucrt64/include/ddk/wdm.h:224:1: error: 'BOOLEAN InterlockedBitTestAndReset(volatile LONG*, LONG)' redeclared inline without 'gnu_inline' attribute
224 | InterlockedBitTestAndReset(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:/MSYS64/ucrt64/include/psdk_inc/intrin-impl.h:1859:1: note: 'unsigned char InterlockedBitTestAndReset(volatile long int*, long int)' previously defined here
1859 | __buildbittesti(InterlockedBitTestAndReset, __LONG32, "lock btr{l %[Offset],%[Base] | %[Base],%[Offset]}" __FLAGSET, "I")
| ^~~~~~~~~~~~~~~
When compiled as C, the static definitions were treated as external ones and
caused linker errors instead.
This fixes https://github.com/mingw-w64/mingw-w64/issues/111.
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-headers/ddk/include/ddk/wdm.h b/mingw-w64-headers/ddk/include/ddk/wdm.h
index c2c5477..5548e47 100644
--- a/mingw-w64-headers/ddk/include/ddk/wdm.h
+++ b/mingw-w64-headers/ddk/include/ddk/wdm.h
@@ -195,51 +195,6 @@
/******************************************************************************
* INTERLOCKED Functions *
******************************************************************************/
-//
-// Intrinsics (note: taken from our winnt.h)
-// FIXME: 64-bit
-//
-#if defined(__GNUC__)
-
-static __inline__ BOOLEAN
-InterlockedBitTestAndSet(
- IN LONG volatile *Base,
- IN LONG Bit)
-{
-#if defined(_M_IX86)
- LONG OldBit;
- __asm__ __volatile__("lock "
- "btsl %2,%1\n\t"
- "sbbl %0,%0\n\t"
- :"=r" (OldBit),"+m" (*Base)
- :"Ir" (Bit)
- : "memory");
- return OldBit;
-#else
- return (_InterlockedOr(Base, 1 << Bit) >> Bit) & 1;
-#endif
-}
-
-static __inline__ BOOLEAN
-InterlockedBitTestAndReset(
- IN LONG volatile *Base,
- IN LONG Bit)
-{
-#if defined(_M_IX86)
- LONG OldBit;
- __asm__ __volatile__("lock "
- "btrl %2,%1\n\t"
- "sbbl %0,%0\n\t"
- :"=r" (OldBit),"+m" (*Base)
- :"Ir" (Bit)
- : "memory");
- return OldBit;
-#else
- return (_InterlockedAnd(Base, ~(1 << Bit)) >> Bit) & 1;
-#endif
-}
-
-#endif /* defined(__GNUC__) */
#define BitScanForward _BitScanForward
#define BitScanReverse _BitScanReverse