37 lines
1.5 KiB
C
37 lines
1.5 KiB
C
/* Focused, isolated compile smoke test for Include/internal/pycore_atomic.h
|
|
* under VC6/_M_IX86.
|
|
*
|
|
* Deliberately does NOT go through Python.h or any other pycore_*.h header:
|
|
* pycore_interp.h (reached transitively from a real core translation unit
|
|
* like Modules/main.c) additionally requires <stdbool.h>, a separate,
|
|
* unrelated VC6 gap tracked in PORT_STATUS.md. Isolating pycore_atomic.h
|
|
* here keeps this probe's result attributable to the atomics compatibility
|
|
* work specifically.
|
|
*
|
|
* Py_BUILD_CORE is supplied by the probe script (/D Py_BUILD_CORE), the
|
|
* same way it is for a real core translation unit. <inttypes.h> (resolved
|
|
* to compat/msvc600/inttypes.h for VC6 via the include path) provides
|
|
* uintptr_t, which pycore_atomic.h needs but does not itself include; in
|
|
* a real build this comes from Python.h/pyport.h, included ahead of any
|
|
* pycore_*.h header.
|
|
*/
|
|
#include <inttypes.h>
|
|
#include "pycore_atomic.h"
|
|
|
|
static _Py_atomic_int atomic_int_value;
|
|
static _Py_atomic_address atomic_addr_value;
|
|
|
|
int
|
|
vc6_atomic_smoke(void)
|
|
{
|
|
_Py_atomic_store(&atomic_int_value, 1);
|
|
_Py_atomic_store_relaxed(&atomic_int_value, 2);
|
|
_Py_atomic_store(&atomic_addr_value, (uintptr_t)0);
|
|
_Py_atomic_store_relaxed(&atomic_addr_value, (uintptr_t)1);
|
|
|
|
return _Py_atomic_load(&atomic_int_value)
|
|
+ _Py_atomic_load_relaxed(&atomic_int_value)
|
|
+ (int)_Py_atomic_load(&atomic_addr_value)
|
|
+ (int)_Py_atomic_load_relaxed(&atomic_addr_value);
|
|
}
|