mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-16 22:38:41 +08:00
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.
This commit is contained in:

committed by
Xiang Xiao

parent
1f8b9aa74c
commit
d7ed69200f
@@ -43,6 +43,18 @@ TARGETLIBPYTHON=$(TARGETINSTALL)/libpython$(CPYTHON_VERSION_MINOR).a
|
||||
TARGETMODULESPACK=$(TARGETBUILD)/lib/python$(shell echo $(CPYTHON_VERSION_MINOR) | tr -d .).zip
|
||||
TARGETMODULES=$(TARGETINSTALL)/lib/
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Test
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include$(DELIM)internal
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system$(DELIM)zlib$(DELIM)zlib
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TARGETBUILD)
|
||||
CFLAGS += -Wno-shadow -Wno-undef -Wno-format -Wno-builtin-macro-redefined
|
||||
CFLAGS += -Wno-type-limits -Wno-implicit-fallthrough -Wno-char-subscripts
|
||||
CFLAGS += -Wno-sign-compare -Wno-unused-const-variable -Wno-unused-function
|
||||
CFLAGS += -Wno-unused-variable -Wno-overflow -Wno-unused-but-set-variable
|
||||
CFLAGS += -Wno-strict-prototypes
|
||||
|
||||
DEPPATH += --dep-path $(CPYTHON_UNPACKNAME)$(DELIM)Programs
|
||||
VPATH += :$(CPYTHON_UNPACKNAME)$(DELIM)Programs
|
||||
|
||||
@@ -65,6 +77,7 @@ $(CPYTHON_UNPACKNAME): $(CPYTHON_ZIP)
|
||||
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0008-declare-struct-timeval.patch
|
||||
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0009-include-nuttx-sys-select-header-to-define-FD_SETSIZE.patch
|
||||
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0010-check-for-the-d_ino-member-of-the-structure-dirent.patch
|
||||
$(Q) patch -p1 -d $(CPYTHON_UNPACKNAME) < patch$(DELIM)0011-avoid-redefinition-warning-if-UNUSED-is-already-defi.patch
|
||||
|
||||
$(HOSTPYTHON):
|
||||
mkdir -p $(HOSTBUILD)
|
||||
@@ -123,13 +136,6 @@ $(TARGETLIBPYTHON): $(TARGETBUILD)/Makefile
|
||||
$(Q) ( cp $(TARGETBUILD)/libpython$(CPYTHON_VERSION_MINOR).a $(TARGETLIBPYTHON) )
|
||||
$(Q) $(UNPACK) $(TARGETMODULESPACK) -d $(TARGETMODULES)/python$(CPYTHON_VERSION_MINOR)
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Test
|
||||
CFLAGS += ${INCDIR_PREFIX}$(CPYTHON_PATH)$(DELIM)Include$(DELIM)internal
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)$(DELIM)system$(DELIM)zlib$(DELIM)zlib
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TARGETBUILD)
|
||||
|
||||
MODULE = $(CONFIG_INTERPRETER_CPYTHON)
|
||||
|
||||
PROGNAME += $(CONFIG_INTERPRETER_CPYTHON_PROGNAME)
|
||||
|
@@ -18,4 +18,5 @@ export ac_cv_func_clock="yes"
|
||||
export ac_cv_func_fork="yes"
|
||||
export ac_cv_func_waitpid="yes"
|
||||
export ac_cv_func_pipe="yes"
|
||||
export ac_cv_enable_strict_prototypes_warning="no"
|
||||
export MODULE_BUILDTYPE="static"
|
||||
|
@@ -1,12 +1,14 @@
|
||||
From b2ac42cefa3747c7f7a9066fceed834286e829af Mon Sep 17 00:00:00 2001
|
||||
From 3917fd37644948096c6bebf53e701b59fa527cf5 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Grokhotkov <ivan@espressif.com>
|
||||
Date: Tue, 22 Oct 2024 23:58:17 +0200
|
||||
Subject: [PATCH 01/10] workaround newlib resource.h limitations
|
||||
Subject: [PATCH 01/11] workaround newlib resource.h limitations
|
||||
|
||||
configure script checks if resource.h is available but doesn't check
|
||||
if it defines all the necessary functions.
|
||||
|
||||
Temporary workaround until these functions are added to IDF.
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/faulthandler.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
@@ -1,12 +1,14 @@
|
||||
From 036b39478c2419af1e0a64763b9ac741cf886387 Mon Sep 17 00:00:00 2001
|
||||
From 562138b0486ad050b5ce601d434910973ff6f094 Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Grokhotkov <ivan@espressif.com>
|
||||
Date: Wed, 23 Oct 2024 16:48:49 +0200
|
||||
Subject: [PATCH 02/10] fix various uint32_t/'unsigned int' type mismatch
|
||||
Subject: [PATCH 02/11] fix various uint32_t/'unsigned int' type mismatch
|
||||
issues
|
||||
|
||||
In a few places existing code assumes that uint32_t == unsigned int.
|
||||
Since in Xtensa and RISC-V bare metal toolchains uint32_t is instead
|
||||
'unsigned long', the original code fails to build.
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/zlibmodule.c | 28 ++++++++++++++--------------
|
||||
Objects/typeobject.c | 2 +-
|
||||
|
@@ -1,7 +1,7 @@
|
||||
From 4af7a9b726ca2c8ac330b51f98acf0a103f6fa71 Mon Sep 17 00:00:00 2001
|
||||
From dcc6b2b6aa396f96e7c9efe3e793d96c7004ef4f Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Grokhotkov <ivan@espressif.com>
|
||||
Date: Wed, 23 Oct 2024 16:54:39 +0200
|
||||
Subject: [PATCH 03/10] reuse wasm_assets.py for generating an archive of
|
||||
Subject: [PATCH 03/11] reuse wasm_assets.py for generating an archive of
|
||||
python lib dir
|
||||
|
||||
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
|
||||
as fixes what I think is a bug in path calculation.
|
||||
|
||||
Co-authored-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Tools/wasm/wasm_assets.py | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
@@ -1,13 +1,14 @@
|
||||
From 1bb8d824a4b4e4b38c3541b7c26c5d71f0970266 Mon Sep 17 00:00:00 2001
|
||||
From ff067ccb26c91de352de362a25d87bcbabe924dc Mon Sep 17 00:00:00 2001
|
||||
From: Ivan Grokhotkov <ivan@espressif.com>
|
||||
Date: Wed, 23 Oct 2024 16:55:53 +0200
|
||||
Subject: [PATCH 04/10] recognize *-*-nuttx as a supported OS
|
||||
Subject: [PATCH 04/11] recognize *-*-nuttx as a supported OS
|
||||
|
||||
cpython's configure script bails out when cross-compiling for an
|
||||
unknown OS, so we have to add "nuttx" to the list, even though it
|
||||
is not used almost anywhere else.
|
||||
|
||||
Co-authored-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
config.sub | 2 +-
|
||||
configure | 3 +++
|
||||
|
@@ -1,13 +1,14 @@
|
||||
From cd8af3cbc9881e5a4a7c0644c8844478c8d0245d Mon Sep 17 00:00:00 2001
|
||||
From 7e646549488f2d3de4cf1e04ad975625342a9218 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Snow <ericsnowcurrently@gmail.com>
|
||||
Date: Tue, 13 Aug 2024 14:44:57 -0600
|
||||
Subject: [PATCH 05/10] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
|
||||
Subject: [PATCH 05/11] gh-122907: Fix Builds Without HAVE_DYNAMIC_LOADING Set
|
||||
(gh-122952)
|
||||
|
||||
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.
|
||||
(cherry picked from commit ee1b8ce26e700350e47a5f65201097121c41912e)
|
||||
|
||||
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Include/internal/pycore_importdl.h | 4 ++++
|
||||
Lib/importlib/_bootstrap_external.py | 16 ++++++++--------
|
||||
|
@@ -1,9 +1,10 @@
|
||||
From d424766bff74fb34a80a09c6e2ed8d9b40350bb8 Mon Sep 17 00:00:00 2001
|
||||
From 82a3c7c021324e4245289c565b2d379b83ed4be3 Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Wed, 13 Nov 2024 14:20:36 -0300
|
||||
Subject: [PATCH 06/10] change var name to avoid conflict with nuttx
|
||||
Subject: [PATCH 06/11] change var name to avoid conflict with nuttx
|
||||
unused_data macro
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/zlibmodule.c | 42 +++++++++++++++++++++---------------------
|
||||
1 file changed, 21 insertions(+), 21 deletions(-)
|
||||
|
@@ -1,10 +1,12 @@
|
||||
From 1b802bfd159a6a9766ca5834af90f55d54285b4b Mon Sep 17 00:00:00 2001
|
||||
From 7eab2315d75d5e78e67e0b049ebb2fc71914b7ea Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Wed, 13 Nov 2024 14:22:04 -0300
|
||||
Subject: [PATCH 07/10] undef atexit_register
|
||||
Subject: [PATCH 07/11] undef atexit_register
|
||||
|
||||
Even if not built, nuttx/include/nuttx/atexit.h defines it and this
|
||||
causes conflicts.
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/atexitmodule.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
@@ -1,9 +1,11 @@
|
||||
From b40e89c190ec7c6b3b0116a3f7025ab13854398f Mon Sep 17 00:00:00 2001
|
||||
From fc042cfa496f37f2a859495ad281583f79af0044 Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Wed, 13 Nov 2024 14:23:34 -0300
|
||||
Subject: [PATCH 08/10] declare struct timeval
|
||||
Subject: [PATCH 08/11] declare struct timeval
|
||||
|
||||
Otherwise, build will fail due to redefinition of _PyTime_FromTimeval
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Include/internal/pycore_time.h | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
@@ -1,8 +1,9 @@
|
||||
From 9a32a300c95e0061220d2608a014c7fa39dedab3 Mon Sep 17 00:00:00 2001
|
||||
From 3d140751ebec3aedd8ed3cdf2a7eff5009693112 Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Thu, 14 Nov 2024 13:44:49 -0300
|
||||
Subject: [PATCH 09/10] include nuttx sys/select header to define FD_SETSIZE
|
||||
Subject: [PATCH 09/11] include nuttx sys/select header to define FD_SETSIZE
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/selectmodule.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
@@ -1,15 +1,37 @@
|
||||
From 4f6a1db85c56df378dc3856ed95a0a7342f44d89 Mon Sep 17 00:00:00 2001
|
||||
From 4191bf1e4505776efa0780ebc4fc5195a6ce79d3 Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Tue, 3 Dec 2024 17:18:50 -0300
|
||||
Subject: [PATCH 10/10] check for the d_ino member of the structure dirent
|
||||
Subject: [PATCH 10/11] check for the d_ino member of the structure dirent
|
||||
|
||||
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
---
|
||||
Modules/posixmodule.c | 18 ++++++++++++++++--
|
||||
configure | 43 +++++++++++++++++++++++++++++++++++++++++++
|
||||
configure.ac | 5 +++++
|
||||
Modules/clinic/posixmodule.c.h | 2 ++
|
||||
Modules/posixmodule.c | 18 ++++++++++++--
|
||||
configure | 43 ++++++++++++++++++++++++++++++++++
|
||||
configure.ac | 5 ++++
|
||||
pyconfig.h.in | 3 +++
|
||||
4 files changed, 67 insertions(+), 2 deletions(-)
|
||||
5 files changed, 69 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
|
||||
index 14a6efb9ac9..6e716f77db8 100644
|
||||
--- a/Modules/clinic/posixmodule.c.h
|
||||
+++ b/Modules/clinic/posixmodule.c.h
|
||||
@@ -11652,6 +11652,7 @@ PyDoc_STRVAR(os_DirEntry_inode__doc__,
|
||||
#define OS_DIRENTRY_INODE_METHODDEF \
|
||||
{"inode", (PyCFunction)os_DirEntry_inode, METH_NOARGS, os_DirEntry_inode__doc__},
|
||||
|
||||
+#ifdef HAVE_DIRENT_D_INO
|
||||
static PyObject *
|
||||
os_DirEntry_inode_impl(DirEntry *self);
|
||||
|
||||
@@ -11660,6 +11661,7 @@ os_DirEntry_inode(DirEntry *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return os_DirEntry_inode_impl(self);
|
||||
}
|
||||
+#endif
|
||||
|
||||
PyDoc_STRVAR(os_DirEntry___fspath____doc__,
|
||||
"__fspath__($self, /)\n"
|
||||
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
|
||||
index 51e34b5f4b7..2aa507aa942 100644
|
||||
--- a/Modules/posixmodule.c
|
||||
|
@@ -0,0 +1,26 @@
|
||||
From b82ab44e498a9e9bcdcbbfa1d6161023d8ea8c5b Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Medicci <tiago.medicci@espressif.com>
|
||||
Date: Tue, 10 Dec 2024 12:03:47 -0300
|
||||
Subject: [PATCH 11/11] avoid redefinition warning if UNUSED is already defined
|
||||
|
||||
---
|
||||
Parser/pegen.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/Parser/pegen.h b/Parser/pegen.h
|
||||
index 32c64e7774b..42574456f23 100644
|
||||
--- a/Parser/pegen.h
|
||||
+++ b/Parser/pegen.h
|
||||
@@ -250,7 +250,9 @@ void * _PyPegen_seq_last_item(asdl_seq *seq);
|
||||
#define PyPegen_last_item(seq, type) ((type)_PyPegen_seq_last_item((asdl_seq*)seq))
|
||||
void * _PyPegen_seq_first_item(asdl_seq *seq);
|
||||
#define PyPegen_first_item(seq, type) ((type)_PyPegen_seq_first_item((asdl_seq*)seq))
|
||||
+#ifndef UNUSED
|
||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||
+#endif
|
||||
#define EXTRA_EXPR(head, tail) head->lineno, (head)->col_offset, (tail)->end_lineno, (tail)->end_col_offset, p->arena
|
||||
#define EXTRA _start_lineno, _start_col_offset, _end_lineno, _end_col_offset, p->arena
|
||||
PyObject *_PyPegen_new_type_comment(Parser *, const char *);
|
||||
--
|
||||
2.46.1
|
||||
|
Reference in New Issue
Block a user