Date: Wed, 8 Oct 2025 09:34:02 GMT From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 9e7eb261e6f9 - main - arch.7: deprecate __ILP32__ and __LP64__ macros Message-ID: <202510080934.5989Y2gr018341@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=9e7eb261e6f965f121515cc52db96ea879b8b384 commit 9e7eb261e6f965f121515cc52db96ea879b8b384 Author: Brooks Davis <brooks@FreeBSD.org> AuthorDate: 2025-10-08 09:30:34 +0000 Commit: Brooks Davis <brooks@FreeBSD.org> CommitDate: 2025-10-08 09:33:40 +0000 arch.7: deprecate __ILP32__ and __LP64__ macros With CHERI there now more options than __ILP32__ and __LP64__ so lack of one does not imply the other. Encourage the use of __SIZEOF_*__ macro tests in their place. Effort: CHERI upstreaming Reviewed by: kib, markj, emaste Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D52820 --- share/man/man7/arch.7 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7 index 5de441aed699..39425f8d5d1b 100644 --- a/share/man/man7/arch.7 +++ b/share/man/man7/arch.7 @@ -340,13 +340,34 @@ cc -x c -dM -E /dev/null .Ed .Pp Common type size and endianness macros: -.Bl -column -offset indent "BYTE_ORDER" "Meaning" +.Bl -column -offset indent "__SIZEOF_POINTER__" "Meaning" .It Sy Macro Ta Sy Meaning +.It Dv __SIZEOF_LONG__ Ta size in bytes of long +.It Dv __SIZEOF_POINTER__ Ta size in bytes of intptr_t and pointers +.It Dv __SIZEOF_SIZE_T__ Ta size in bytes of size_t .It Dv __LP64__ Ta 64-bit (8-byte) long and pointer, 32-bit (4-byte) int .It Dv __ILP32__ Ta 32-bit (4-byte) int, long and pointer .It Dv BYTE_ORDER Ta Either Dv BIG_ENDIAN or Dv LITTLE_ENDIAN . .El .Pp +Because systems were historically either +.Dv __ILP32__ +or +.Dv __LP64__ +it has been common for programmers to test only one and assume the other +one in an else branch. +With the arrival of CHERI architectures, this is no longer the case. +.Dv __SIZEOF_*__ +macros should be used instead. +New uses of +.Dv __ILP32__ +and +.Dv __LP64__ +should be avoided. +Compilers for CHERI targets do not define +.Dv __LP64__ +as their pointers are 128-bit capabilities. +.Pp Architecture-specific macros: .Bl -column -offset indent "Architecture" "Predefined macros" .It Sy Architecture Ta Sy Predefined macros
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510080934.5989Y2gr018341>