Skip to contentSkip to conversation

tools/nolibc: add the more portable inttypes.h

PATCH New Willy Tarreau 1 participant 1 message Nov 2, 2025 Nolibc header file

lore
Share & tools
lore

Willy Tarreau

author maintainer
#0 lore raw

PATCH v3 1/1 tools/nolibc: add the more portable inttypes.h

It's often recommended to only use inttypes.h instead of stdint.h for portability reasons since the former is always present when the latter is present, but not conversely, and the former includes the latter. Due to this some simple programs fail to build when including inttypes.h. Let's add one that simply includes nolibc.h to better support these programs.

---
v3:
- include nolibc.h instead of stdint.h from inttypes.h so that everything is known at once. Just like with limits.h, this file is nothing more than a convenience for users to port applications and doesn't provide anything, so there's no point including it from nolibc.h

 tools/include/nolibc/Makefile   | 1 +
 tools/include/nolibc/inttypes.h | 2 ++
 2 files changed, 3 insertions(+)
 create mode 100644 tools/include/nolibc/inttypes.h
tools/include/nolibc/Makefile +1 -0
index 585937c7d346..ff0e646acda9 100644
@@ -33,6 +33,7 @@ all_files := \
 		errno.h \
 		fcntl.h \
 		getopt.h \
+		inttypes.h \
 		limits.h \
 		math.h \
 		nolibc.h \
tools/include/nolibc/inttypes.h new file +2 -0
new file mode 100644
index 000000000000..8db9c2542b44
@@ -0,0 +1,2 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+#include "nolibc.h"
Signature · 1 line
2.17.5