[RFC patch]: Feature of type attribute "uuid" and corresponding C/C++ language extension to query value of type attribute uuid

Kai Tietz ktietz70@googlemail.com
Sat Jan 9 19:29:00 GMT 2010


2010/1/9 Joseph S. Myers <joseph@codesourcery.com>:
> On Sat, 9 Jan 2010, Kai Tietz wrote:
>
>> I would like to add to upcoming gcc 4.6 the feature of having the
>> ability to add via the attribute "uuid" a property to specifc types,
>> which can be later queried by __uuidof (the current draft
>> implementation uses here __builtin_uuidof, but as it is more
>> equivalent to sizeof/typeof/alignof operators, it should be possibly
>> named better __uuidof).
>> The initial motivation for this feature was, that gcc can be support
>> DCOM classes, types, and records in a same way as vendor compiler can.
>
> Does the vendor compiler have documentation of the semantics of this
> extension (including such questions as when a VLA or VM operand is
> evaluated - which should generally be determined based on whether the
> result can depend on the values of such expressions)?

Vendor compiler documentation for their uuidof is at
http://msdn.microsoft.com/en-us/library/zaah6a61.aspx

They are using here an pretty Windows specific type (const reference
to GUID), which I dislike to have as builtin type for gcc, so I choose
here a string constant, which can be then interpreted in target
specific user code for doing the conversion. If the attribute wasn't
specified to a type an empty string is evaluated.

This operator should work on types and expressions, like the sizeof
operator. I added as you suggested a test case for VM/VLA, too.

>  I note that this
> patch is incomplete, in that it does not add any such documentation (it
> doesn't even update the syntax comments in the C and C++ parsers to show
> the syntax productions for the new construct and how they fit in the
> grammar), so making it impossible to review.  It also lacks testcases for
> the rules about when an operand is evaluated (see gnu99-static-1.c for an
> example of one thing that needs checking, apart from basic questions about
> whether side effects in size expressions inside the operand are
> evaluated).

I know, therefore I wrote draft for this request, as it lacks at the
moment documentation. The grammar (it should be same places as sizeof
operator) I would like to add. Could you give me a hint in which
document it is to be found in gcc's tree?

Regards,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uuidof.diff
Type: text/x-diff
Size: 15760 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100109/11da5df7/attachment.bin>


More information about the Gcc-patches mailing list