This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Florian Weimer <fw at deneb dot enyo dot de>, GCC Development <gcc at gcc dot gnu dot org>, cfe-commits <cfe-commits at lists dot llvm dot org>
- Date: Mon, 8 Feb 2016 08:05:09 -0800
- Subject: Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOofYT89yzF6jxFZFG2=QVQuQpEC7DP0HV_epjeawCf_sA at mail dot gmail dot com> <87d1s8wc4w dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOp_6ZpR1YSJZ7AiLpa+FPRGJoLm5fTPkiH5BgF4Tkg3RA at mail dot gmail dot com> <87r3gouvv2 dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOo2tPZKZEgpgFbbSnkyBiONzS9vfntn_QsxRPbVHZGmUw at mail dot gmail dot com> <87k2mgutzr dot fsf at mid dot deneb dot enyo dot de> <CAMe9rOoMujhjExxKWrz-Dv8uE33X=Upvi_X_HZsfeN0GS+=56A at mail dot gmail dot com> <CAMe9rOruCOvtM2D2AmG94A1_8Og8Kfu7tYF4De=XNfzUG+eh5g at mail dot gmail dot com> <CAH6eHdQci21ZhZ4odOfJRjC8s8HjuJ5X73LfK6oqvxCtOnzK6w at mail dot gmail dot com> <CAMe9rOpJXNUNvusTmwFb3riOxXyXLTGTquSMKqZkBe=nbmt_QQ at mail dot gmail dot com> <CAH6eHdQcvj7EY3jXgtUBQePfikiTbcuqsNFpDH7SWyxD628peQ at mail dot gmail dot com>
On Mon, Feb 8, 2016 at 7:59 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 8 February 2016 at 15:42, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Mon, Feb 8, 2016 at 7:02 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>>> On 8 February 2016 at 13:54, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Sun, Feb 7, 2016 at 12:52 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>
>>>> The standard-layout POD is well defined:
>>>>
>>>> https://en.wikipedia.org/wiki/C%2B%2B11#Modification_to_the_definition_of_plain_old_data
>>>>
>>>> Here is the updated proposal for Intel386, x86-64 and IA MCU psABIs:
>>>>
>>>> 1. "collection". A collection is a structure, union or C++ class.
>>>
>>> These are all "class types". Why invent a new term?
>>
>> Because it applies to both C and C++. There is no class in C.
>
> Then you could use the term "class type" in the ABI, defining it to
> mean structure or union in C, or class type in C++. No need for a new
> term.
I will do it.
>
>>>> 2. "empty collection". An empty collection is:
>>>> a. A collection without member. Or
>>>
>>> What about base classes?
>>>
>>> What about bit-fields of length 0?
>>
>> Is a collection with them standard-layout POD type?
>
> (I'm not sure what the "bit-fields of length 0" part is for, but my
> point is it would be useful to examine similar concepts in the
> standard and align with them, not just make up entirely new
> classifications.)
I am replying on C++ compiler to tell if it is standard-layout
or not.
> For base classes, yes. A standard-layout class can have base classes
> of standard-layout type.
>
> struct A { };
> struct B { };
> struct C : A, B { };
>
> C is a standard-layout type. Is it an empty collection?
My understanding is
A type that is standard-layout means that it orders and packs its
members in a way that is compatible with C.
What is the corresponding compatible type in C?
>>>> b. A collection with only empty collections. Or
>>>
>>> What does "with" mean? Only members, or bases too?
>>
>> Is "A collection with only members of empty collections" better?
>
> Should it mention base classes?
It depends on the answer of my question above.
>
>>>> c. An array of empty collections.
>>>> 3. "empty record". An empty record is Plain Old Data (POD) for the purpose
>>>> of standard-layout and
>>>
>>> "For the purposes of standard-layout" doesn't mean anything.
>>>
>>> A type is a standard-layout type, or it isn't.
>>
>> How about "An empty record is standard-layout Plain Old Data (POD)
>> type and ..."?
>
> That's redundant, all POD types are standard-layout types.
>
I will update it.
Thanks.
--
H.J.
- References:
- RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct
- Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct