Skip to content

Commit 96aa0ac

Browse files
committed
Use Py_GCC_ATTRIBUTE instead of __attribute__. Compilers other than GCC
might use __attribute__ in other ways (e.g. CodeWarrior).
1 parent 7f7c3d0 commit 96aa0ac

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

Include/pgenheaders.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ extern "C" {
1010
#include "Python.h"
1111

1212
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
13-
__attribute__((format(printf, 1, 2)));
13+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
1414
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
15-
__attribute__((format(printf, 1, 2)));
15+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
1616

1717
#define addarc _Py_addarc
1818
#define addbit _Py_addbit

Include/pyerrors.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
8383
PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
8484
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
8585
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
86-
__attribute__((format(printf, 2, 3)));
86+
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
8787
#ifdef MS_WINDOWS
8888
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *);
8989
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
@@ -195,9 +195,9 @@ PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(
195195

196196
#include <stdarg.h>
197197
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...)
198-
__attribute__((format(printf, 3, 4)));
198+
Py_GCC_ATTRIBUTE((format(printf, 3, 4)));
199199
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
200-
__attribute__((format(printf, 3, 0)));
200+
Py_GCC_ATTRIBUTE((format(printf, 3, 0)));
201201

202202
#ifdef __cplusplus
203203
}

Include/pyport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ typedef struct fd_set {
531531
#if (!defined(__GNUC__) || __GNUC__ < 2 || \
532532
(__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \
533533
!defined(RISCOS)
534-
#define __attribute__(__x)
534+
#define Py_GCC_ATTRIBUTE(x)
535+
#else
536+
#define Py_GCC_ATTRIBUTE(x) __attribute__(x)
535537
#endif
536538

537539
#endif /* Py_PYPORT_H */

Include/stringobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ PyAPI_DATA(PyTypeObject) PyString_Type;
5252
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, int);
5353
PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
5454
PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list)
55-
__attribute__((format(printf, 1, 0)));
55+
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
5656
PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
57-
__attribute__((format(printf, 1, 2)));
57+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
5858
PyAPI_FUNC(int) PyString_Size(PyObject *);
5959
PyAPI_FUNC(char *) PyString_AsString(PyObject *);
6060
PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int);

Include/sysmodule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ PyAPI_FUNC(void) PySys_SetArgv(int, char **);
1414
PyAPI_FUNC(void) PySys_SetPath(char *);
1515

1616
PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...)
17-
__attribute__((format(printf, 1, 2)));
17+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
1818
PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
19-
__attribute__((format(printf, 1, 2)));
19+
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
2020

2121
PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc;
2222
PyAPI_DATA(int) _PySys_CheckInterval;

0 commit comments

Comments
 (0)