[PATCH] D12747: Implement [depr.c.headers]

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 07:07:08 PDT 2015


mclow.lists added a comment.

I have two concerns about this patch (w/o commenting on the actual code).

1. Until very recently, I was under the impression that C libraries _either_ defined a macro, or had a function. I was quite surprised to find that glibc did both. Have you checked other C libraries (Apple, FreeBSD, Android, Windows) to see if they also define both?  The purpose of this code:



  #ifdef getc
  inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
  #undef getc
  inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
  #endif  // getc

is to (a) remove the macro `getc`, since we are required to define `std::getc` and (b) to provide a global function with the same functionality that we can hoist into namespace `std`.

2. This adds a lot of header files. Each header file slows down compilation, and standard library header files get included *a lot*. We may not be able to avoid this, but we should think about the costs here.


Repository:
  rL LLVM

http://reviews.llvm.org/D12747





More information about the cfe-commits mailing list