Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jul 2025 17:57:02 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fb84b9f400d2 - main - kern_descrip.c: only allow complex expression in Static_assert() for clang
Message-ID:  <202507121757.56CHv2Vi075595@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=fb84b9f400d2d2bb8e1336fbacc7fbd14d31974b

commit fb84b9f400d2d2bb8e1336fbacc7fbd14d31974b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-11 18:57:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-07-12 17:56:13 +0000

    kern_descrip.c: only allow complex expression in Static_assert() for clang
    
    gcc cannot compute the assert expression, which is formally not required
    by a C standard.
    
    Reported and reviewed by:       jhb
    Sponsored by:   The FreeBSD Foundation
---
 sys/kern/kern_descrip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 93bdd41d1515..c4f5e586b0ed 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -557,8 +557,10 @@ open_to_fde_flags(int open_flags, bool sticky_orb)
 		{ .f = O_CLOFORK,		.t = UF_FOCLOSE },
 		{ .f = O_RESOLVE_BENEATH,	.t = UF_RESOLVE_BENEATH },
 	};
+#ifdef __clang__
 	_Static_assert(open_to_fde_flags_s[nitems(open_to_fde_flags_s) - 1].f ==
 	    O_RESOLVE_BENEATH, "O_RESOLVE_BENEATH must be last, for sticky_orb");
+#endif
 
 	return (flags_trans(open_to_fde_flags_s, nitems(open_to_fde_flags_s) -
 	    (sticky_orb ? 0 : 1), open_flags));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507121757.56CHv2Vi075595>