summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-21 02:00:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:03 -0500
commitf415ba5bcfdbf22571526ce4e5e103d1eebab5c5 (patch)
tree025b870f2840bc434b3683e1251f39ba2c63cbff
parent9f43d96e3f64b9354cd2cc1685fab254f811eedf (diff)
downloadsamba-f415ba5bcfdbf22571526ce4e5e103d1eebab5c5.tar.gz
samba-f415ba5bcfdbf22571526ce4e5e103d1eebab5c5.tar.bz2
samba-f415ba5bcfdbf22571526ce4e5e103d1eebab5c5.zip
r25267: Move PRINTF_ATTRIBUTE to lib/util as well.
(This used to be commit 72b9d6c03661d72e83a5d60d43b75bb9bd5f5285)
-rw-r--r--source4/include/includes.h19
-rw-r--r--source4/lib/util/attr.h12
-rw-r--r--source4/lib/util/util.h12
3 files changed, 21 insertions, 22 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h
index b93a3faf29..d78f297aa6 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -32,30 +32,17 @@
#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"
diff --git a/source4/lib/util/attr.h b/source4/lib/util/attr.h
index 1357d902af..8f6c4f5d8a 100644
--- a/source4/lib/util/attr.h
+++ b/source4/lib/util/attr.h
@@ -77,4 +77,16 @@
#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__ */
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index b37812602f..68bf326d87 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -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 */