[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] stubdom vtpm build failure in staging

>>> On 29.01.15 at 11:46, <Ian.Campbell@xxxxxxxxxx> wrote:
> On Thu, 2015-01-29 at 11:27 +0100, Olaf Hering wrote:
>> On Thu, Jan 29, Olaf Hering wrote:
>> > Looks like old gcc can not handle two typedefs?
>> Yes, this fails already:
>> typedef unsigned char BYTE;
>> typedef unsigned char BYTE;
>> void f(int *v) { *v *= *v; }
>> t.c:2:23: error: redefinition of typedef 'BYTE'
>> t.c:1:23: note: previous declaration of 'BYTE' was here
> This compiles for me on Debian with gcc 4.7.2-5.
> I'm honestly not sure what the C standard says about duplicate but
> identical typedefs -- Ian?

I'm not Ian, but anyway: Under "Declarations", the standard says
"If an identifier has no linkage, there shall be no more than one
declaration of the identifier (in a declarator or type specifier) with
the same scope and in the same name space, except for tags as
specified in ..." Clearly typedef-s have no linkage, so it's at best
a courtesy of some compiler versions to not choke on redundant
typedef-s. And with -Wpedantic even gcc 4.9.2 issues a warning.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.