From 48b4ba967a3c04c7dd263e775e0cbbb03ed58e8f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 20 May 2022 06:38:44 -0700 Subject: ffi: behavior of align subject to compat. * ffi.c (ffi_type_compile): Allow align to weaken (lower) alignment if compatibility 275 or lower is requested. * txr.1: Compat note added. --- ffi.c | 3 ++- txr.1 | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ffi.c b/ffi.c index e0276ec7..8f482e9a 100644 --- a/ffi.c +++ b/ffi.c @@ -4358,7 +4358,8 @@ val ffi_type_compile(val syntax) } else { val altype_copy = ffi_type_copy(altype); struct txr_ffi_type *atft = ffi_type_struct(altype_copy); - if (al > atft->align || sym == pack_s) + if (al > atft->align || sym == pack_s || + (opt_compat && opt_compat <= 275)) atft->align = al; return altype_copy; } diff --git a/txr.1 b/txr.1 index 3f7a4170..426530cb 100644 --- a/txr.1 +++ b/txr.1 @@ -88335,6 +88335,22 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 275 +In \*(TX 275 and older versions, the FFI type operator +.code align +can weaken the alignment of a type. The current behavior is that it can +only increase the strictness of alignment, which mimics the +.code aligned +type attribute found in GNU C. For instance +.code "(align 2 int)" +will not have an effect, because 2 is lower than the alignment of +.codn int . +The +.code pack +type operator must be used instead to specify any alignment, including +lower. A compatibility value of 275 or lower restores the ability of +.code align +to specify weaker alignment. .IP 273 In \*(TX 273 and older versions, .code lazy-str-get-trailing-list -- cgit v1.2.3