On Sun, 17 Mar 2024, YunQiang Su wrote: > Arm32 predefines __ARM_FEATURE_UNALIGNED if -mno-unaligned-access, > and RISC-V predefines __riscv_misaligned_avoid, while other ports > that support -mstrict-align/-mno-unaligned-access don't have such > macro, and these backend macros are only avaiable for c-family. > Note: Arm64 always predefine __ARM_FEATURE_UNALIGNED: See #111555. > > Let's add a generic one.
STRICT_ALIGNMENT is supposed to be gone, it doesn't tell the full truth so exposing it will cause more confusion only. Nak. Richard. > __STRICT_ALIGN__ is used instead of __STRICT_ALIGNMENT__, due to that > the later is used by some softwares, such as lzo2, syslinux etc. > > gcc > * cppbuiltin.cc: Predefine __STRICT_ALIGNMENT__ if > STRICT_ALIGNMENT. > --- > gcc/cppbuiltin.cc | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/cppbuiltin.cc b/gcc/cppbuiltin.cc > index c4bfc2917dc..d32efdf9a07 100644 > --- a/gcc/cppbuiltin.cc > +++ b/gcc/cppbuiltin.cc > @@ -123,6 +123,9 @@ define_builtin_macros_for_compilation_flags (cpp_reader > *pfile) > > cpp_define_formatted (pfile, "__FINITE_MATH_ONLY__=%d", > flag_finite_math_only); > + > + if (STRICT_ALIGNMENT) > + cpp_define (pfile, "__STRICT_ALIGNMENT__"); > } > > > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)