From da1f9a7e26a06c5c3a594b3635369bfcc277a9fc Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 9 May 2005 20:13:28 +0000 Subject: [PATCH] silence warnings for UNUSED variables without changeing the funtion interfaces -- Alex git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@530 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/art_rgba_svp.c | 7 ++++--- program/src/rrd_afm.c | 6 ++++-- program/src/rrd_gfx.c | 5 +++-- program/src/rrd_update.c | 15 +++++++++++++-- program/src/rrd_xport.c | 3 ++- program/src/unused.h | 11 +++++++++++ 6 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 program/src/unused.h diff --git a/program/src/art_rgba_svp.c b/program/src/art_rgba_svp.c index b4adb4cd..25083d78 100644 --- a/program/src/art_rgba_svp.c +++ b/program/src/art_rgba_svp.c @@ -34,6 +34,7 @@ #include #include "art_rgba_svp.h" +#include "unused.h" static void art_rgba_fill_run (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int n); static void art_rgba_run_alpha (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n); @@ -49,7 +50,7 @@ struct _ArtRgbaSVPAlphaData { }; static void -art_rgba_svp_alpha_callback (void *callback_data, int y, +art_rgba_svp_alpha_callback (void *callback_data, int UNUSED(y), int start, ArtSVPRenderAAStep *steps, int n_steps) { ArtRgbaSVPAlphaData *data = callback_data; @@ -121,7 +122,7 @@ art_rgba_svp_alpha_callback (void *callback_data, int y, } static void -art_rgba_svp_alpha_opaque_callback (void *callback_data, int y, +art_rgba_svp_alpha_opaque_callback (void *callback_data, int UNUSED(y), int start, ArtSVPRenderAAStep *steps, int n_steps) { @@ -253,7 +254,7 @@ gnome_print_art_rgba_svp_alpha (const ArtSVP *svp, int libart_x0, int libart_y0, int libart_x1, int libart_y1, art_u32 rgba, art_u8 *buf, int rowstride, - ArtAlphaGamma *alphagamma) + ArtAlphaGamma UNUSED(*alphagamma)) { ArtRgbaSVPAlphaData data; int r, g, b, alpha; diff --git a/program/src/rrd_afm.c b/program/src/rrd_afm.c index 0bb0ac4f..20a65a03 100644 --- a/program/src/rrd_afm.c +++ b/program/src/rrd_afm.c @@ -20,6 +20,8 @@ #include #endif +#include "unused.h" + #if 0 # define DEBUG 1 # define DLOG(x) fprintf x @@ -185,8 +187,8 @@ static long afm_find_kern(const afm_fontinfo *fontinfo, } /* measure width of a text string */ -double afm_get_text_width ( double start, const char* font, double size, - double tabwidth, const char* text) +double afm_get_text_width ( double UNUSED(start), const char* font, double size, + double UNUSED(tabwidth), const char* text) { const afm_fontinfo *fontinfo = afm_findfont(font); long width = 0; diff --git a/program/src/rrd_gfx.c b/program/src/rrd_gfx.c index e288f034..2b328318 100644 --- a/program/src/rrd_gfx.c +++ b/program/src/rrd_gfx.c @@ -19,6 +19,7 @@ #include "rrd_gfx.h" #include "rrd_afm.h" +#include "unused.h" /* lines are better drawn on the pixle than between pixles */ #define LINEOFFSET 0.5 @@ -291,7 +292,7 @@ double gfx_get_text_width ( gfx_canvas_t *canvas, } double gfx_get_text_width_libart ( - gfx_canvas_t *canvas, double start, char* font, double size, + gfx_canvas_t *canvas, double UNUSED(start), char* font, double size, double tabwidth, char* text, int rotation ){ int error; @@ -2354,7 +2355,7 @@ static void pdf_free_resources(pdf_state *state) int gfx_render_pdf (gfx_canvas_t *canvas, art_u32 width, art_u32 height, - gfx_color_t background, FILE *fp){ + gfx_color_t UNUSED(background), FILE *fp){ struct pdf_state state; memset(&state, 0, sizeof(pdf_state)); state.fp = fp; diff --git a/program/src/rrd_update.c b/program/src/rrd_update.c index 18964667..6ec40f76 100644 --- a/program/src/rrd_update.c +++ b/program/src/rrd_update.c @@ -23,6 +23,7 @@ #include "rrd_rpncalc.h" #include "rrd_is_thread_safe.h" +#include "unused.h" #if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) /* @@ -69,7 +70,12 @@ int LockRRD(FILE *rrd_file); #ifdef HAVE_MMAP info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current, - unsigned short CDP_scratch_idx, FILE *rrd_file, + unsigned short CDP_scratch_idx, +#ifndef DEBUG +FILE UNUSED(*rrd_file), +#else +FILE *rrd_file, +#endif info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file); #else info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, @@ -1453,7 +1459,12 @@ LockRRD(FILE *rrdfile) #ifdef HAVE_MMAP info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current, - unsigned short CDP_scratch_idx, FILE *rrd_file, + unsigned short CDP_scratch_idx, +#ifndef DEBUG +FILE UNUSED(*rrd_file), +#else +FILE *rrd_file, +#endif info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file) #else info_t diff --git a/program/src/rrd_xport.c b/program/src/rrd_xport.c index 0e64dfd5..129dd30a 100644 --- a/program/src/rrd_xport.c +++ b/program/src/rrd_xport.c @@ -9,6 +9,7 @@ #include "rrd_tool.h" #include "rrd_graph.h" #include "rrd_xport.h" +#include "unused.h" #if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) #include @@ -30,7 +31,7 @@ int rrd_xport_fn(image_desc_t *, int -rrd_xport(int argc, char **argv, int *xsize, +rrd_xport(int argc, char **argv, int UNUSED(*xsize), time_t *start, time_t *end, /* which time frame do you want ? * will be changed to represent reality */ diff --git a/program/src/unused.h b/program/src/unused.h new file mode 100644 index 00000000..b5ac8411 --- /dev/null +++ b/program/src/unused.h @@ -0,0 +1,11 @@ +/* define a macro to wrap variables in that would + otherwhise generate UNUSED variable warnings */ + +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif -- 2.30.2