diff --git a/pngpriv.h b/pngpriv.h index afc36b875..70eac1f53 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -86,26 +86,28 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; /* Unused formal parameter errors are removed using the following macro * which is expected to have no bad effects on performance. Note that * if you replace it with something other than whitespace, you must include - * the terminating semicolon. + * the terminating semicolon. Also note that some of these might not + * work when "param" is a structure, but that is never the case in libpng. */ -#ifndef PNG_UNUSED -# define PNG_UNUSED(param) {if(param){}} -/* Other possiblities being discussed on png-mng-implement, Jan 2011 */ -/* #define PNG_UNUSED(param) param = param; */ /* What we used before */ -/* #define PNG_UNUSED(param) {(void)param;} */ /* Visual C complains */ -/* #define PNG_UNUSED(param) if(param); */ /* gcc-4.2 complains */ -/* #define PNG_UNUSED(param) if(param){} */ -/* #define PNG_UNUSED(param) ((void)(param ? 0 : 0)); */ /* 0:0 might be seen */ -/* #define PNG_UNUSED(param) {if(¶m){}} */ /* gcc-4 complains */ -/* #define PNG_UNUSED(param) {if(¶m-¶m){}} */ /* No comment. */ -/* - * #if defined(__GNUC__) || defined(_MSC_VER) - * # define UNUSED(param) (void)param; - * #else - * # define UNUSED(param) - * #endif -*/ -#endif +#define PNG_UNUSED(param) {if(param){}} + +#if 0 /* Possibilities discussed on png-mng-implement, starting 27 Jan 2011 */ +#ifndef PNG_UNUSED /* "best" but complex */ + #if defined(__GNUC__) || defined(_MSC_VER) + # define PNG_UNUSED(param) (void)param; + #else + # define PNG_UNUSED(param) + #endif +#define PNG_UNUSED(param) param = param; /* What we used before */ +#define PNG_UNUSED(param) {(void)param;} /* Visual C complains */ +#define PNG_UNUSED(param) if(param); /* gcc-4.2 complains */ +#define PNG_UNUSED(param) if(param){} /* more brackets nicer */ +#define PNG_UNUSED(param) ((void)(param ? 0 : 0)); /* 0:0 might be seen */ +#define PNG_UNUSED(param) {if(¶m){}} /* gcc-4 complains */ +#define PNG_UNUSED(param) {if(¶m-¶m){}} /* No comment. */ +#define PNG_UNUSED(param) /* generates smallest (no) code but emits warning */ +#endif /* 0 */ +#endif /* PNG_UNUSED */ /* Just a little check that someone hasn't tried to define something * contradictory.