Re: lots of unused variable warnings in assert-free builds

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: lots of unused variable warnings in assert-free builds
Date: 2012-01-15 06:37:59
Message-ID: 7788.1326609479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I see that in some places our code already uses #ifdef
> USE_ASSERT_CHECKING, presumably to hide similar issues. But in most
> cases using this would significantly butcher the code. I found that
> adding __attribute__((unused)) is cleaner. Attached is a patch that
> cleans up all the warnings I encountered.

Surely this will fail entirely on most non-gcc compilers? Not to
mention that next month's gcc may complain "hey, you used this 'unused'
variable". I think #ifdef USE_ASSERT_CHECKING is really the only way
if you care about quieting these warnings. (Personally, I don't.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2012-01-15 07:26:31 Our poll() based WaitLatch implementation is broken
Previous Message Alvaro Herrera 2012-01-15 04:49:54 Re: foreign key locks, 2nd attempt