[Bug 283917] libc failes to include stdint.h with clang>16 and -ffreestanding

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 08 Jan 2025 13:40:26 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283917

--- Comment #2 from keve@keve.hu ---
Hi Konstantin, 
thank you for looking at this.
I tend to read it differently:


The ISO C standard defines (in clause 4) two classes of conforming
implementation. A conforming hosted implementation supports the whole standard
including all the library facilities; a conforming freestanding implementation
is only required to provide certain library facilities: those in <float.h>,
<limits.h>, <stdarg.h>, and <stddef.h>; since AMD1, also those in <iso646.h>;
since C99, also those in <stdbool.h> and <stdint.h>; and since C11, also those
in <stdalign.h> and <stdnoreturn.h>. In addition, complex types, added in C99,
are not required for freestanding implementations.

So since C99 it is ok to assume presence of and include stdint.h even with
-ffreestanding.
Clang starting with 17 implements C99.

Also the standard says that a freestanding implementation _may_ not implement
these headers, it does not say anything about it _must_ not implement them.

Btw. just confirmed that  NetBSD 10.1 can compile this as well.

-nostdinc is unfortunately not a viable workaround.

Please reconsider your assessment whether this is an issue with FreeBSD libc,
or not.

Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.