From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: lots of unused variable warnings in assert-free builds |
Date: | 2012-01-24 18:08:05 |
Message-ID: | CA+TgmobOmyKByn-cuD0fWc-DTXEaQuNPENVeA_WgXKLwypo1Sw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 24, 2012 at 1:03 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I wrote:
>> Also, it occurs to me that an intermediate macro
>> "PG_USED_FOR_ASSERTS_ONLY" would be a good idea, first because it
>> documents *why* you want to mark the variable as possibly unused,
>> and second because changing the macro definition would provide an easy way
>> to check for totally-unused variables, in case we wanted to periodically
>> make such checks.
>
> Uh, wait a second. Why not
>
> #ifdef USE_ASSERT_CHECKING
> #define PG_USED_FOR_ASSERTS_ONLY
> #else
> #define PG_USED_FOR_ASSERTS_ONLY __attribute__((unused))
> #endif
>
> Then, when you build with asserts on, you *automatically* get told
> if the variable is entirely unused.
Yes, that's what I meant when I suggested it originally. I'm just not
sure it's any nicer than adding ifdefs for USE_ASSERT_CHECKING.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2012-01-24 18:16:58 | Re: patch : Allow toast tables to be moved to a different tablespace |
Previous Message | Tom Lane | 2012-01-24 18:03:50 | Re: lots of unused variable warnings in assert-free builds |