Lists: | pgsql-hackers |
---|
From: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | add __attribute__((noreturn)) to suppress a waring |
Date: | 2011-01-24 01:42:35 |
Message-ID: | AANLkTikvi3m7RKOtHP0ctSdspSfmc-75fmWv79GYLM57@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
I found the following warning with Fedora 14 / gcc 4.5.1.
----
pg_backup_archiver.c: In function ‘_discoverArchiveFormat’:
pg_backup_archiver.c:1736:11: warning: ‘fh’ may be used uninitialized
in this function
----
To suppress it, I'm thinking to add noreturn to die_horribly().
Any objections? Another solution might be adding a dummy assignment
after calls of die_horribly().
--
Itagaki Takahiro
Attachment | Content-Type | Size |
---|---|---|
noreturn.diff | application/octet-stream | 1.6 KB |
From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: add __attribute__((noreturn)) to suppress a waring |
Date: | 2011-01-24 06:32:51 |
Message-ID: | 4D3D1D13.3040509@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 24.01.2011 03:42, Itagaki Takahiro wrote:
> I found the following warning with Fedora 14 / gcc 4.5.1.
> ----
> pg_backup_archiver.c: In function ‘_discoverArchiveFormat’:
> pg_backup_archiver.c:1736:11: warning: ‘fh’ may be used uninitialized
> in this function
> ----
> To suppress it, I'm thinking to add noreturn to die_horribly().
> Any objections? Another solution might be adding a dummy assignment
> after calls of die_horribly().
I added a dummy assignment, that's how we've handled this before in
pg_dump. I guess we could use noreturn, we already use it in pg_re_throw
function. But we also have a dummy exit(1) call in the PG_RE_THROW macro
for non-gcc compilers, so we might need to do that here too.
Thanks!
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
Cc: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: add __attribute__((noreturn)) to suppress a waring |
Date: | 2011-01-24 15:14:42 |
Message-ID: | 6210.1295882082@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> On 24.01.2011 03:42, Itagaki Takahiro wrote:
>> To suppress it, I'm thinking to add noreturn to die_horribly().
>> Any objections? Another solution might be adding a dummy assignment
>> after calls of die_horribly().
> I added a dummy assignment, that's how we've handled this before in
> pg_dump.
We generally do *not* want to depend on noreturn, because it will not
suppress similar warnings in non-gcc compilers. Just add a dummy
initialization, or reorganize the code to avoid the problem.
regards, tom lane