[all-commits] [llvm/llvm-project] 9a7a6d: [Modules] Make clang modules for the C standard li...

Ian Anderson via All-commits all-commits at lists.llvm.org
Tue Oct 3 12:41:27 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4
      https://github.com/llvm/llvm-project/commit/9a7a6dd3c358ca7becef75c0a9581dcfa3e6b5f4
  Author: Ian Anderson <iana at apple.com>
  Date:   2023-10-03 (Tue, 03 Oct 2023)

  Changed paths:
    M clang/lib/Basic/Module.cpp
    M clang/lib/Headers/__stddef_max_align_t.h
    M clang/lib/Headers/__stddef_null.h
    M clang/lib/Headers/__stddef_nullptr_t.h
    M clang/lib/Headers/__stddef_offsetof.h
    M clang/lib/Headers/__stddef_ptrdiff_t.h
    M clang/lib/Headers/__stddef_rsize_t.h
    M clang/lib/Headers/__stddef_size_t.h
    M clang/lib/Headers/__stddef_unreachable.h
    M clang/lib/Headers/__stddef_wchar_t.h
    M clang/lib/Headers/__stddef_wint_t.h
    M clang/lib/Headers/module.modulemap
    M clang/lib/Headers/stdarg.h
    M clang/lib/Headers/stddef.h
    M clang/test/Headers/stdarg.c
    M clang/test/Headers/stdargneeds.c
    M clang/test/Headers/stddef.c
    M clang/test/Headers/stddefneeds.c
    A clang/test/Modules/Inputs/System/usr/include/complex.h
    A clang/test/Modules/Inputs/System/usr/include/inttypes.h
    A clang/test/Modules/Inputs/System/usr/include/math.h
    M clang/test/Modules/Inputs/System/usr/include/module.map
    M clang/test/Modules/Inputs/System/usr/include/stdint.h
    M clang/test/Modules/compiler_builtins.m
    M clang/test/Modules/stddef.c
    M clang/test/Modules/stddef.m

  Log Message:
  -----------
  [Modules] Make clang modules for the C standard library headers

Make top level modules for all the C standard library headers.

The `__stddef` implementation headers need header guards now that they're all modular. stdarg.h and stddef.h will be textual headers in the builtin modules, and so need to be repeatedly included in both the system and builtin module case. Define their header guards for consistency, but ignore them when building with modules.

`__stddef_null.h` needs to ignore its header guard when modules aren't being used to fulfill its redefinition obligation.
`__stddef_nullptr_t.h` needs to add a guard for C23 so that `_Builtin_stddef` can compile in C17 and earlier modes. `_Builtin_stddef.nullptr_t` can't require C23 because it also needs to be usable from C++.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D159064




More information about the All-commits mailing list