[PATCH 1/4] Remove unnecessary non-standard & unportable inclusions.

Nick Alcock nick.alcock@oracle.com
Tue Feb 25 21:10:12 GMT 2025


From: Jonas 'Sortie' Termansen <sortie@maxsi.org>

<memory.h> is not needed and not standardized and is just an alias for
<string.h>.

<sys/param.h> is not needed and not standardized and contains a kitchen
sink of various unportable definitions not agreed upon and best done
manually or through other headers.

These fixes are needed to compile binutils on Sortix and other operating
systems with a strict POSIX.1-2024 libc without obsolete features.

Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
---
 binutils/testsuite/gentestdlls.c | 1 -
 libctf/ctf-create.c              | 1 -
 libctf/ctf-impl.h                | 1 -
 3 files changed, 3 deletions(-)

Part of this isnt in libctf/, but I figure it's obvious enough that I can
check it in as obvious. (I've thrown it, and this whole series, past the
trybots and my usual ever-more-over-the-top test matrix, which now includes
mingw-ucrt, allowing me to test ctf_link() on Windows for the first time.)

diff --git a/binutils/testsuite/gentestdlls.c b/binutils/testsuite/gentestdlls.c
index 805c64822b1..df60b1e341e 100644
--- a/binutils/testsuite/gentestdlls.c
+++ b/binutils/testsuite/gentestdlls.c
@@ -25,7 +25,6 @@
    See:
    https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf  */
 
-#include <memory.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index a4d8e7c2528..6d2479c8cca 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -18,7 +18,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <ctf-impl.h>
-#include <sys/param.h>
 #include <string.h>
 #include <unistd.h>
 
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index b40c8679c4a..2d191b0a5c9 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -22,7 +22,6 @@
 
 #include "config.h"
 #include <errno.h>
-#include <sys/param.h>
 #include "ctf-decls.h"
 #include <ctf-api.h>
 #include "ctf-sha1.h"
-- 
2.48.1.283.g18c60a128c



More information about the Binutils mailing list