From 0e85abd658738db9ea183c133c89c3c94ee37dae Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 21 Mar 2012 23:30:14 +0200 Subject: Clean up compiler warnings from unused variables with asserts disabled For those variables only used when asserts are enabled, use a new macro PG_USED_FOR_ASSERTS_ONLY, which expands to __attribute__((unused)) when asserts are not enabled. --- src/include/c.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/include/c.h') diff --git a/src/include/c.h b/src/include/c.h index 82acd14a9b..96375ab567 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -710,6 +710,18 @@ typedef NameData *Name; #define STATUS_WAITING (2) +/* + * Append PG_USED_FOR_ASSERTS_ONLY to definitions of variables that are only + * used in assert-enabled builds, to avoid compiler warnings about unused + * variables in assert-disabled builds. + */ +#ifdef USE_ASSERT_CHECKING +#define PG_USED_FOR_ASSERTS_ONLY +#else +#define PG_USED_FOR_ASSERTS_ONLY __attribute__((unused)) +#endif + + /* gettext domain name mangling */ /* -- cgit v1.2.3