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 stdint.h to better support these
programs.
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/inttypes.h | 8 ++++++++
2 files changed, 9 insertions(+)
create mode 100644 tools/include/nolibc/inttypes.h
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index 4f617d91a5ff..0d312f1159ec 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -33,6 +33,7 @@ all_files := \
errno.h \
fcntl.h \
getopt.h \
+ inttypes.h \
limits.h \
math.h \
nolibc.h \
diff --git a/tools/include/nolibc/inttypes.h b/tools/include/nolibc/inttypes.h
new file mode 100644
index 000000000000..1088034ef7cc
--- /dev/null
+++ b/tools/include/nolibc/inttypes.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+
+#ifndef _NOLIBC_INTTYPES_H
+#define _NOLIBC_INTTYPES_H
+
+#include "stdint.h"
+
+#endif /* _NOLIBC_INTTYPES_H */
--
2.17.5
On 2025-11-02 11:46:09+0100, Willy Tarreau wrote: > 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 stdint.h to better support these > programs. > > Signed-off-by: Willy Tarreau <w@1wt.eu> > --- > tools/include/nolibc/Makefile | 1 + > tools/include/nolibc/inttypes.h | 8 ++++++++ > 2 files changed, 9 insertions(+) > create mode 100644 tools/include/nolibc/inttypes.h I think this should also interact with the big nolibc.h. Both being included from it and including it itself, to follow the generally used pattern. Thomas
On Sun, Nov 02, 2025 at 12:04:01PM +0100, Thomas Weißschuh wrote: > On 2025-11-02 11:46:09+0100, Willy Tarreau wrote: > > 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 stdint.h to better support these > > programs. > > > > Signed-off-by: Willy Tarreau <w@1wt.eu> > > --- > > tools/include/nolibc/Makefile | 1 + > > tools/include/nolibc/inttypes.h | 8 ++++++++ > > 2 files changed, 9 insertions(+) > > create mode 100644 tools/include/nolibc/inttypes.h > > I think this should also interact with the big nolibc.h. > Both being included from it and including it itself, to follow the > generally used pattern. > You mean you'd prefer "include nolibc.h" from inttypes and "include inttypes" from nolibc, that's it ? Willy
Nov 2, 2025 12:18:57 Willy Tarreau <w@1wt.eu>: > On Sun, Nov 02, 2025 at 12:04:01PM +0100, Thomas Weißschuh wrote: >> On 2025-11-02 11:46:09+0100, Willy Tarreau wrote: >>> 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 stdint.h to better support these >>> programs. >>> >>> Signed-off-by: Willy Tarreau <w@1wt.eu> >>> --- >>> tools/include/nolibc/Makefile | 1 + >>> tools/include/nolibc/inttypes.h | 8 ++++++++ >>> 2 files changed, 9 insertions(+) >>> create mode 100644 tools/include/nolibc/inttypes.h >> >> I think this should also interact with the big nolibc.h. >> Both being included from it and including it itself, to follow the >> generally used pattern. >> > > You mean you'd prefer "include nolibc.h" from inttypes and > "include inttypes" from nolibc, that's it ? Yep. Thomas
© 2016 - 2026 Red Hat, Inc.