From 6d765eee15483bd1f7487e3937093f7905601e7f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 23 Jun 2025 12:02:50 +0900 Subject: [PATCH 1/2] include: make system headers self contained Let's not include any non-system headers in system headers. --- src/basic/include/malloc.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/basic/include/malloc.h b/src/basic/include/malloc.h index 9605180543..d0080b6cbc 100644 --- a/src/basic/include/malloc.h +++ b/src/basic/include/malloc.h @@ -3,8 +3,6 @@ #include_next -#include "macro.h" - #if !HAVE_MALLINFO2 struct mallinfo2 { size_t arena; /* non-mmapped space allocated from system */ @@ -20,9 +18,10 @@ struct mallinfo2 { }; static inline struct mallinfo2 mallinfo2(void) { -DISABLE_WARNING_DEPRECATED_DECLARATIONS + _Pragma("GCC diagnostic push"); + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\""); struct mallinfo m = mallinfo(); -REENABLE_WARNING + _Pragma("GCC diagnostic pop"); return (struct mallinfo2) { .arena = m.arena, From d7c04b4c3b874fc2230af6aab633d0fe2f0e807a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 23 Jun 2025 15:43:04 +0900 Subject: [PATCH 2/2] include: add comment why our sys/mount.h does not include the one by glibc --- src/basic/include/sys/mount.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/basic/include/sys/mount.h b/src/basic/include/sys/mount.h index c79160aff4..9e7d3d74f1 100644 --- a/src/basic/include/sys/mount.h +++ b/src/basic/include/sys/mount.h @@ -13,6 +13,12 @@ #include "missing_fs.h" #include "missing_syscall_def.h" +/* Since glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), sys/mount.h includes linux/mount.h, and + * we can safely include both headers in the same source file. However, we cannot do that with older glibc. + * To avoid conflicts, let's not use glibc's sys/mount.h, and provide our own minimal implementation. + * Fortunately, most of definitions we need are covered by linux/fs.h and linux/mount.h, so only one enum + * and a few function prototypes need to be defined here. */ + /* Possible value for FLAGS parameter of `umount2'. */ enum {