[all-commits] [llvm/llvm-project] c08d5c: [clang][Driver] Include stdc-predef.h by default o...

Jonathan Thackray via All-commits all-commits at lists.llvm.org
Wed Jun 10 03:33:13 PDT 2026


  Branch: refs/heads/users/jthackray/resurrect_stdc-predef_h_patch
  Home:   https://github.com/llvm/llvm-project
  Commit: c08d5cd16f173533a9010cf98835be0808a1b045
      https://github.com/llvm/llvm-project/commit/c08d5cd16f173533a9010cf98835be0808a1b045
  Author: Jonathan Thackray <jonathan.thackray at arm.com>
  Date:   2026-06-10 (Wed, 10 Jun 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Driver/ToolChains/Linux.cpp
    A clang/test/Driver/Inputs/stdc-predef/preprocessed.i
    A clang/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h
    A clang/test/Driver/stdc-predef.c

  Log Message:
  -----------
  [clang][Driver] Include stdc-predef.h by default on musl

Match GCC behavior for musl-based Linux targets by implicitly passing
`-include stdc-predef.h` for non-freestanding compilations.

Unlike glibc, musl does not arrange for this header to be included through
its normal system headers. As a result, Clang may miss predefined C macros
provided by musl's stdc-predef.h unless users include it manually, while the
same code works with GCC.

Add Driver tests covering musl, non-musl, freestanding, preprocessed input,
missing-header diagnostics, and actual macro visibility.

This patch is based on: https://reviews.llvm.org/D137043 and
slightly tweaks it, as the code has drifted since 2023 when
that was authored.

Co-authored-by: Tao Liang <Origami404 at foxmail.com>
Co-authored-by: YingChi Long <me at inclyc.cn>



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