Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 May 2024 17:40:22 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4300e053618f - main - build: Include sys/cdefs.h in our fcntl.h shim
Message-ID:  <202405261740.44QHeMia085409@gitrepo.freebsd.org>

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

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

commit 4300e053618fc4ef54eaaf6229d747489e44fe99
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-05-26 17:38:55 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-26 17:38:55 +0000

    build: Include sys/cdefs.h in our fcntl.h shim
    
    On Linux with musl, sys/cdefs.h isn't included with fcntl.h, so when we
    use __BEGIN_DECL and __END_DECL in this file, it fails. There's no harm
    in unconditionally including sys/cdefs.h here, so do that to avoid
    encoding exactly where it is or isn't needed so we don't have to know
    too much about the internal state of other libc implementations.
    
    Co-authored-by:         Val Packett <val@packett.cool>
    Sponsored by:           Netflix
    Pull Request:           https://github.com/freebsd/freebsd-src/pull/1066
    Reviewed by:            val_packett.cool
    Differential Revision:  https://reviews.freebsd.org/D45351
---
 tools/build/fcntl.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/build/fcntl.h b/tools/build/fcntl.h
index 6aaf3eef2804..f59f5f7fb20a 100644
--- a/tools/build/fcntl.h
+++ b/tools/build/fcntl.h
@@ -29,6 +29,13 @@
 
 #include_next <fcntl.h>
 
+/*
+ * On FreeBSD fcntl.h indirectly brings in cdefs.h. On Linux with musl, it does
+ * not. Unconditionally inlude it here since there's no harm in including it
+ * multiple times since we use __BEGIN_DECLS and __END_DECLS from it below.
+ */
+#include <sys/cdefs.h>
+
 struct spacectl_range {
 	off_t	r_offset;
 	off_t	r_len;



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