| 1 |
From: Stefano Rivera <[email protected]> |
| 2 |
Date: Sat, 31 Aug 2024 12:58:23 +0200 |
| 3 |
Subject: GCC-14: Ignore -Wincompatible-pointer-types on 32-bit |
| 4 |
|
| 5 |
Work around missing GCC-14 support for 32-builds of PyPy by suppressing |
| 6 |
the GCC error. We hope to replace this with a real patch soon. |
| 7 |
|
| 8 |
Bug-Upstream: https://github.com/pypy/pypy/issues/5016 |
| 9 |
--- |
| 10 |
rpython/translator/c/genc.py | 5 +++++ |
| 11 |
rpython/translator/c/src/threadlocal.c | 3 +++ |
| 12 |
2 files changed, 8 insertions(+) |
| 13 |
|
| 14 |
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py |
| 15 |
index ebbf52f..3ec6db5 100644 |
| 16 |
--- a/rpython/translator/c/genc.py |
| 17 |
+++ b/rpython/translator/c/genc.py |
| 18 |
@@ -700,6 +700,7 @@ class SourceGenerator: |
| 19 |
print('/***********************************************************/', file=fc) |
| 20 |
|
| 21 |
nextralines = 12 |
| 22 |
+ IS_32_BIT = sys.maxint == 2**31-1 |
| 23 |
for name, nodeiter in self.splitnodesimpl('implement.c', |
| 24 |
self.funcnodes, |
| 25 |
nextralines, 1, |
| 26 |
@@ -715,6 +716,10 @@ class SourceGenerator: |
| 27 |
if self.database.reverse_debugger: |
| 28 |
print('#include "revdb_def.h"', file=fc) |
| 29 |
print(file=fc) |
| 30 |
+ if IS_32_BIT: |
| 31 |
+ print('#if defined __GNUC__ && __GNUC__ >= 14', file=fc) |
| 32 |
+ print('#pragma GCC diagnostic warning "-Wincompatible-pointer-types"', file=fc) |
| 33 |
+ print('#endif', file=fc) |
| 34 |
print(MARKER, file=fc) |
| 35 |
for node, impl in nodeiter: |
| 36 |
print('\n'.join(impl), file=fc) |
| 37 |
diff --git a/rpython/translator/c/src/threadlocal.c b/rpython/translator/c/src/threadlocal.c |
| 38 |
index aae978f..9e708cf 100644 |
| 39 |
--- a/rpython/translator/c/src/threadlocal.c |
| 40 |
+++ b/rpython/translator/c/src/threadlocal.c |
| 41 |
@@ -7,6 +7,9 @@ |
| 42 |
#include "src/threadlocal.h" |
| 43 |
#include "src/thread.h" |
| 44 |
|
| 45 |
+#if defined __GNUC__ && __GNUC__ >= 14 |
| 46 |
+#pragma GCC diagnostic warning "-Wincompatible-pointer-types" |
| 47 |
+#endif |
| 48 |
|
| 49 |
/* this is a spin-lock that must be acquired around each doubly-linked-list |
| 50 |
manipulation (because such manipulations can occur without the GIL) */ |