Re: Re: [COMMITTERS] pgsql: Silence compiler warning about ignored return value.

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Silence compiler warning about ignored return value.
Date: 2008-11-20 15:39:32
Message-ID: 492584B4.8020006@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Peter Eisentraut wrote:
> Magnus Hagander wrote:
>> Heikki Linnakangas wrote:
>>> Magnus Hagander wrote:
>>>> Log Message:
>>>> -----------
>>>> Silence compiler warning about ignored return value. Our comment
>>>> already
>>>> clearly stated that we are aware that we're ignoring it.
>>> I think the usual way is to call the function like:
>>>
>>> (void) function_with_return_value()
>>
>> I tried that first, of course. gcc is too smart about that - it still
>> throws the warning in this case.
>
> Well, the warning is explicitly put in there for this specific function
> because you are supposed to process the return value. I'm sure a more
> smarter compiler would even warn "variable is assigned a value that is
> never used". ;-) (Note that gcc in general doesn't work about unused
> return values, only for those functions that glibc explicitly marks as
> candidates.)
>
> It looks like you are building in fortify mode? I tried that a while
> ago and got a few more warnings. Are we trying to be fortify clean, and
> if so, what is our approach?

I'm building in whatever is the default on Ubuntu 8.10. It may be that
they have switched to fortify mode. How do I check that?

> Also, considering my recent complaint about various brittleness in the
> regression test driver, more well hidden ignorings of errors are not
> exactly my favorite solution.

Right, the other thing to do would be to check the error value :-) I
just assumed that since the comment explicitly said we wanted to ignore
it, we'd want to get rid of the warning. If the comment hadn't been
there, I'd have looked at a different way to do it.

//Magnus

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2008-11-20 15:40:39 Re: Re: [COMMITTERS] pgsql: Silence compiler warning about ignored return value.
Previous Message Magnus Hagander 2008-11-20 15:36:22 pgsql: Don't pass strings directly to errdetail() and errhint() - use %s

Browse pgsql-hackers by date

  From Date Subject
Next Message Grzegorz Jaskiewicz 2008-11-20 15:40:39 Re: Re: [COMMITTERS] pgsql: Silence compiler warning about ignored return value.
Previous Message Magnus Hagander 2008-11-20 15:36:29 Re: Error arguments in pl_exec.c