]> git.ozlabs.org Git - ccan/commitdiff
compiler: shorten names of attributes, add UNUSED
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 9 Nov 2010 22:35:58 +0000 (09:05 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 9 Nov 2010 22:35:58 +0000 (09:05 +1030)
The long names were unwieldy in practice; at risk of clashing, replace
with shorter versions.

21 files changed:
ccan/alloc/alloc.c
ccan/compiler/_info
ccan/compiler/compiler.h
ccan/compiler/test/compile_fail-printf.c
ccan/htable/htable.c
ccan/ilog/ilog.c
ccan/ilog/ilog.h
ccan/iscsi/login.c
ccan/iscsi/scsi-lowlevel.c
ccan/jbitset/jbitset.h
ccan/jmap/jmap.h
ccan/likely/likely.h
ccan/talloc/talloc.c
ccan/talloc/talloc.h
ccan/tap/tap.h
ccan/tdb/open.c
ccan/tdb/tdb.h
ccan/tdb/tools/tdbtorture.c
ccan/tdb2/tdb.c
ccan/tdb2/tdb2.h
ccan/tdb2/tools/tdbtorture.c

index 643efedc85d1be3212e175051e3558def8021545..64475078c0a6811f88b5dcf9861492a117a2ff41 100644 (file)
@@ -527,9 +527,8 @@ static bool huge_allocated(struct header *head, unsigned long offset)
 }
 
 /* They want something really big.  Aim for contiguous pages (slow). */
-static COLD_ATTRIBUTE
-void *huge_alloc(void *pool, unsigned long poolsize,
-                unsigned long size, unsigned long align)
+static COLD void *huge_alloc(void *pool, unsigned long poolsize,
+                            unsigned long size, unsigned long align)
 {
        struct header *head = pool;
        struct huge_alloc *ha;
@@ -647,7 +646,7 @@ done:
        return (char *)pool + ha->off;
 }
 
-static COLD_ATTRIBUTE void
+static COLD void
 huge_free(struct header *head, unsigned long poolsize, void *free)
 {
        unsigned long i, off, pgnum, free_off = (char *)free - (char *)head;
@@ -687,8 +686,7 @@ huge_free(struct header *head, unsigned long poolsize, void *free)
        alloc_free(head, poolsize, ha);
 }
 
