Skip to content

Allow specifying the alignment of extern structs #13009

Closed as not planned
Closed as not planned
@ghost

Description

This is a follow-up to #10113: #10113 (comment)
We need an addition to the language that allows us to specify the alignment of extern structs.
The UEFI libs are particularly broken because since #10113 any packed struct with an array or any extern struct in it isn't a valid packed type.
In order to make std.os.uefi work with self-hosted, #12899 was an effort to make it easier to add align(1) to every field of a struct. The problem is that it might not work that well considering that structs with decls can't be reified because of #6709.
But instead of allowing #6709 (which might be a bad idea) and then using CPacked, it's probably best to allow specifying the alignment of extern structs at the language level.

A good syntax for this would be extern struct align(alignment) {}.

See also: #12745 #12897 #12993

CC @fifty-six

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions