This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct


On Tue, Feb 23, 2016 at 7:30 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Tue, 23 Feb 2016, H.J. Lu wrote:
>
>> > ---
>> > An empty type is a type where it and all of its subobjects (recursively)
>> > are of class, structure, union, or array type.  No memory slot nor
>> > register should be used to pass or return an object of empty type that's
>> > trivially copyable.
>> > ---
>> >
>> > (With possibly a self-sufficient definition of trivially copyable, that's
>> > language agnostic)
>> >
>>
>> Do you have an example in which an empty type defined above isn't
>> "trivially copyable"?
>
> The ones we've always talked about: empty C++ types with non-trivial copy
> ctors or dtors.  Yes, I'm aware of the fact that the Itanium C++ ABI
> doesn't invoke the underlying psABI for these types (or better, it
> specifies them to be passed by reference).  But first, there are other
> languages that have such constructs, but don't necessarily have an
> written-down ABI (OO fortran anyone? Ada?).  Second, there may be other
> C++ ABIs that don't contain such language (which would be an ommission,
> but well, happens).  And third even for our C++ needs (based on the
> Itanium ABI) I feel it's simply more clear and self-sufficient to be
> explicit about this restriction.
>
> It's not that we have any sort of upper bound on the number of words we're
> allowed to use in the psABI, and I also don't think anything is gained by
> being as terse as possible.  Succinct, sure, but not as arcane as we can
> make it while still being correct.
>
> So, question back: can you imaging any cases where the "restriction" to
> trivially copyable would _not_ do the thing we want?

I thought

---
An empty type is a type where it and all of its subobjects (recursively)
are of class, structure, union, or array type.
---

excluded

struct empty
{
empty () = default;
};

Adding "trivially copyable" extends, not limiting, the scope of
empty type.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]