diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2001-10-23 02:21:22 +0000 |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2001-10-23 02:21:22 +0000 |
commit | 98a34806725799f67165ea072f3681b324bb0261 (patch) | |
tree | d5f7d7814bcde83e9e0ca79c4e45f5a5c4836b17 /Include | |
parent | 43c23d4d36a558c55d12a0f7b349322fae3e4957 (diff) | |
download | cpython-98a34806725799f67165ea072f3681b324bb0261.tar.gz |
Add function attributes that allow GCC to check the arguments of printf-like
functions.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pgenheaders.h | 6 | ||||
-rw-r--r-- | Include/pyerrors.h | 9 | ||||
-rw-r--r-- | Include/stringobject.h | 6 | ||||
-rw-r--r-- | Include/sysmodule.h | 6 |
4 files changed, 18 insertions, 9 deletions
diff --git a/Include/pgenheaders.h b/Include/pgenheaders.h index 20ac2c7be9..051173cc5e 100644 --- a/Include/pgenheaders.h +++ b/Include/pgenheaders.h @@ -25,8 +25,10 @@ extern "C" { #include "pydebug.h" -DL_IMPORT(void) PySys_WriteStdout(const char *format, ...); -DL_IMPORT(void) PySys_WriteStderr(const char *format, ...); +DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) + __attribute__((format(printf, 1, 2))); +DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) + __attribute__((format(printf, 1, 2))); #define addarc _Py_addarc #define addbit _Py_addbit diff --git a/Include/pyerrors.h b/Include/pyerrors.h index c3960b7e59..29ee1b6b00 100644 --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -77,7 +77,8 @@ extern DL_IMPORT(int) PyErr_BadArgument(void); extern DL_IMPORT(PyObject *) PyErr_NoMemory(void); extern DL_IMPORT(PyObject *) PyErr_SetFromErrno(PyObject *); extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); -extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...); +extern DL_IMPORT(PyObject *) PyErr_Format(PyObject *, const char *, ...) + __attribute__((format(printf, 2, 3))); #ifdef MS_WINDOWS extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *); extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int); @@ -126,8 +127,10 @@ extern DL_IMPORT(PyObject *) PyErr_ProgramText(char *, int); #ifndef HAVE_SNPRINTF #include <stdarg.h> -extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...); -extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va); +extern DL_IMPORT(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) + __attribute__((format(printf, 3, 4))); +extern DL_IMPORT(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) + __attribute__((format(printf, 3, 0))); #else # define PyOS_vsnprintf vsnprintf # define PyOS_snprintf snprintf diff --git a/Include/stringobject.h b/Include/stringobject.h index 052eacf85e..a5d97fa891 100644 --- a/Include/stringobject.h +++ b/Include/stringobject.h @@ -56,8 +56,10 @@ extern DL_IMPORT(PyTypeObject) PyString_Type; extern DL_IMPORT(PyObject *) PyString_FromStringAndSize(const char *, int); extern DL_IMPORT(PyObject *) PyString_FromString(const char *); -extern DL_IMPORT(PyObject *) PyString_FromFormatV(const char*, va_list); -extern DL_IMPORT(PyObject *) PyString_FromFormat(const char*, ...); +extern DL_IMPORT(PyObject *) PyString_FromFormatV(const char*, va_list) + __attribute__((format(printf, 1, 0))); +extern DL_IMPORT(PyObject *) PyString_FromFormat(const char*, ...) + __attribute__((format(printf, 1, 2))); extern DL_IMPORT(int) PyString_Size(PyObject *); extern DL_IMPORT(char *) PyString_AsString(PyObject *); extern DL_IMPORT(void) PyString_Concat(PyObject **, PyObject *); diff --git a/Include/sysmodule.h b/Include/sysmodule.h index 92f2207be3..ca6b6d7898 100644 --- a/Include/sysmodule.h +++ b/Include/sysmodule.h @@ -13,8 +13,10 @@ DL_IMPORT(FILE *) PySys_GetFile(char *, FILE *); DL_IMPORT(void) PySys_SetArgv(int, char **); DL_IMPORT(void) PySys_SetPath(char *); -DL_IMPORT(void) PySys_WriteStdout(const char *format, ...); -DL_IMPORT(void) PySys_WriteStderr(const char *format, ...); +DL_IMPORT(void) PySys_WriteStdout(const char *format, ...) + __attribute__((format(printf, 1, 2))); +DL_IMPORT(void) PySys_WriteStderr(const char *format, ...) + __attribute__((format(printf, 1, 2))); extern DL_IMPORT(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; extern DL_IMPORT(int) _PySys_CheckInterval; |