Skip to content

Commit 83e3aa1

Browse files
committed
interpreters/python: Avoid warnings that could be treated as errors
This commit disables some warnings when building CPython to avoid CI failing when `EXTRAFLAGS="-Wno-cpp -Werror"` is set.
1 parent 37acd5e commit 83e3aa1

13 files changed

+99
-32
lines changed

interpreters/python/Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ TARGETLIBPYTHON=$(TARGETINSTALL)/libpython$(CPYTHON_VERSION_MINOR).a
4343
TARGETMODULESPACK=$(TARGETBUILD)/lib/python$(shell echo $(CPYTHON_VERSION_MINOR) | tr -d .).zip
4444
TARGETMODULES=$(TARGETINSTALL)/lib/
4545

46+
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include
47+
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Test
48+
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include$(DELIM)internal
49+
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system
50+
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system$(DELIM)zlib$(DELIM)zlib
51+
CFLAGS += ${INCDIR_PREFIX}$(TARGETBUILD)
52+
CFLAGS += -Wno-shadow -Wno-undef -Wno-format -Wno-builtin-macro-redefined
53+
CFLAGS += -Wno-type-limits -Wno-implicit-fallthrough -Wno-char-subscripts
54+
CFLAGS += -Wno-sign-compare -Wno-unused-const-variable -Wno-unused-function
55+
CFLAGS += -Wno-unused-variable -Wno-overflow -Wno-unused-but-set-variable
56+
CFLAGS += -Wno-strict-prototypes
57+
4658
DEPPATH += --dep-path $(CPYTHON_UNPACKNAME)$(DELIM)Programs
4759
VPATH += :$(CPYTHON_UNPACKNAME)$(DELIM)Programs
4860

@@ -123,13 +135,6 @@ $(TARGETLIBPYTHON): $(TARGETBUILD)/Makefile
123135
$(Q) ( cp $(TARGETBUILD)/libpython$(CPYTHON_VERSION_MINOR).a $(TARGETLIBPYTHON) )
124136
$(Q) $(UNPACK) $(TARGETMODULESPACK) -d $(TARGETMODULES)/python$(CPYTHON_VERSION_MINOR)
125137

126-
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include
127-
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Test
128-
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include$(DELIM)internal
129-
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system
130-
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system$(DELIM)zlib$(DELIM)zlib
131-
CFLAGS += ${INCDIR_PREFIX}$(TARGETBUILD)
132-
133138
MODULE = $(CONFIG_INTERPRETER_CPYTHON)
134139

135140
PROGNAME += $(CONFIG_INTERPRETER_CPYTHON_PROGNAME)

interpreters/python/config.site

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export ac_cv_func_clock="yes"
1818
export ac_cv_func_fork="yes"
1919
export ac_cv_func_waitpid="yes"
2020
export ac_cv_func_pipe="yes"
21+
export ac_cv_enable_strict_prototypes_warning="no"
2122
export MODULE_BUILDTYPE="static"

interpreters/python/patch/0001-workaround-newlib-resource.h-limitations.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
From b2ac42cefa3747c7f7a9066fceed834286e829af Mon Sep 17 00:00:00 2001
1+
From 3917fd37644948096c6bebf53e701b59fa527cf5 Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <ivan@espressif.com>
33
Date: Tue, 22 Oct 2024 23:58:17 +0200
4-
Subject: [PATCH 01/10] workaround newlib resource.h limitations
4+
Subject: [PATCH 01/11] workaround newlib resource.h limitations
55

66
configure script checks if resource.h is available but doesn't check
77
if it defines all the necessary functions.
88

99
Temporary workaround until these functions are added to IDF.
10+
11+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
1012
---
1113
Modules/faulthandler.c | 2 +-
1214
1 file changed, 1 insertion(+), 1 deletion(-)

interpreters/python/patch/0002-fix-various-uint32_t-unsigned-int-type-mismatch-issu.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
From 036b39478c2419af1e0a64763b9ac741cf886387 Mon Sep 17 00:00:00 2001
1+
From 562138b0486ad050b5ce601d434910973ff6f094 Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <ivan@espressif.com>
33
Date: Wed, 23 Oct 2024 16:48:49 +0200
4-
Subject: [PATCH 02/10] fix various uint32_t/'unsigned int' type mismatch
4+
Subject: [PATCH 02/11] fix various uint32_t/'unsigned int' type mismatch
55
issues
66

77
In a few places existing code assumes that uint32_t == unsigned int.
88
Since in Xtensa and RISC-V bare metal toolchains uint32_t is instead
99
'unsigned long', the original code fails to build.
10+
11+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
1012
---
1113
Modules/zlibmodule.c | 28 ++++++++++++++--------------
1214
Objects/typeobject.c | 2 +-

interpreters/python/patch/0003-reuse-wasm_assets.py-for-generating-an-archive-of-py.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 4af7a9b726ca2c8ac330b51f98acf0a103f6fa71 Mon Sep 17 00:00:00 2001
1+
From dcc6b2b6aa396f96e7c9efe3e793d96c7004ef4f Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <ivan@espressif.com>
33
Date: Wed, 23 Oct 2024 16:54:39 +0200
4-
Subject: [PATCH 03/10] reuse wasm_assets.py for generating an archive of
4+
Subject: [PATCH 03/11] reuse wasm_assets.py for generating an archive of
55
python lib dir
66

