[all-commits] [llvm/llvm-project] a649e0: [clang][modules] giving the __stddef_ headers thei...

Ian Anderson via All-commits all-commits at lists.llvm.org
Fri Mar 15 17:08:03 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: a649e0a6e80f5ae26657b640de469e8a53244ad2
      https://github.com/llvm/llvm-project/commit/a649e0a6e80f5ae26657b640de469e8a53244ad2
  Author: Ian Anderson <iana at apple.com>
  Date:   2024-03-15 (Fri, 15 Mar 2024)

  Changed paths:
    M clang/lib/Basic/Module.cpp
    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/module.modulemap
    M clang/lib/Lex/ModuleMap.cpp
    M clang/test/Modules/no-undeclared-includes-builtins.cpp
    M clang/test/Modules/stddef.c

  Log Message:
  -----------
  [clang][modules] giving the __stddef_ headers their own modules can cause redeclaration errors with -fbuiltin-headers-in-system-modules (#84127)

On Apple platforms, some of the stddef.h types are also declared in
system headers. In particular NULL has a conflicting declaration in
<sys/_types/_null.h>. When that's in a different module from
<__stddef_null.h>, redeclaration errors can occur.

Make the \_\_stddef_ headers be non-modular in
-fbuiltin-headers-in-system-modules and restore them back to not
respecting their header guards. Still define the header guards though.
__stddef_max_align_t.h was in _Builtin_stddef_max_align_t prior to the
addition of _Builtin_stddef, and it needs to stay in a module because
struct's can't be type merged. __stddef_wint_t.h didn't used to have a
module, but leave it in it current module since it doesn't really belong
to stddef.h.

(cherry picked from commit f50d3582b4844b86ad86372028e44b52c560ec7d)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list