Skip to content

Commit 42b7985

Browse files
Alexpuxlazka
authored andcommitted
use gnu_printf in format
Co-authored-by: Алексей <[email protected]>
1 parent fc0ffcc commit 42b7985

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Include/bytesobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
3535
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
3636
PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
3737
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
38-
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
38+
Py_PRINTF(1, 0);
3939
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
40-
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
40+
Py_PRINTF(1, 2);
4141
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
4242
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
4343
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);

Include/pyerrors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
315315
);
316316

317317
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
318-
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
318+
Py_PRINTF(3, 4);
319319
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
320-
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
320+
Py_PRINTF(3, 0);
321321

322322
#ifndef Py_LIMITED_API
323323
# define Py_CPYTHON_ERRORS_H

Include/pyport.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@ extern char * _getpty(int *, int, mode_t, int);
658658

659659
#define Py_VA_COPY va_copy
660660

661+
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4)
662+
# define Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(gnu_printf,X,Y)))
663+
#else
664+
# define Py_PRINTF(X,Y) Py_GCC_ATTRIBUTE((format(printf,X,Y)))
665+
#endif
666+
661667
/*
662668
* Convenient macros to deal with endianness of the platform. WORDS_BIGENDIAN is
663669
* detected by configure and defined in pyconfig.h. The code in pyconfig.h

Include/sysmodule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int);
1515
Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetPath(const wchar_t *);
1616

1717
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
18-
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
18+
Py_PRINTF(1, 2);
1919
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
20-
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
20+
Py_PRINTF(1, 2);
2121
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
2222
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
2323

0 commit comments

Comments
 (0)