[LLVMdev] [Debug Info + LTO] Type Uniquing for C types?

Eric Christopher echristo at gmail.com
Mon Oct 14 15:52:34 PDT 2013


> Modules foists the C++ one definition rule on C/Objective-C so that it can
> avoid performing type merging, so we can’t look there.
>
> C doesn’t have a one definition rule per se. The cross-translation-unit
> compatibility rules are in 6.2.7 of the C standard, which boils down to
> structural equality:
>
> Moreover, two structure, union, or enumerated types declared in separate
> translation units are compatible if their tags and members satisfy the
> following requirements: If one is declared with a tag, the other shall be
> declared with the same tag. If both are complete types, then the following
> additional requirements apply: there shall be a one-to-one correspondence
> between their members such that each pair of corresponding members are
> declared with compatible types, and such that if one member of a
> corresponding pair is declared with a name, the other member is declared
> with the same name. For two structures, corresponding members shall be
> declared in the same order. For two structures or unions, corresponding
> bit-fields shall have the same widths. For two enumerations, corresponding
> members shall have the same values.
>

Bummer, I was hoping you had something clever. :)

-eric




More information about the llvm-dev mailing list