Skip to content

Commit 7f2a04a

Browse files
committed
Okay.
1 parent 09f41e8 commit 7f2a04a

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

Modules/cpython-sys/build.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ fn generate_c_api_bindings(srcdir: &Path, builddir: Option<&str>, out_path: &Pat
9797
}
9898
} else if flag.starts_with("-I")
9999
|| flag.starts_with("-D")
100+
|| flag.starts_with("-std=")
100101
|| flag.starts_with("-isystem")
101102
{
102103
builder = builder.clang_arg(flag);
@@ -151,11 +152,6 @@ fn generate_c_api_bindings(srcdir: &Path, builddir: Option<&str>, out_path: &Pat
151152
}
152153
builder = add_target_clang_args(builder, builddir);
153154

154-
// Use C11 with GNU extensions so that <stdatomic.h> is available,
155-
// required by the mimalloc headers. This must be the last clang arg
156-
// to ensure it is not overridden by any earlier -std= flag.
157-
builder = builder.clang_arg("-std=gnu11");
158-
159155
let bindings = builder
160156
.allowlist_function("_?Py.*")
161157
.allowlist_type("_?Py.*")

Modules/cpython-sys/wrapper.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
#define Py_BUILD_CORE
3333

3434
// Internal
35+
// Ensure C11 atomics are available for mimalloc headers.
36+
// Clang supports <stdatomic.h> in all C modes via __has_extension(c_atomic).
37+
#if !defined(__cplusplus)
38+
#include <stdatomic.h>
39+
#endif
3540
#include "internal/pycore_parser.h"
3641
#include "internal/pycore_mimalloc.h"
3742
#include "internal/mimalloc/mimalloc.h"

0 commit comments

Comments
 (0)