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

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:34:19
Message-ID: 4925837B.4040601@hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Magnus Hagander <magnus(at)hagander(dot)net> writes:
>> Heikki Linnakangas wrote:
>>> 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.
>
> I think you must have a broken version of gcc. I don't like this
> patch either. The (void) is the standard way and should work;
> futhermore, if you're getting a warning here, why aren't you getting
> a whole lot of others? It's not like we are careful to use (void)
> everywhere.

It's:
gcc (Ubuntu 4.3.2-1ubuntu11) 4.3.2

Error was:
pg_regress.c:282: warning: ignoring return value of ‘system’, declared
with attribute warn_unused_result

It's because system() is flagged with __attribute(warn_unused_result)__.
That's why we're not seeing it for other functions. There's a paragraph
about the difference in the GCC docs.

If that's in the new versions of gcc, I expect it to show up on other
platforms as well as time passes.

//Magnus

In response to

Browse pgsql-committers by date

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-11-20 15:36:29 Re: Error arguments in pl_exec.c
Previous Message Tom Lane 2008-11-20 15:33:02 Re: Hot Standby (commit fest version - v5)