Fixing up kinfocenter/pci

Michael Pyne mpyne at purinchu.net
Fri Aug 8 01:17:05 BST 2008


On Thursday 07 August 2008, Adriaan de Groot wrote:
> The PCI data module for kinfocenter adds -fpermissive (a gcc-ism) to the
> compile flags, to compensate for its use of nested anonymous unions and
> other non-standard things. I waded through it, named all the unions and
> generally hammered into compilable shape without -fpermissive. The patch is
> 80k, so not attached but available at
> http://www.bionicmutton.org/tmp/kpci.diff .

I've only partially looked at the patch but the union renaming makes it 
annoying to wade through.

However isn't anonymous unions standard C++?  I thought even nested unions 
(although I think they are useless) would be valid.

Actually I just checked, seems to work:

$ cat temp.cpp
struct test
{
    union {
        int a;
        int b;
        union {
            int c;
            int d;
        };
    };
};
$ g++ -ansi -Wall -o /dev/null -c temp.cpp
$

> Some parts of the code look
> dodgy to me, like some unions which look like they should be structs
> instead and some unions of members with different sizes -- not to mention
> that all these binary structures are using integer types as if they have a
> fixed size instead of uint_8_t or uint16_t .. anyway, does the patch look
> sensible to commit in 4.1 branch and trunk?

I think the patch would be easier to review without changing union names but I 
can go through the rest of it if you'd like.  I would like to see us get rid 
of -fpermissive. :)

Regards,
 - Michael Pyne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080807/3900c3f5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080807/3900c3f5/attachment.sig>


More information about the kde-core-devel mailing list