From f8369e867bcb6ff44d2ee12fc79070b869d41abd Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 29 Jun 2007 01:01:24 +0000 Subject: Attach format attributes to declarations of various message-formatting routines under gcc. In a couple of routines, hard-code the preference for using the vsnprintf paths instead of list-of-int-arguments hacks now that we're assuming vsnprintf is available in other places. Installed headers affected: com_err.h (com_err, com_err_va) ss.h (ss_error) krb5.h (krb5_set_error_message, krb5_vset_error_message) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19653 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/adm_proto.h | 8 ++++++-- src/include/k5-err.h | 14 +++++++++++--- src/include/krb5/krb5.hin | 14 +++++++++++--- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src/include') diff --git a/src/include/adm_proto.h b/src/include/adm_proto.h index f2bd465f7..04e6a4791 100644 --- a/src/include/adm_proto.h +++ b/src/include/adm_proto.h @@ -1,7 +1,7 @@ /* * include/krb5/adm_proto.h * - * Copyright 1995 by the Massachusetts Institute of Technology. + * Copyright 1995, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -62,7 +62,11 @@ krb5_error_code krb5_klog_init char *, krb5_boolean); void krb5_klog_close (krb5_context); -int krb5_klog_syslog (int, const char *, ...); +int krb5_klog_syslog (int, const char *, ...) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 2, 3))) +#endif + ; void krb5_klog_reopen (krb5_context); /* alt_prof.c */ diff --git a/src/include/k5-err.h b/src/include/k5-err.h index c2cc52cee..a6dedcc88 100644 --- a/src/include/k5-err.h +++ b/src/include/k5-err.h @@ -1,7 +1,7 @@ /* * include/k5-err.h * - * Copyright 2006 Massachusetts Institute of Technology. + * Copyright 2006, 2007 Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -53,10 +53,18 @@ struct errinfo { void krb5int_set_error (struct errinfo *ep, long code, - const char *fmt, ...); + const char *fmt, ...) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 3, 4))) +#endif + ; void krb5int_vset_error (struct errinfo *ep, long code, - const char *fmt, va_list args); + const char *fmt, va_list args) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 3, 0))) +#endif + ; const char * krb5int_get_error (struct errinfo *ep, long code); void diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index cfaa90493..88154f885 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -1,7 +1,7 @@ /* -*- c -*- * include/krb5.h * - * Copyright 1989,1990,1995,2001, 2003 by the Massachusetts Institute of Technology. + * Copyright 1989,1990,1995,2001, 2003, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -2264,9 +2264,17 @@ krb5_prompt_type* KRB5_CALLCONV krb5_get_prompt_types /* Error reporting */ void KRB5_CALLCONV_C -krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...); +krb5_set_error_message (krb5_context, krb5_error_code, const char *, ...) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 3, 4))) +#endif + ; void KRB5_CALLCONV -krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list); +krb5_vset_error_message (krb5_context, krb5_error_code, const char *, va_list) +#if !defined(__cplusplus) && (__GNUC__ > 2) + __attribute__((__format__(__printf__, 3, 0))) +#endif + ; /* * The behavior of krb5_get_error_message is only defined the first * time it is called after a failed call to a krb5 function using the -- cgit