summaryrefslogtreecommitdiffstats
path: root/Include/pyerrors.h
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-10-23 02:21:22 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-10-23 02:21:22 (GMT)
commit90b689076a6dcb55dcac6c5efbc9e4aa793e6c72 (patch)
tree0d673dc58dec42d1fde0a7d2de01af8f3c3ac100 /Include/pyerrors.h
parent156910851e31d4e7f8d1441a3b05a44b31349adf (diff)
downloadcpython-90b689076a6dcb55dcac6c5efbc9e4aa793e6c72.zip
cpython-90b689076a6dcb55dcac6c5efbc9e4aa793e6c72.tar.gz
cpython-90b689076a6dcb55dcac6c5efbc9e4aa793e6c72.tar.bz2
Add function attributes that allow GCC to check the arguments of printf-like
functions.
Diffstat (limited to 'Include/pyerrors.h')
-rw-r--r--Include/pyerrors.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index c3960b7..29ee1b6 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