Re: add -Wlogical-op to standard compiler options?

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: add -Wlogical-op to standard compiler options?
Date: 2012-11-21 19:46:37
Message-ID: CAMkU=1z+QwjLqcU-ckz5Px3jtU7_wMBquM-5bXQKc6jTM3EWJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 15, 2012 at 1:46 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On 11/15/12 9:40 AM, Tom Lane wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>> I think it might be worth adding -Wlogical-op to the standard warning
>>> options (for supported compilers, determined by configure test).
>>
>> Does that add any new warnings with the current source code, and if
>> so what?
>
> none

Using gcc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4), I get dozens of
warnings, all apparently coming from somewhere in the MemSet macro.

example:

pl_handler.c:301: warning: logical '&&' with non-zero constant will
always evaluate as true

Probably has something to do with:

/* \
* If MEMSET_LOOP_LIMIT == 0, optimizer
should find \
* the whole "if" false at compile time. \
*/ \
MEMSET_LOOP_LIMIT != 0) \

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-11-21 20:09:12 Re: [PATCH] binary heap implementation
Previous Message Peter Eisentraut 2012-11-21 19:41:56 Re: User control over psql error stream