# ticket: 3111
# mode: compile
# tag: warnings
ctypedef unsigned char npy_uint8
ctypedef unsigned short npy_uint16
ctypedef fused dtype_t:
npy_uint8
ctypedef fused dtype_t_out:
npy_uint8
npy_uint16
def foo(dtype_t[:] a, dtype_t_out[:, :] b):
pass
# The primary thing we're trying to test here is the _absence_ of the warning
# "__pyxutil:16:4: '___pyx_npy_uint8' redeclared". The remaining warnings are
# unrelated to this test.
_WARNINGS = """
20:10: 'cpdef_method' redeclared
31:10: 'cpdef_cname_method' redeclared
448:72: Argument evaluation order in C function call is undefined and may not be as expected
448:72: Argument evaluation order in C function call is undefined and may not be as expected
751:34: Argument evaluation order in C function call is undefined and may not be as expected
751:34: Argument evaluation order in C function call is undefined and may not be as expected
"""
-
Sam Gross authored
This fixes a few issues in MemoryView_C.c to allow atomic reference counting to be used in more cases. - Enable GNU atomics for `__GNUC__` >= 5. Previously, GCC 5.0, 6.0, X.0 versions used lock-based reference counting due to an incorrect preprocessor check. - Typo in `__GNUC_PATCHLEVEL__` macro (missing underscores) - Enable atomics in MSVC and fix returned values. InterlockedExchangeAdd returns the *initial* value (like __sync_fetch_and_add). InterlockedIncrement returned the *resulting* value (post increment), which would have been incorrect if MSVC atomics had been enabled. Also avoids allocating a lock in MemoryView when atomics are available, which additionally fixes a thread-safety issue in the "nogil" CPython fork. * Use _InterlockedExchangeAdd intrinsic The InterlockedExchangeSubtract function isn't available in older versions of MSVC, while InterlockedExchangeAdd is available since Windows XP. The intrinsic variant (with the underscore prefix) avoids needing to include the entire Windows.h header. * Only use MSVC atomics when compiling for the "nogil" CPython fork to prevent potential breakage of existing Windows setups.
Unverifiedf1748bb8