-static COLD_ATTRIBUTE unsigned long
-huge_size(struct header *head, void *p)
+static COLD unsigned long huge_size(struct header *head, void *p)
 {
        unsigned long i, off = (char *)p - (char *)head;
        struct huge_alloc *ha;
index 31f6f0c7ce482cadbc6644e0f60af742da23bd37..c55ba22f086c320de70b4c5d21a0b56da825e16f 100644 (file)
@@ -6,16 +6,18 @@
  * compiler - macros for common compiler extensions
  *
  * Abstracts away some compiler hints.  Currently these include:
- * - COLD_ATTRIBUTE
+ * - COLD
  *     For functions not called in fast paths (aka. cold functions)
- * - PRINTF_ATTRIBUTE
+ * - PRINTF_FMT
  *     For functions which take printf-style parameters.
- * - IDEMPOTENT_ATTRIBUTE
+ * - IDEMPOTENT
  *     For functions which return the same value for same parameters.
- * - NEEDED_ATTRIBUTE
+ * - NEEDED
  *     For functions and variables which must be emitted even if unused.
- * - UNNEEDED_ATTRIBUTE
+ * - UNNEEDED
  *     For functions and variables which need not be emitted if unused.
+ * - UNUSED
+ *     For parameters which are not used.
  * - IS_COMPILE_CONSTANT
  *     For using different tradeoffs for compiletime vs runtime evaluation.
  *
@@ -29,7 +31,7 @@
  *
  *     // Example of a (slow-path) logging function.
  *     static int log_threshold = 2;
- *     static void COLD_ATTRIBUTE PRINTF_ATTRIBUTE(2,3)
+ *     static void COLD PRINTF_FMT(2,3)
  *             logger(int level, const char *fmt, ...)
  *     {
  *             va_list ap;
index 49088ac799e6f0ba9772afde55d8a9fdd421f71d..d57d814b3711213c978602cd46c7c6e2e67ccf7d 100644 (file)
 
 #if HAVE_ATTRIBUTE_COLD
 /**
- * COLD_ATTRIBUTE - a function is unlikely to be called.
+ * COLD - a function is unlikely to be called.
  *
  * Used to mark an unlikely code path and optimize appropriately.
  * It is usually used on logging or error routines.
  *
  * Example:
- * static void COLD_ATTRIBUTE moan(const char *reason)
+ * static void COLD moan(const char *reason)
  * {
  *     fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno));
  * }
  */
-#define COLD_ATTRIBUTE __attribute__((cold))
+#define COLD __attribute__((cold))
 #else
-#define COLD_ATTRIBUTE
+#define COLD
 #endif
 
 #if HAVE_ATTRIBUTE_PRINTF
 /**
- * PRINTF_ATTRIBUTE - a function takes printf-style arguments
+ * PRINTF_FMT - a function takes printf-style arguments
  * @nfmt: the 1-based number of the function's format argument.
  * @narg: the 1-based number of the function's first variable argument.
  *
  * This allows the compiler to check your parameters as it does for printf().
  *
  * Example:
- * void PRINTF_ATTRIBUTE(2,3) my_printf(const char *prefix,
- *                                     const char *fmt, ...);
+ * void PRINTF_FMT(2,3) my_printf(const char *prefix, const char *fmt, ...);
  */
-#define PRINTF_ATTRIBUTE(nfmt, narg) \
+#define PRINTF_FMT(nfmt, narg) \
        __attribute__((format(__printf__, nfmt, narg)))
 #else
-#define PRINTF_ATTRIBUTE(nfmt, narg)
+#define PRINTF_FMT(nfmt, narg)
 #endif
 
 #if HAVE_ATTRIBUTE_CONST
 /**
- * IDEMPOTENT_ATTRIBUTE - a function's return depends only on its argument
+ * IDEMPOTENT - a function's return depends only on its argument
  *
  * This allows the compiler to assume that the function will return the exact
  * same value for the exact same arguments.  This implies that the function
  * must not use global variables, or dereference pointer arguments.
  */
-#define IDEMPOTENT_ATTRIBUTE __attribute__((const))
+#define IDEMPOTENT __attribute__((const))
 #else
-#define IDEMPOTENT_ATTRIBUTE
+#define IDEMPOTENT
 #endif
 
 #if HAVE_ATTRIBUTE_UNUSED
 /**
- * UNNEEDED_ATTRIBUTE - a parameter/variable/function may not be needed
+ * UNNEEDED - a variable/function may not be needed
  *
- * This suppresses warnings about unused variables or parameters, but tells
+ * This suppresses warnings about unused variables or functions, but tells
  * the compiler that if it is unused it need not emit it into the source code.
  *
  * Example:
  * // With some preprocessor options, this is unnecessary.
- * static UNNEEDED_ATTRIBUTE int counter;
+ * static UNNEEDED int counter;
  *
  * // With some preprocessor options, this is unnecessary.
- * static UNNEEDED_ATTRIBUTE void add_to_counter(int add)
+ * static UNNEEDED void add_to_counter(int add)
  * {
  *     counter += add;
  * }
  */
-#define UNNEEDED_ATTRIBUTE __attribute__((unused))
+#define UNNEEDED __attribute__((unused))
 
 #if HAVE_ATTRIBUTE_USED
 /**
- * NEEDED_ATTRIBUTE - a parameter/variable/function is needed
+ * NEEDED - a variable/function is needed
  *
- * This suppresses warnings about unused variables or parameters, but tells
+ * This suppresses warnings about unused variables or functions, but tells
  * the compiler that it must exist even if it (seems) unused.
  *
  * Example:
  *     // Even if this is unused, these are vital for debugging.
- *     static UNNEEDED_ATTRIBUTE int counter;
- *     static UNNEEDED_ATTRIBUTE void dump_counter(void)
+ *     static NEEDED int counter;
+ *     static NEEDED void dump_counter(void)
  *     {
  *             printf("Counter is %i\n", counter);
  *     }
  */
-#define NEEDED_ATTRIBUTE __attribute__((used))
+#define NEEDED __attribute__((used))
 #else
 /* Before used, unused functions and vars were always emitted. */
-#define NEEDED_ATTRIBUTE __attribute__((unused))
+#define NEEDED __attribute__((unused))
 #endif
+
+/**
+ * UNUSED - a parameter is unused
+ *
+ * Some compilers (eg. gcc with -W or -Wunused) warn about unused
+ * function parameters.  This suppresses such warnings and indicates
+ * to the reader that it's deliberate.
+ *
+ * Example:
+ *     // This is used as a callback, so needs to have this prototype.
+ *     static int some_callback(void *unused UNUSED)
+ *     {
+ *             return 0;
+ *     }
+ */
+#define UNUSED __attribute__((unused))
 #else
-#define UNNEEDED_ATTRIBUTE
-#define NEEDED_ATTRIBUTE
+#define UNNEEDED
+#define NEEDED
+#define UNUSED
 #endif
 
 #if HAVE_BUILTIN_CONSTANT_P
index 670126bba1b7ee7093e6ee925fe827073be1e533..8f34ae5a1255b25f89aa0ae3424c9c47ef750cee 100644 (file)
@@ -1,6 +1,6 @@
 #include <ccan/compiler/compiler.h>
 
-static void PRINTF_ATTRIBUTE(2,3) my_printf(int x, const char *fmt, ...)
+static void PRINTF_FMT(2,3) my_printf(int x, const char *fmt, ...)
 {
 }
 
index 788e71895b183db45768fd0327572dcf5ccf4fd5..a15c54d7958a6b779c7e3b7c7b951eb360ef0409 100644 (file)
@@ -155,7 +155,7 @@ static void ht_add(struct htable *ht, const void *new, size_t h)
        ht->table[i] = make_hval(ht, new, get_hash_ptr_bits(ht, h)|perfect);
 }
 
-static COLD_ATTRIBUTE bool double_table(struct htable *ht)
+static COLD bool double_table(struct htable *ht)
 {
        unsigned int i;
        size_t oldnum = (size_t)1 << ht->bits;
@@ -192,7 +192,7 @@ static COLD_ATTRIBUTE bool double_table(struct htable *ht)
        return true;
 }
 
-static COLD_ATTRIBUTE void rehash_table(struct htable *ht)
+static COLD void rehash_table(struct htable *ht)
 {
        size_t start, i;
        uintptr_t e;
@@ -217,7 +217,7 @@ static COLD_ATTRIBUTE void rehash_table(struct htable *ht)
 }
 
 /* We stole some bits, now we need to put them back... */
-static COLD_ATTRIBUTE void update_common(struct htable *ht, const void *p)
+static COLD void update_common(struct htable *ht, const void *p)
 {
        unsigned int i;
        uintptr_t maskdiff, bitsdiff;
index 17fc14d23bcb136138e253c474a96f61cee54e62..7030b79a24d292168cbe0b8437aa4affa1ccc57d 100644 (file)
@@ -16,7 +16,7 @@
     year=1998,
     note="\url{http://supertech.csail.mit.edu/papers/debruijn.pdf}"
   }*/
-static UNNEEDED_ATTRIBUTE const unsigned char DEBRUIJN_IDX32[32]={
+static UNNEEDED const unsigned char DEBRUIJN_IDX32[32]={
    0, 1,28, 2,29,14,24, 3,30,22,20,15,25,17, 4, 8,
   31,27,13,23,21,19,16, 7,26,12,18, 6,11, 5,10, 9
 };
index fdb9ebab8d70c427d275d28077f3b7a180f8bbb2..55dd009885a73c488cb41280f64a319e84ed6233 100644 (file)
@@ -24,7 +24,7 @@
  *             return 1U << ilog32(i-1);
  *     }
  */
-int ilog32(uint32_t _v) IDEMPOTENT_ATTRIBUTE;
+int ilog32(uint32_t _v) IDEMPOTENT;
 
 /**
  * ilog32_nz - Integer binary logarithm of a non-zero 32-bit value.
@@ -43,7 +43,7 @@ int ilog32(uint32_t _v) IDEMPOTENT_ATTRIBUTE;
  *             return ilog32_nz(i) - 1;
  *     }
  */
-int ilog32_nz(uint32_t _v) IDEMPOTENT_ATTRIBUTE;
+int ilog32_nz(uint32_t _v) IDEMPOTENT;
 
 /**
  * ilog64 - Integer binary logarithm of a 64-bit value.
@@ -55,7 +55,7 @@ int ilog32_nz(uint32_t _v) IDEMPOTENT_ATTRIBUTE;
  * See Also:
  *     ilog64_nz(), ilog32()
  */
-int ilog64(uint64_t _v) IDEMPOTENT_ATTRIBUTE;
+int ilog64(uint64_t _v) IDEMPOTENT;
 
 /**
  * ilog64_nz - Integer binary logarithm of a non-zero 64-bit value.
@@ -67,7 +67,7 @@ int ilog64(uint64_t _v) IDEMPOTENT_ATTRIBUTE;
  * See Also:
  *     ilog64(), ilog32_nz()
  */
-int ilog64_nz(uint64_t _v) IDEMPOTENT_ATTRIBUTE;
+int ilog64_nz(uint64_t _v) IDEMPOTENT;
 
 /**
  * STATIC_ILOG_32 - The integer logarithm of an (unsigned, 32-bit) constant.
index 5863d88331db4ffd2a46be54a241ca4922afac81..bc0d6ffa6acfad065fd9a5dcc379f79c5f4f2954 100644 (file)
@@ -268,7 +268,7 @@ int iscsi_logout_async(struct iscsi_context *iscsi, iscsi_command_cb cb, void *p
        return 0;
 }
 
-int iscsi_process_logout_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, const unsigned char *hdr, int size UNNEEDED_ATTRIBUTE)
+int iscsi_process_logout_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, const unsigned char *hdr, int size UNUSED)
 {
        iscsi->is_loggedin = 0;
        pdu->callback(iscsi, ISCSI_STATUS_GOOD, NULL, pdu->private_data);
index 620916fe77c05898607056bde90906015e351dc6..7090401c0bffee9bc06e94042e5b4692a8a6f0b3 100644 (file)
@@ -201,7 +201,7 @@ struct scsi_task *scsi_cdb_readcapacity10(int lba, int pmi)
  * parse the data in blob and calcualte the size of a full readcapacity10 datain structure
  */
 static int scsi_readcapacity10_datain_getfullsize(struct scsi_task *task
-                                                 UNNEEDED_ATTRIBUTE)
+                                                 UNUSED)
 {
        return 8;
 }
