diff options
author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2021-06-16 14:35:11 +0100 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2021-06-27 18:35:02 +0000 |
commit | f8c7069a46af185e0bfaa43d63d450c9a44787ba (patch) | |
tree | 2a40e14cb0c4dc0676b4d424363af6e72627439d /include | |
parent | dd3e028d2a1bc5daf87865ca1e5e923000186af8 (diff) |
Fix XrmResource layout if pointers are bigger than long
On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice
the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit
RISC-V). However, XtArgVal is currently defined as long, so it cannot
be used to store pointers on these architectures.
Also add a _Static_assert() when compiling with C11 support to check
that the offset of the last member matches that of XtResource.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/X11/IntrinsicP.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/X11/IntrinsicP.h b/include/X11/IntrinsicP.h index 9f1ae40..21c5aca 100644 --- a/include/X11/IntrinsicP.h +++ b/include/X11/IntrinsicP.h @@ -56,14 +56,19 @@ SOFTWARE. * are not the same size on all systems. */ typedef struct { - long xrm_name; /* Resource name quark */ - long xrm_class; /* Resource class quark */ - long xrm_type; /* Resource representation type quark */ + XtIntPtr xrm_name; /* Resource name quark */ + XtIntPtr xrm_class; /* Resource class quark */ + XtIntPtr xrm_type; /* Resource representation type quark */ Cardinal xrm_size; /* Size in bytes of representation */ int xrm_offset; /* -offset-1 */ - long xrm_default_type; /* Default representation type quark */ + XtIntPtr xrm_default_type; /* Default representation type quark */ XtPointer xrm_default_addr; /* Default resource address */ } XrmResource, *XrmResourceList; +#if __STDC_VERSION__ >= 201112L +_Static_assert(XtOffsetOf(XrmResource, xrm_default_addr) == + XtOffsetOf(XtResource, default_addr), + "Field offset mismatch"); +#endif typedef unsigned long XtVersionType; |