Lists: | pgsql-hackers |
---|
From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | ilist.h fails cpluspluscheck |
Date: | 2012-11-27 04:55:21 |
Message-ID: | 1353992121.4992.16.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
In file included from ./src/include/utils/catcache.h:25:0,
from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:
src/include/lib/ilist.h: In function ‘dlist_node* dlist_head_node(dlist_head*)’:
src/include/lib/ilist.h:470:39: error: invalid conversion from ‘void*’ to ‘dlist_node*’ [-fpermissive]
src/include/lib/ilist.h: In function ‘dlist_node* dlist_tail_node(dlist_head*)’:
src/include/lib/ilist.h:487:39: error: invalid conversion from ‘void*’ to ‘dlist_node*’ [-fpermissive]
In file included from ./src/include/utils/catcache.h:25:0,
from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:
src/include/lib/ilist.h: In function ‘slist_node* slist_head_node(slist_head*)’:
src/include/lib/ilist.h:680:39: error: invalid conversion from ‘void*’ to ‘slist_node*’ [-fpermissive]
In file included from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:0:
./src/include/lib/ilist.h: In function ‘dlist_node* dlist_head_node(dlist_head*)’:
./src/include/lib/ilist.h:470:39: error: invalid conversion from ‘void*’ to ‘dlist_node*’ [-fpermissive]
./src/include/lib/ilist.h: In function ‘dlist_node* dlist_tail_node(dlist_head*)’:
./src/include/lib/ilist.h:487:39: error: invalid conversion from ‘void*’ to ‘dlist_node*’ [-fpermissive]
In file included from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:0:
./src/include/lib/ilist.h: In function ‘slist_node* slist_head_node(slist_head*)’:
./src/include/lib/ilist.h:680:39: error: invalid conversion from ‘void*’ to ‘slist_node*’ [-fpermissive]
Maybe some ifndef __cplusplus would help.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ilist.h fails cpluspluscheck |
Date: | 2012-11-27 06:14:27 |
Message-ID: | 28960.1353996867@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> In file included from ./src/include/utils/catcache.h:25:0,
> from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:
> src/include/lib/ilist.h: In function dlist_node* dlist_head_node(dlist_head*):
> src/include/lib/ilist.h:470:39: error: invalid conversion from void* to dlist_node* [-fpermissive]
> Maybe some ifndef __cplusplus would help.
Or maybe we need to recommend use of -fpermissive? If C++ thinks
casting void * to something else is illegitimate, it's basically not
going to cope with most things we might try to inline in Postgres.
And I don't think that saying "you don't get to call these fundamental
support functions from C++" is likely to fly, so just hiding the
functions won't help much.
regards, tom lane
From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ilist.h fails cpluspluscheck |
Date: | 2012-11-27 09:56:51 |
Message-ID: | 20121127095651.GA3989@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 2012-11-27 01:14:27 -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > In file included from ./src/include/utils/catcache.h:25:0,
> > from /tmp/cpluspluscheck.bt8VZr/test.cpp:3:
> > src/include/lib/ilist.h: In function ‘dlist_node* dlist_head_node(dlist_head*)’:
> > src/include/lib/ilist.h:470:39: error: invalid conversion from ‘void*’ to ‘dlist_node*’ [-fpermissive]
>
> > Maybe some ifndef __cplusplus would help.
>
> Or maybe we need to recommend use of -fpermissive? If C++ thinks
> casting void * to something else is illegitimate, it's basically not
> going to cope with most things we might try to inline in Postgres.
> And I don't think that saying "you don't get to call these fundamental
> support functions from C++" is likely to fly, so just hiding the
> functions won't help much.
Its rather easy to fix in the ilist code at least - the cases it points
out are those where I took a slightly ugly shortcut to reduce some very
minor code duplication...
Some casts fix it, alternatively the
Assert(!dlist_is_empty());
return head->head.next
could be moved into [ds]list_(head|tail)_node instead of relying on the
*_elemen_off support functions.
Greetings,
Andres
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-some-warnings-in-ilist.h-pointed-out-by-cplusplu.patch | text/x-patch | 1.4 KB |
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: ilist.h fails cpluspluscheck |
Date: | 2012-11-27 16:00:11 |
Message-ID: | 19619.1354032011@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2012-11-27 01:14:27 -0500, Tom Lane wrote:
>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>> Maybe some ifndef __cplusplus would help.
> Its rather easy to fix in the ilist code at least - the cases it points
> out are those where I took a slightly ugly shortcut to reduce some very
> minor code duplication...
> Some casts fix it,
Seems reasonable, committed.
I wonder if we could get a buildfarm member or two running
cpluspluscheck.
regards, tom lane