this backports d8414ad184/mingw-w64-python/0050-use-gnu_printf-in-format.patch
from our Python 3 package, to use printf instead of gnu_printf which clang doesn't support.
as pointed out here: https://github.com/mesonbuild/meson/pull/11530#issuecomment-1532351609
..and some more clang build fixes
81 lines
3.3 KiB
Diff
81 lines
3.3 KiB
Diff
--- Python-2.7.18/Include/pgenheaders.h.orig 2020-04-19 23:13:39.000000000 +0200
|
|
+++ Python-2.7.18/Include/pgenheaders.h 2023-07-01 19:55:50.342406900 +0200
|
|
@@ -10,9 +10,9 @@
|
|
#include "Python.h"
|
|
|
|
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
+ _Py_PRINTF(1, 2);
|
|
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
+ _Py_PRINTF(1, 2);
|
|
|
|
#define addarc _Py_addarc
|
|
#define addbit _Py_addbit
|
|
--- Python-2.7.18/Include/pyerrors.h.orig 2020-04-19 23:13:39.000000000 +0200
|
|
+++ Python-2.7.18/Include/pyerrors.h 2023-07-01 19:56:22.135734100 +0200
|
|
@@ -194,7 +194,7 @@
|
|
#endif /* MS_WINDOWS */
|
|
|
|
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
|
|
+ _Py_PRINTF(2, 3);
|
|
|
|
#ifdef MS_WINDOWS
|
|
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
|
|
@@ -319,9 +319,9 @@
|
|
|
|
#include <stdarg.h>
|
|
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
|
|
+ _Py_PRINTF(3, 4);
|
|
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
|
|
+ _Py_PRINTF(3, 0);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
--- Python-2.7.18/Include/stringobject.h.orig 2020-04-19 23:13:39.000000000 +0200
|
|
+++ Python-2.7.18/Include/stringobject.h 2023-07-01 19:56:34.308925100 +0200
|
|
@@ -62,9 +62,9 @@
|
|
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
|
|
PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
|
|
PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
|
+ _Py_PRINTF(1, 0);
|
|
PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
+ _Py_PRINTF(1, 2);
|
|
PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *);
|
|
PyAPI_FUNC(char *) PyString_AsString(PyObject *);
|
|
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int);
|
|
--- Python-2.7.18/Include/sysmodule.h.orig 2020-04-19 23:13:39.000000000 +0200
|
|
+++ Python-2.7.18/Include/sysmodule.h 2023-07-01 19:56:45.175041900 +0200
|
|
@@ -15,9 +15,9 @@
|
|
PyAPI_FUNC(void) PySys_SetPath(char *);
|
|
|
|
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
+ _Py_PRINTF(1, 2);
|
|
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
|
|
- Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
|
+ _Py_PRINTF(1, 2);
|
|
|
|
PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
|
|
PyAPI_FUNC(void) PySys_AddWarnOption(char *);
|
|
--- Python-2.7.18/Include/pyport.h.orig 2023-07-01 19:50:28.099134800 +0200
|
|
+++ Python-2.7.18/Include/pyport.h 2023-07-01 19:54:47.961648000 +0200
|
|
@@ -671,6 +675,12 @@
|
|
extern char * _getpty(int *, int, mode_t, int);
|
|
#endif
|
|
|
|
+#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
|
|
+# define _Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(gnu_printf,X,Y)))
|
|
+#else
|
|
+# define _Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(printf,X,Y)))
|
|
+#endif
|
|
+
|
|
/* On QNX 6, struct termio must be declared by including sys/termio.h
|
|
if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must
|
|
be included before termios.h or it will generate an error. */
|