[dovecot-cvs] dovecot/src/lib failures.c, 1.28, 1.29 failures.h, 1.9, 1.10 imem.h, 1.11, 1.12 macros.h, 1.16, 1.17 str.h, 1.9, 1.10 strfuncs.h, 1.29, 1.30

tss at dovecot.org tss at dovecot.org
Wed Nov 1 18:47:40 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv5762

Modified Files:
	failures.c failures.h imem.h macros.h str.h strfuncs.h 
Log Message:
Added sentinel GCC attribute to *_strconcat() functions. Added
format printf-attribute to vprintf-type functions.



Index: failures.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- failures.c	2 Jul 2006 13:47:01 -0000	1.28
+++ failures.c	1 Nov 2006 18:47:37 -0000	1.29
@@ -12,13 +12,16 @@
 #include <time.h>
 
 static void default_panic_handler(const char *format, va_list args)
-	__attr_noreturn__;
+	__attr_noreturn__ __attr_format__(1, 0);
 static void default_fatal_handler(int status, const char *format, va_list args)
-	__attr_noreturn__;
+	__attr_noreturn__ __attr_format__(2, 0);
 
-static void default_error_handler(const char *format, va_list args);
-static void default_warning_handler(const char *format, va_list args);
-static void default_info_handler(const char *format, va_list args);
+static void default_error_handler(const char *format, va_list args)
+	__attr_format__(1, 0);
+static void default_warning_handler(const char *format, va_list args)
+	__attr_format__(1, 0);
+static void default_info_handler(const char *format, va_list args)
+	__attr_format__(1, 0);
 
 /* Initialize working defaults */
 static failure_callback_t *panic_handler __attr_noreturn__ =

Index: failures.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/failures.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- failures.h	10 May 2004 16:05:10 -0000	1.9
+++ failures.h	1 Nov 2006 18:47:37 -0000	1.10
@@ -34,12 +34,16 @@
 void i_set_info_handler(failure_callback_t *callback);
 
 /* Send failures to syslog() */
-void i_syslog_panic_handler(const char *fmt, va_list args) __attr_noreturn__;
+void i_syslog_panic_handler(const char *fmt, va_list args)
+	__attr_noreturn__ __attr_format__(1, 0);
 void i_syslog_fatal_handler(int status, const char *fmt, va_list args)
-	__attr_noreturn__;
-void i_syslog_error_handler(const char *fmt, va_list args);
-void i_syslog_warning_handler(const char *fmt, va_list args);
-void i_syslog_info_handler(const char *fmt, va_list args);
+	__attr_noreturn__ __attr_format__(2, 0);
+void i_syslog_error_handler(const char *fmt, va_list args)
+	__attr_format__(1, 0);
+void i_syslog_warning_handler(const char *fmt, va_list args)
+	__attr_format__(1, 0);
+void i_syslog_info_handler(const char *fmt, va_list args)
+	__attr_format__(1, 0);
 
 /* Open syslog and set failure/info handlers to use it. */
 void i_set_failure_syslog(const char *ident, int options, int facility);

Index: imem.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/imem.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- imem.h	8 Oct 2006 13:28:56 -0000	1.11
+++ imem.h	1 Nov 2006 18:47:37 -0000	1.12
@@ -19,9 +19,9 @@
 char *i_strdup_until(const void *str, const void *end); /* *end isn't included */
 char *i_strndup(const void *str, size_t max_chars);
 char *i_strdup_printf(const char *format, ...) __attr_format__(1, 2);
-char *i_strdup_vprintf(const char *format, va_list args);
+char *i_strdup_vprintf(const char *format, va_list args) __attr_format__(1, 0);
 
-char *i_strconcat(const char *str1, ...); /* NULL terminated */
+char *i_strconcat(const char *str1, ...)  __attr_sentinel__;
 
 void imem_init(void);
 

Index: macros.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/macros.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- macros.h	16 Oct 2004 14:59:32 -0000	1.16
+++ macros.h	1 Nov 2006 18:47:38 -0000	1.17
@@ -102,6 +102,12 @@
 #  define __attr_unused__ __attribute__((unused))
 #  define __attr_noreturn__ __attribute__((noreturn))
 #  define __attr_const__ __attribute__((const))
+#  if __GNUC__ > 3
+/* GCC 4.0 and later */
+#    define __attr_sentinel__ __attribute__((sentinel))
+#  else
+#    define __attr_sentinel__
+#  endif
 #else
 #  define __attr_format__(format_idx, arg_idx)
 #  define __attr_format_arg__(arg_idx)
@@ -109,6 +115,7 @@
 #  define __attr_noreturn__
 #  define __attr_const__
 #  define __attr_unused__
+#  define __attr_sentinel__
 #endif
 
 /* C99-style struct member definitions */

Index: str.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/str.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- str.h	28 Jun 2006 13:10:33 -0000	1.9
+++ str.h	1 Nov 2006 18:47:38 -0000	1.10
@@ -20,7 +20,8 @@
 /* Append printf()-like data */
 void str_printfa(string_t *str, const char *fmt, ...)
 	__attr_format__(2, 3);
-void str_vprintfa(string_t *str, const char *fmt, va_list args);
+void str_vprintfa(string_t *str, const char *fmt, va_list args)
+	__attr_format__(2, 0);
 
 void str_insert(string_t *str, size_t pos, const char *cstr);
 void str_delete(string_t *str, size_t pos, size_t len);

Index: strfuncs.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/strfuncs.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- strfuncs.h	12 Jun 2006 08:36:51 -0000	1.29
+++ strfuncs.h	1 Nov 2006 18:47:38 -0000	1.30
@@ -18,8 +18,9 @@
 char *p_strndup(pool_t pool, const void *str, size_t max_chars);
 char *p_strdup_printf(pool_t pool, const char *format, ...)
 	__attr_format__(2, 3);
-char *p_strdup_vprintf(pool_t pool, const char *format, va_list args);
-char *p_strconcat(pool_t pool, const char *str1, ...); /* NULL terminated */
+char *p_strdup_vprintf(pool_t pool, const char *format, va_list args)
+	__attr_format__(2, 0);
+char *p_strconcat(pool_t pool, const char *str1, ...) __attr_sentinel__;
 
 /* same with temporary memory allocations: */
 const char *t_strdup(const char *str);
@@ -28,8 +29,9 @@
 const char *t_strdup_until(const void *start, const void *end); /* *end isn't included */
 const char *t_strndup(const void *str, size_t max_chars);
 const char *t_strdup_printf(const char *format, ...) __attr_format__(1, 2);
-const char *t_strdup_vprintf(const char *format, va_list args);
-const char *t_strconcat(const char *str1, ...); /* NULL terminated */
+const char *t_strdup_vprintf(const char *format, va_list args)
+	__attr_format__(1, 0);
+const char *t_strconcat(const char *str1, ...) __attr_sentinel__;
 
 /* Like t_strdup(), but stop at cutchar. */
 const char *t_strcut(const char *str, char cutchar);



More information about the dovecot-cvs mailing list