[PATCH] D159064: [Modules] Make clang modules for the C standard library headers

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 15:08:43 PDT 2023


dexonsmith added inline comments.


================
Comment at: clang/test/Modules/Inputs/System/usr/include/stdint.h:2
 typedef int my_awesome_nonstandard_integer_type;
+
+/* C99 7.18.1.1 Exact-width integer types.
----------------
benlangmuir wrote:
> iana wrote:
> > iana wrote:
> > > benlangmuir wrote:
> > > > Why do we need all this code now (I assume this is copied from the real header)?
> > > It's to support the tests I added to Modules/compiler_builtins.m. stdatomic.h and inttypes.h rely on stdint.h contents from the C library, and on complex.h and inttypes.h and math.h being present. I could just test the modules with `-ffreestanding` I think, would that be better?
> > (and yes I just copied it from the builtin header)
> I'm not sure what the best approach is here, but this seems heavy for a test.  Do we expect to need to keep this up to date? If so maybe ffreestanding for the specific test cases this affects would be a better tradeoff.  Maybe someone else has a suggestion here
This reflects *most* of the content in `stdint.h`.

One idea would be to copy the full header over during the test setup and fix it up, either:
- strip out the header/footer or
- `sed -e "s/__STDC_HOSTED__/0/g"`
so that it always provides content (even when not freestanding).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159064/new/

https://reviews.llvm.org/D159064



More information about the cfe-commits mailing list