[libcxx-commits] [PATCH] D136683: [libc++] Only include_next C library headers when they exist

Nico Weber via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 22 11:44:40 PST 2022


thakis added a comment.

I just noticed that this leads to atrocious diagnostics:

  % cat hello.cc
  #include <stdio.h>
  int main() { printf("hello\n"); }
  
  % out/gn/bin/clang -c hello.cc      
  hello.cc:2:14: error: use of undeclared identifier 'printf'

???

This works:

  % out/gn/bin/clang -c hello.cc -isysroot $(xcrun -show-sdk-path)

The reason is that stdio.h picks up libc++'s stdio.h, which then only include_next's the actual stdio.h if it exists.

This seems suboptimal (?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136683



More information about the libcxx-commits mailing list