[cfe-dev] extern "C" support
Chris Lattner
clattner at apple.com
Fri Jan 11 23:06:46 PST 2008
On Jan 10, 2008, at 1:51 PM, Mike Stump wrote:
> On Jan 9, 2008, at 1:36 PM, Chris Lattner wrote:
>> This is looking very nice. Some last remaining nit-picky details:
>
> Time will tell if these are truly the last of the nit-pics... :-)
Hehe, the first significant patch is always the hardest.
>> +void LinkageSpecDecl::EmitInRec(Serializer& S) const {
>> + Decl::EmitInRec(S);
>> + S.EmitInt(getLanguage());
>> + S.EmitPtr(D);
>> +}
>>
>> Emitting the language enum as part of the serialization format
>> implicitly makes the enum value part of the serialized encoding.
>> I'm fine with this, but please add a comment about this issue above
>> the enum definition:
>
> Done. Hum, yeah, would be nice to have a nice clean separation
> between the two. For an abi, I think I'd rather have the value
> chosen by the dwarf standard, I think they both enumerate languages
> and select values. [ pause ] Ok, I fixed up the code.
Yep. At this point, we really don't care about 100% stability
(because things are changing and immature), but when we do start
caring we want to know what pieces implicitly define the abi.
>> + if (strncmp (Lang, "\"C\"", StrSize) == 0)
>> + Language = LinkageSpecDecl::lang_c;
>> + else if (strncmp (Lang, "\"C++\"", StrSize) == 0)
>> + Language = LinkageSpecDecl::lang_cxx;
>>
>> I'm not sure if strncmp is the right thing here. Will it work if
>> "Lang" is not null terminated?
>
> Uhm, this is why strncmp was invented!? Yes. strncmp only fails
> when languages are defined to have '\0' in their names. When that
> happens, we have bigger problems.
Ah ok, this works because you're comparing StrSize bytes, not StrSize
+1, silly me :)
>> Finally, should 'extern "c"' be allowed?
>
> No.
Ok!
> Ok, We'll try this one...
Very nice, applied:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080107/003743.html
-Chris
More information about the cfe-dev
mailing list