bpo-35081: Move Include/pyatomic.c to Include/internal/ (GH-10239) · python/cpython@31368a4 (original) (raw)

10 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -53,8 +53,6 @@
53 53 #include "pyport.h"
54 54 #include "pymacro.h"
55 55
56 -#include "pyatomic.h"
57 -
58 56 /* Debug-mode build with pymalloc implies PYMALLOC_DEBUG.
59 57 * PYMALLOC_DEBUG is in error if pymalloc is not in use.
60 58 */
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
4 4 extern "C" {
5 5 #endif
6 6
7 -#include "pyatomic.h"
7 +#include "internal/pyatomic.h"
8 8 #include "pythread.h"
9 9
10 10 struct _pending_calls {
Original file line number Diff line number Diff line change
@@ -4,11 +4,11 @@
4 4 extern "C" {
5 5 #endif
6 6
7 -#include "pyatomic.h"
8 -
9 7 #include "internal/condvar.h"
8 +#include "internal/pyatomic.h"
9 +
10 10 #ifndef Py_HAVE_CONDVAR
11 -#error You need either a POSIX-compatible or a Windows system!
11 +# error You need either a POSIX-compatible or a Windows system!
12 12 #endif
13 13
14 14 /* Enable if you want to force the switching of threads at least
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
1 1 #ifndef Py_ATOMIC_H
2 2 #define Py_ATOMIC_H
3 -#ifdef Py_BUILD_CORE
3 +#ifdef __cplusplus
4 +extern "C" {
5 +#endif
6 +
7 +#ifndef Py_BUILD_CORE
8 +# error "Py_BUILD_CORE must be defined to include this header"
9 +#endif
4 10
5 11 #include "dynamic_annotations.h"
6 12
@@ -531,5 +537,8 @@ typedef struct _Py_atomic_int {
531 537 _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, _Py_memory_order_relaxed)
532 538 #define _Py_atomic_load_relaxed(ATOMIC_VAL) \
533 539 _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed)
534 -#endif /* Py_BUILD_CORE */
540 +
541 +#ifdef __cplusplus
542 +}
543 +#endif
535 544 #endif /* Py_ATOMIC_H */
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ extern "C" {
5 5 #endif
6 6
7 7 #include "pystate.h"
8 -#include "pyatomic.h"
9 8 #include "pythread.h"
10 9
11 10 #include "internal/mem.h"
Original file line number Diff line number Diff line change
@@ -988,7 +988,6 @@ PYTHON_HEADERS= \
988 988 $(srcdir)/Include/pgen.h \
989 989 $(srcdir)/Include/pgenheaders.h \
990 990 $(srcdir)/Include/pyarena.h \
991 - $(srcdir)/Include/pyatomic.h \
992 991 $(srcdir)/Include/pycapsule.h \
993 992 $(srcdir)/Include/pyctype.h \
994 993 $(srcdir)/Include/pydebug.h \
@@ -1029,6 +1028,7 @@ PYTHON_HEADERS= \
1029 1028 $(srcdir)/Include/internal/ceval.h \
1030 1029 $(srcdir)/Include/internal/gil.h \
1031 1030 $(srcdir)/Include/internal/mem.h \
1031 + $(srcdir)/Include/internal/pyatomic.h \
1032 1032 $(srcdir)/Include/internal/pygetopt.h \
1033 1033 $(srcdir)/Include/internal/pystate.h \
1034 1034 $(srcdir)/Include/internal/context.h \
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
4 4 /* XXX Signals should be recorded per thread, now we have thread state. */
5 5
6 6 #include "Python.h"
7 +#include "internal/pyatomic.h"
8 +
7 9 #ifndef MS_WINDOWS
8 10 #include "posixmodule.h"
9 11 #endif
Original file line number Diff line number Diff line change
@@ -118,6 +118,7 @@
118 118 <ClInclude Include="..\Include\internal\gil.h" />
119 119 <ClInclude Include="..\Include\internal\hamt.h" />
120 120 <ClInclude Include="..\Include\internal\mem.h" />
121 + <ClInclude Include="..\Include\internal\pyatomic.h" />
121 122 <ClInclude Include="..\Include\internal\pystate.h" />
122 123 <ClInclude Include="..\Include\internal\warnings.h" />
123 124 <ClInclude Include="..\Include\intrcheck.h" />
Original file line number Diff line number Diff line change
@@ -153,6 +153,9 @@
153 153 <ClInclude Include="..\Include\internal\mem.h">
154 154 <Filter>Include</Filter>
155 155 </ClInclude>
156 + <ClInclude Include="..\Include\internal\pyatomic.h">
157 + <Filter>Include</Filter>
158 + </ClInclude>
156 159 <ClInclude Include="..\Include\internal\pystate.h">
157 160 <Filter>Include</Filter>
158 161 </ClInclude>
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
5 5 #include <stdlib.h>
6 6 #include <errno.h>
7 7
8 +#include "internal/pyatomic.h"
8 9
9 10 /* First some general settings */
10 11