Adjust empty class parameter passing ABI (PR c++/60336)

Jason Merrill jason@redhat.com
Fri Nov 3 16:19:00 GMT 2017


On Fri, Nov 3, 2017 at 9:55 AM, Marek Polacek <polacek@redhat.com> wrote:
> +  TYPE_EMPTY_P (t) = targetm.calls.empty_record_p (t);

I think we want to set this in finalize_type_size; since the point of
all this is becoming compliant with the psABI (and compatible with the
C front end), I wouldn't think it should be specific to the C++ front
end.

> +  TYPE_WARN_EMPTY_P (t) = warn_abi && abi_version_crosses (12);

Can this flag go on the TRANSLATION_UNIT_DECL rather than the type?

> + if (TREE_CODE (field) == FIELD_DECL
> +     && (DECL_NAME (field)
> +         || RECORD_OR_UNION_TYPE_P (TREE_TYPE (field)))
> +     && !default_is_empty_type (TREE_TYPE (field)))
> +    return false;
> +  return true;

Hmm, this assumes that any unnamed field can be ignored; I'm concerned
that some front end might clear DECL_NAME for a reason that doesn't
imply that the field is just padding.

Jason



More information about the Gcc-patches mailing list