r25267: Move PRINTF_ATTRIBUTE to lib/util as well.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 21 Sep 2007 02:00:50 +0000 (02:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:07:03 +0000 (15:07 -0500)
source/include/includes.h
source/lib/util/attr.h
source/lib/util/util.h

index b93a3faf2945f155da5da41738c57069dd8cc09c..d78f297aa639c119ff61f5a017d62bae6b619eef 100644 (file)
 
 #include "local.h"
 
-#ifndef PRINTF_ATTRIBUTE
-#if __GNUC__ >= 3
-/** Use gcc attribute to check printf fns.  a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
 #include "system/time.h"
 #include "system/wait.h"
 
-#ifndef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
-#endif
-
 /* Lists, trees, caching, database... */
 #include <stdlib.h>
 #include <stdbool.h>
 #include <talloc.h>
 #include "libcli/util/nt_status.h"
+#ifndef _PRINTF_ATTRIBUTE
+#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
+#endif
 #include "charset/charset.h"
 #include "util/util.h"
 #include "librpc/gen_ndr/misc.h"
index 1357d902af22228abca79b3f7ece2149abebf2df..8f6c4f5d8acce1f0537647129c7696dcc1177602 100644 (file)
 #endif
 #endif
 
+#ifndef PRINTF_ATTRIBUTE
+#if __GNUC__ >= 3
+/** Use gcc attribute to check printf fns.  a1 is the 1-based index of
+ * the parameter containing the format, and a2 the index of the first
+ * argument. Note that some gcc 2.x versions don't handle this
+ * properly **/
+#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
+#else
+#define PRINTF_ATTRIBUTE(a1, a2)
+#endif
+#endif
+
 #endif /* __UTIL_ATTR_H__ */
index b37812602f42690497a8b5a8655ae423c738d865..68bf326d87e1bb0dcf555103ee70d71f684e367e 100644 (file)
@@ -165,7 +165,7 @@ _PUBLIC_ void do_debug_header(int level, const char *location, const char *func)
   @note You should never have to call this function directly. Call the DEBUG()
   macro instead.
 */
-_PUBLIC_ void do_debug(const char *format, ...) _PRINTF_ATTRIBUTE(1,2);
+_PUBLIC_ void do_debug(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
 
 /**
   reopen the log file (usually called because the log file name might have changed)
@@ -313,9 +313,9 @@ _PUBLIC_ char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len);
 
 /* The following definitions come from lib/util/dprintf.c  */
 
-_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0);
-_PUBLIC_ int d_fprintf(FILE *f, const char *format, ...) _PRINTF_ATTRIBUTE(2,3);
-_PUBLIC_ int d_printf(const char *format, ...) _PRINTF_ATTRIBUTE(1,2);
+_PUBLIC_ int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
+_PUBLIC_ int d_fprintf(FILE *f, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
+_PUBLIC_ int d_printf(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
 _PUBLIC_ void display_set_stderr(void);
 
 /* The following definitions come from lib/util/util_str.c  */
@@ -604,8 +604,8 @@ _PUBLIC_ void file_lines_slashcont(char **lines);
   save a lump of data into a file. Mostly used for debugging 
 */
 _PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length);
-_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0);
-_PUBLIC_ int fdprintf(int fd, const char *format, ...) _PRINTF_ATTRIBUTE(2,3);
+_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
+_PUBLIC_ int fdprintf(int fd, const char *format, ...) PRINTF_ATTRIBUTE(2,3);
 _PUBLIC_ bool large_file_support(const char *path);
 
 /* The following definitions come from lib/util/util.c  */