[Pvfs2-developers] state machine compiler tweaks

Sam Lang slang at mcs.anl.gov
Tue May 30 11:33:21 EDT 2006


On May 30, 2006, at 10:29 AM, Sam Lang wrote:

>
> On May 30, 2006, at 9:21 AM, Pete Wyckoff wrote:
>
>> walt at clemson.edu wrote on Tue, 30 May 2006 09:28 -0400:
>>> Which is more common in compilers:
>>>
>>> static struct foo foobar = {
>>> 	field1: value1,
>>> 	field4: value4
>>> 	};
>>>
>>> OR what's shown below:
>>>
>>> static struct foo foobar = {
>>> 	.field1 = value1,
>>> 	.field4 = value4
>>> 	};
>>>
>>> The first is used by the kernel code, and  has been around for  
>>> quite a
>>> while.  I'm not sure what the second form gives us that the first  
>>> one
>>> doesn't.  Unless there is a good reason otherwise we should probably
>>> stick with the most widely supported.
>>
>> The first is a gcc-only extension, obsolete since gcc 2.5 according
>> to their manual.  The latter is part of the ISO C99 spec.  If we
>> were going to convert from the unnamed version to anything, I'd have
>> a strong preference for going with the spec.
>>
>>> Murali Vilayannur wrote:
>>>> Oops that was my bad..I did not realize that this syntax is not  
>>>> supported
>>>> by many compilers! I was once bitten by initializing a struct
>>>> incorrectly, and I committed that change since I assumed that a  
>>>> user would
>>>> not be able to compile the kmod without having a compiler that  
>>>> understands
>>>> that syntax.
>>
>> The kernel code is inherently tied to gcc, so designated
>> initializers causes no problem.  But the few places in dist-*.c that
>> went in last month might affect non-linux non-gcc clients or servers.
>> Looking back at old gcc versions, even ancient 2.5 supported this
>> feature.  Scanning web pages for sun and ibm show that they have had
>> support for some time too.
>>
>> I think our only problem would be with an old vendor-supplied
>> compiler.  And my feel is that we should not bother supporting such
>> if it reduces our code quality.  For the next release, let's leave
>> in the few places (dist-*.c, and soon statecomp) where these are
>> used and see if anybody complains.  It will be easy enough to back
>> it out.  Other opinions?
>>
>
> I remember seeing other gcc specific features used in the pvfs2  
> code, such as varargs for macros, so I had thought that they

'they' was supposed to be 'we'.

> were requiring gcc anyway.  Does intel support varargs for macros?
>
>> 		-- Pete
>> _______________________________________________
>> Pvfs2-developers mailing list
>> Pvfs2-developers at beowulf-underground.org
>> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>>
>
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>



More information about the Pvfs2-developers mailing list