From: YunQiang Su <syq@gcc.gnu.org>
To: gcc-patches@gcc.gnu.org
Cc: pinskia@gcc.gnu.org, i@maskray.me, rguenther@suse.de
Subject: [PATCH] Predefine __STRICT_ALIGN__ if STRICT_ALIGNMENT
Date: Sun, 17 Mar 2024 13:46:31 +0800 [thread overview]
Message-ID: <20240317054631.848645-1-syq@gcc.gnu.org> (raw)
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_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__");
}
--
2.39.2
next reply other threads:[~2024-03-17 5:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-17 5:46 YunQiang Su [this message]
2024-03-17 6:04 ` Sam James
2024-03-17 7:27 ` YunQiang Su
2024-03-18 7:32 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240317054631.848645-1-syq@gcc.gnu.org \
--to=syq@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=i@maskray.me \
--cc=pinskia@gcc.gnu.org \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).