index 4489a8f50021a1080fb4ccd5ccdc442c710804e7..77a158c9c8f482177e0d93956b8f33bc8f00779c 100644 (file)
@@ -33,7 +33,7 @@ struct jbitset {
        JError_t err;
        const char *errstr;
 };
-const char *COLD_ATTRIBUTE jbit_error_(struct jbitset *set);
+const char *COLD jbit_error_(struct jbitset *set);
 
 /**
  * jbit_error - test for an error in the a previous jbit_ operation.
index 0b389b6079300fb6872b5ea67889acaf141821dc..cfa2e26c61512fa07951f5e3101cc3be843354b7 100644 (file)
@@ -44,7 +44,7 @@ struct jmap {
        unsigned long acc_index;
        const char *funcname;
 };
-const char *COLD_ATTRIBUTE jmap_error_(struct jmap *map);
+const char *COLD jmap_error_(struct jmap *map);
 
 /* Debugging checks. */
 static inline void jmap_debug_add_access(const struct jmap *map,
index eed1f209f7535c6d1d13f7e8abb1a580f10c267c..137cb86131884d28710fa4f5e668d5bfe0f99f74 100644 (file)
@@ -39,7 +39,7 @@
  * code path and optimize appropriately; see likely() above.
  *
  * See Also:
- *     likely(), likely_stats(), UNLIKELY_FUNCTION_ATTRIBUTE (compiler.h)
+ *     likely(), likely_stats(), COLD (compiler.h)
  *
  * Example:
  *     // Prints a warning if we overflow.
index 1b96f90fd08baf614dc6da16e3b2fd3e73071327..fdf8eebed297db56d26abdca812b515702ffdf02 100644 (file)
@@ -664,7 +664,7 @@ int talloc_unlink(const void *context, void *ptr)
 /*
   add a name to an existing pointer - va_list version
 */
-static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_FMT(2,0);
 
 static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
 {
index 58b406e54b8002b47fce9305725b07491868174e..d27c68922c9c8f0d98a0b5fe76d3ea4b8093d3fb 100644 (file)
@@ -580,7 +580,7 @@ char *talloc_strndup(const void *t, const char *p, size_t n);
  *
  *   talloc_set_name_const(ptr, ptr)
  */
-char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_FMT(2,3);
 
 /**
  * talloc_append_string - concatenate onto a tallocated string 
@@ -610,7 +610,7 @@ char *WARN_UNUSED_RESULT talloc_append_string(char *orig, const char *append);
  *   talloc_set_name_const(ptr, ptr)
  */
 char *WARN_UNUSED_RESULT talloc_asprintf_append(char *s, const char *fmt, ...)
-       PRINTF_ATTRIBUTE(2,3);
+       PRINTF_FMT(2,3);
 
 /**
  * talloc_vasprintf - vsprintf into a talloc buffer.
@@ -626,7 +626,8 @@ char *WARN_UNUSED_RESULT talloc_asprintf_append(char *s, const char *fmt, ...)
  *
  *   talloc_set_name_const(ptr, ptr)
  */
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)
+       PRINTF_FMT(2,0);
 
 /**
  * talloc_vasprintf_append - sprintf onto the end of a talloc buffer.
@@ -638,7 +639,7 @@ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIB
  * talloc_asprintf_append(), except it takes a va_list.
  */
 char *WARN_UNUSED_RESULT talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-       PRINTF_ATTRIBUTE(2,0);
+       PRINTF_FMT(2,0);
 
 /**
  * talloc_set_type - force the name of a pointer to a particular type
@@ -714,7 +715,8 @@ int talloc_increase_ref_count(const void *ptr);
  * without releasing the name. All of the memory is released when the ptr is
  * freed using talloc_free().
  */
-const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+const char *talloc_set_name(const void *ptr, const char *fmt, ...)
+       PRINTF_FMT(2,3);
 
 /**
  * talloc_set_name_const - set a talloc pointer name to a string constant
@@ -745,7 +747,7 @@ void talloc_set_name_const(const void *ptr, const char *name);
  *   talloc_set_name(ptr, fmt, ....);
  */
 void *talloc_named(const void *context, size_t size, 
-                  const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
+                  const char *fmt, ...) PRINTF_FMT(3,4);
 
 /**
  * talloc_named_const - create a specifically-named talloc pointer
@@ -788,7 +790,7 @@ void *talloc_check_name(const void *ptr, const char *name);
  *
  *   talloc_named(NULL, 0, fmt, ...);
  */
-void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
+void *talloc_init(const char *fmt, ...) PRINTF_FMT(1,2);
 
 /**
  * talloc_total_size - get the bytes used by the pointer and its children
index 46f0779e782b117389c07f7781543b5a14c92fd8..395d245d284a55dab9b8df064d9d58dddda8d363 100644 (file)
@@ -118,7 +118,7 @@ void plan_tests(unsigned int tests);
 # define skip_end } while(0)
 
 unsigned int _gen_result(int, const char *, const char *, unsigned int,
-   const char *, ...) PRINTF_ATTRIBUTE(5, 6);
+   const char *, ...) PRINTF_FMT(5, 6);
 
 /**
  * diag - print a diagnostic message (use instead of printf/fprintf)
@@ -130,7 +130,7 @@ unsigned int _gen_result(int, const char *, const char *, unsigned int,
  * Example:
  *     diag("Now running complex tests");
  */
-void diag(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
+void diag(const char *fmt, ...) PRINTF_FMT(1, 2);
 
 /**
  * skip - print a diagnostic message (use instead of printf/fprintf)
@@ -153,7 +153,7 @@ void diag(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
  *     skip(1, "Don't have SOME_FEATURE");
  *     #endif
  */
-void skip(unsigned int n, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
+void skip(unsigned int n, const char *fmt, ...) PRINTF_FMT(2, 3);
 
 /**
  * todo_start - mark tests that you expect to fail.
@@ -183,7 +183,7 @@ void skip(unsigned int n, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
  *     ok(dwim(), "Did what the user wanted");
  *     todo_end();
  */
-void todo_start(const char *fmt, ...) PRINTF_ATTRIBUTE(1, 2);
+void todo_start(const char *fmt, ...) PRINTF_FMT(1, 2);
 
 /**
  * todo_end - end of tests you expect to fail.
index 399ed1656e4d2c88d096de9b8de2f7e7642b1cc0..aa974431db3fae958d074469c8d6e948e1d097a9 100644 (file)
@@ -151,7 +151,7 @@ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
 }
 
 /* a default logging function */
-static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
+static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_FMT(3, 4);
 static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
 {
 }
index 01ff905ae2af29a8ff4e6e2d4ea7872b4013def5..5d1d63c00f49b11befcc324df4c582c6375ede60 100644 (file)
@@ -82,7 +82,7 @@ typedef struct TDB_DATA {
 typedef struct tdb_context TDB_CONTEXT;
 
 typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
-typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
+typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_FMT(3, 4);
 typedef unsigned int (*tdb_hash_func)(TDB_DATA *key);
 
 struct tdb_logging_context {
index 0d5bcd2baf656ad67553e7e16114ddb09a9e3627..fc219b8d087ef3c7695848fc597135531a9f3b2d 100644 (file)
@@ -41,8 +41,8 @@ static int loopnum;
 static int count_pipe;
 static struct tdb_logging_context log_ctx;
 
-#ifdef PRINTF_ATTRIBUTE
-static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
+#ifdef PRINTF_FMT
+static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) PRINTF_FMT(3,4);
 #endif
 static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...)
 {
index 4b02755c28887667c1ca2adb157fb7520e8e4835..e3b3c2303f282ae387eec8171a3327f4d8864a29 100644 (file)
@@ -10,7 +10,7 @@ struct tdb_data tdb_null = { .dptr = NULL, .dsize = 0 };
 /* all contexts, to ensure no double-opens (fcntl locks don't nest!) */
 static struct tdb_context *tdbs = NULL;
 
-PRINTF_ATTRIBUTE(4, 5) static void
+PRINTF_FMT(4, 5) static void
 null_log_fn(struct tdb_context *tdb,
            enum tdb_debug_level level, void *priv,
            const char *fmt, ...)
index adaf67106551f695d5b5384300b88e812190080c..ee20a28d36f5a85791e8d1cc1c333d23db597b17 100644 (file)
@@ -80,7 +80,7 @@ struct tdb_context;
 
 /* FIXME: Make typesafe */
 typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
-typedef void (*tdb_logfn_t)(struct tdb_context *, enum tdb_debug_level, void *priv, const char *, ...) PRINTF_ATTRIBUTE(4, 5);
+typedef void (*tdb_logfn_t)(struct tdb_context *, enum tdb_debug_level, void *priv, const char *, ...) PRINTF_FMT(4, 5);
 typedef uint64_t (*tdb_hashfn_t)(const void *key, size_t len, uint64_t seed,
                                 void *priv);
 
index 46dc1c72ab70a98a2d3f9095d827bc513190f1f3..2ac9a8de43975a6b36220e5ebf1a1598c2acfa93 100644 (file)
@@ -43,8 +43,8 @@ static int count_pipe;
 static union tdb_attribute log_attr;
 static union tdb_attribute seed_attr;
 
-#ifdef PRINTF_ATTRIBUTE
-static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, void *private, const char *format, ...) PRINTF_ATTRIBUTE(4,5);
+#ifdef PRINTF_FMT
+static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, void *private, const char *format, ...) PRINTF_FMT(4,5);
 #endif
 static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, void *private, const char *format, ...)
 {