77
wasm_assets.py is a useful script to prepare the smallest possible
@@ -12,6 +12,7 @@ This patch adds nuttx to the supported OS list in the script, as well
1212
as fixes what I think is a bug in path calculation.
1313

1414
Co-authored-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
15+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
1516
---
1617
Tools/wasm/wasm_assets.py | 3 ++-
1718
1 file changed, 2 insertions(+), 1 deletion(-)

interpreters/python/patch/0004-recognize-nuttx-as-a-supported-OS.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
From 1bb8d824a4b4e4b38c3541b7c26c5d71f0970266 Mon Sep 17 00:00:00 2001
1+
From ff067ccb26c91de352de362a25d87bcbabe924dc Mon Sep 17 00:00:00 2001
22
From: Ivan Grokhotkov <ivan@espressif.com>
33
Date: Wed, 23 Oct 2024 16:55:53 +0200
4-
Subject: [PATCH 04/10] recognize *-*-nuttx as a supported OS
4+
Subject: [PATCH 04/11] recognize *-*-nuttx as a supported OS
55

66
cpython's configure script bails out when cross-compiling for an
77
unknown OS, so we have to add "nuttx" to the list, even though it
88
is not used almost anywhere else.
99

1010
Co-authored-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
11+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
1112
---
1213
config.sub | 2 +-
1314
configure | 3 +++

interpreters/python/patch/0005-gh-122907-Fix-Builds-Without-HAVE_DYNAMIC_LOADING-Se.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
From cd8af3cbc9881e5a4a7c0644c8844478c8d0245d Mon Sep 17 00:00:00 2001
1+
From 7e646549488f2d3de4cf1e04ad975625342a9218 Mon Sep 17 00:00:00 2001
22
From: Eric Snow <ericsnowcurrently@gmail.com>
33
Date: Tue, 13 Aug 2024 14:44:57 -0600
4-
Subject: [PATCH 05/10] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
4+
Subject: [PATCH 05/11] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
55
(gh-122952)
66

77
As of 529a160 (gh-118204), building with HAVE_DYNAMIC_LOADING stopped working. This is a minimal fix just to get builds working again. There are actually a number of long-standing deficiencies with HAVE_DYNAMIC_LOADING builds that need to be resolved separately.
88
(cherry picked from commit ee1b8ce26e700350e47a5f65201097121c41912e)
99

1010
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
11+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
1112
---
1213
Include/internal/pycore_importdl.h | 4 ++++
1314
Lib/importlib/_bootstrap_external.py | 16 ++++++++--------

interpreters/python/patch/0006-change-var-name-to-avoid-conflict-with-nuttx-unused_.patch

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
From d424766bff74fb34a80a09c6e2ed8d9b40350bb8 Mon Sep 17 00:00:00 2001
1+
From 82a3c7c021324e4245289c565b2d379b83ed4be3 Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <tiago.medicci@espressif.com>
33
Date: Wed, 13 Nov 2024 14:20:36 -0300
4-
Subject: [PATCH 06/10] change var name to avoid conflict with nuttx
4+
Subject: [PATCH 06/11] change var name to avoid conflict with nuttx
55
unused_data macro
66

7+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
78
---
89
Modules/zlibmodule.c | 42 +++++++++++++++++++++---------------------
910
1 file changed, 21 insertions(+), 21 deletions(-)

interpreters/python/patch/0007-undef-atexit_register.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
From 1b802bfd159a6a9766ca5834af90f55d54285b4b Mon Sep 17 00:00:00 2001
1+
From 7eab2315d75d5e78e67e0b049ebb2fc71914b7ea Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <tiago.medicci@espressif.com>
33
Date: Wed, 13 Nov 2024 14:22:04 -0300
4-
Subject: [PATCH 07/10] undef atexit_register
4+
Subject: [PATCH 07/11] undef atexit_register
55

66
Even if not built, nuttx/include/nuttx/atexit.h defines it and this
77
causes conflicts.
8+
9+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
810
---
911
Modules/atexitmodule.c | 4 ++++
1012
1 file changed, 4 insertions(+)

interpreters/python/patch/0008-declare-struct-timeval.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
From b40e89c190ec7c6b3b0116a3f7025ab13854398f Mon Sep 17 00:00:00 2001
1+
From fc042cfa496f37f2a859495ad281583f79af0044 Mon Sep 17 00:00:00 2001
22
From: Tiago Medicci <tiago.medicci@espressif.com>
33
Date: Wed, 13 Nov 2024 14:23:34 -0300
4-
Subject: [PATCH 08/10] declare struct timeval
4+
Subject: [PATCH 08/11] declare struct timeval
55

66
Otherwise, build will fail due to redefinition of _PyTime_FromTimeval
7+
8+
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
79
---
810
Include/internal/pycore_time.h | 2 --
911
1 file changed, 2 deletions(-)

0 commit comments

Comments
 (0)