[master] 9ba0565 Rename __printflike to __v_printflike to make sure we have control over it with vdef.h.
Poul-Henning Kamp
phk at FreeBSD.org
Wed Mar 4 14:02:48 CET 2015
commit 9ba0565ee374a001bc2450827281880cc5cea4af
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Mar 4 13:02:06 2015 +0000
Rename __printflike to __v_printflike to make sure we have control
over it with vdef.h.
Confine __unused to include/vtree.h at the same time.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 0e0ac6a..46b410b 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -848,7 +848,7 @@ void HTTP_Encode(const struct http *fm, uint8_t *, unsigned len, unsigned how);
int HTTP_Decode(struct http *to, const uint8_t *fm);
void http_ForceHeader(struct http *to, const char *hdr, const char *val);
void http_PrintfHeader(struct http *to, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
void http_TimeHeader(struct http *to, const char *fmt, double now);
void http_SetHeader(struct http *to, const char *hdr);
void http_SetH(const struct http *to, unsigned n, const char *fm);
@@ -1029,10 +1029,10 @@ void VSL_End(struct vsl_log *vsl);
void VSM_Free(void *ptr);
#ifdef VSL_ENDMARKER
void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void VSLbv(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, va_list va);
void VSLb(struct vsl_log *, enum VSL_tag_e tag, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t);
void VSLb_ts(struct vsl_log *, const char *event, double first, double *pprev,
double now);
@@ -1120,7 +1120,7 @@ void *WS_Alloc(struct ws *ws, unsigned bytes);
void *WS_Copy(struct ws *ws, const void *str, int len);
char *WS_Snapshot(struct ws *ws);
int WS_Overflowed(const struct ws *ws);
-void *WS_Printf(struct ws *ws, const char *fmt, ...) __printflike(2, 3);
+void *WS_Printf(struct ws *ws, const char *fmt, ...) __v_printflike(2, 3);
/* cache_rfc2616.c */
void RFC2616_Ttl(struct busyobj *, double now);
diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h
index e6d9274..bbc3f8e 100644
--- a/bin/varnishd/cache/cache_filter.h
+++ b/bin/varnishd/cache/cache_filter.h
@@ -80,7 +80,7 @@ int VFP_Open(struct vfp_ctx *bo);
void VFP_Close(struct vfp_ctx *bo);
enum vfp_status VFP_Suck(struct vfp_ctx *, void *p, ssize_t *lp);
enum vfp_status VFP_Error(struct vfp_ctx *, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
/* cache_fetch_proc.c */
enum vfp_status VFP_GetStorage(struct vfp_ctx *, ssize_t *sz, uint8_t **ptr);
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index dc28a00..7d734ee 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -54,7 +54,7 @@ typedef void mgt_cli_close_f(void *priv);
void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident,
mgt_cli_close_f *close_func, void *priv);
int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void mgt_cli_start_child(int fdi, int fdo);
void mgt_cli_stop_child(void);
void mgt_cli_telnet(const char *T_arg);
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index 7fc24fe..4f7a2e9 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -172,7 +172,7 @@ static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
static void
thread_log(int lvl, int errcode, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
static void
thread_log(int lvl, int errcode, const char *fmt, ...)
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index b877e26..d43a188 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -81,7 +81,7 @@ void vtc_loginit(char *buf, unsigned buflen);
struct vtclog *vtc_logopen(const char *id);
void vtc_logclose(struct vtclog *vl);
void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void vtc_dump(struct vtclog *vl, int lvl, const char *pfx,
const char *str, int len);
void vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
@@ -93,8 +93,8 @@ int exec_file(const char *fn, const char *script, const char *tmpdir,
void macro_undef(struct vtclog *vl, const char *instance, const char *name);
void macro_def(struct vtclog *vl, const char *instance, const char *name,
const char *fmt, ...)
- __printflike(4, 5);
+ __v_printflike(4, 5);
struct vsb *macro_expand(struct vtclog *vl, const char *text);
void extmacro_def(const char *name, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
diff --git a/include/vcli_priv.h b/include/vcli_priv.h
index 0129b83..2f98d7d 100644
--- a/include/vcli_priv.h
+++ b/include/vcli_priv.h
@@ -54,6 +54,6 @@ struct cli_proto {
/* The implementation must provide these functions */
int VCLI_Overflow(struct cli *cli);
void VCLI_Out(struct cli *cli, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
void VCLI_Quote(struct cli *cli, const char *str);
void VCLI_SetResult(struct cli *cli, unsigned r);
diff --git a/include/vdef.h b/include/vdef.h
index 5845e2d..5d52ddb 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -59,20 +59,12 @@
# endif
#endif
-#ifndef __printflike
-# if __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER)
-# define __printflike(f,a) __attribute__((format(printf, f, a)))
-# else
-# define __printflike(f,a)
-# endif
-#endif
-
-#ifndef __unused
-# if __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER)
-# define __unused __attribute__((__unused__))
-# else
-# define __unused
-# endif
+#ifdef __printflike
+# define __v_printflike(f,a) __printflike(f,a)
+#elif __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER)
+# define __v_printflike(f,a) __attribute__((format(printf, f, a)))
+#else
+# define __v_printflike(f,a)
#endif
/**********************************************************************
diff --git a/include/vsb.h b/include/vsb.h
index b99e471..4b0099f 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -63,10 +63,10 @@ void VSB_clear(struct vsb *);
int VSB_bcat(struct vsb *, const void *, size_t);
int VSB_cat(struct vsb *, const char *);
int VSB_printf(struct vsb *, const char *, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
#ifdef va_start
int VSB_vprintf(struct vsb *, const char *, va_list)
- __printflike(2, 0);
+ __v_printflike(2, 0);
#endif
int VSB_putc(struct vsb *, int);
int VSB_error(const struct vsb *);
diff --git a/include/vtree.h b/include/vtree.h
index d251d62..04f551d 100644
--- a/include/vtree.h
+++ b/include/vtree.h
@@ -30,6 +30,10 @@
#ifndef _VTREE_H_
#define _VTREE_H_
+#ifndef __unused
+define __unused __attribute__((__unused__))
+#endif
+
/*
* This file defines data structures for different types of trees:
* splay trees and red-black trees.
diff --git a/include/vut.h b/include/vut.h
index 0dc7482..bd093d1 100644
--- a/include/vut.h
+++ b/include/vut.h
@@ -65,7 +65,7 @@ struct VUT {
extern struct VUT VUT;
void VUT_Error(int status, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
int VUT_g_Arg(const char *arg);
diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h
index 6dacff3..f3bd213 100644
--- a/lib/libvarnishapi/vsl_api.h
+++ b/lib/libvarnishapi/vsl_api.h
@@ -38,7 +38,7 @@
/*lint -esym(534, vsl_diag) */
int vsl_diag(struct VSL_data *vsl, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
void vsl_vbm_bitset(int bit, void *priv);
void vsl_vbm_bitclr(int bit, void *priv);
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index 1d73773..ce4f954 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -57,5 +57,5 @@ struct VSM_data {
};
int vsm_diag(struct VSM_data *vd, const char *fmt, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
void VSC_Delete(struct VSM_data *vd);
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 9bc102c..42f8c5c 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -256,11 +256,11 @@ struct inifin *New_IniFin(struct vcc *tl);
* F -> Finish function
*/
void Fh(const struct vcc *tl, int indent, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void Fc(const struct vcc *tl, int indent, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void Fb(const struct vcc *tl, int indent, const char *fmt, ...)
- __printflike(3, 4);
+ __v_printflike(3, 4);
void EncToken(struct vsb *sb, const struct token *t);
int IsMethod(const struct token *t);
void *TlAlloc(struct vcc *tl, unsigned len);
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 7649e3e..957d017 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -247,7 +247,7 @@ vcc_new_expr(void)
static struct expr *
vcc_mk_expr(enum var_type fmt, const char *str, ...)
- __printflike(2, 3);
+ __v_printflike(2, 3);
static struct expr *
vcc_mk_expr(enum var_type fmt, const char *str, ...)
More information about the varnish-commit
mailing list