jyknight added inline comments.

================
Comment at: lib/Driver/ToolChains/Linux.cpp:755
+        !Version.isOlderThan(4, 8, 0)) {
+      // For gcc >= 4.8.x, clang will preinclude <stdc-predef.h>
+      // -ffreestanding suppresses this behavior.
----------------
jyknight wrote:
> I don't see why it makes any sense to condition this based on a GCC 
> installation existing and being >= 4.8, since this header comes from libc, 
> and is necessary for standards compliance even if there's absolutely no GCC 
> installed or involved.
> 
> Additionally, something like this -- a way for the libc to be involved in 
> setting up predefined macros -- seems probably necessary for *any* libc, if 
> they want to be strictly standards-compliant. Some of the 
> required-to-be-predefined macros like `__STDC_ISO_10646__` can only really be 
> provided by the libc, since the appropriate value is dependent on the locale 
> implementation in the libc, and not on the compiler at all.
> 
> It's possible that glibc on Linux is the only one who's cared to implement it 
> thus far (and, only when you're using GCC, at that, hence this change...). 
> That seems likely, really, since mostly the impacted macros are nearly 
> useless, so who cares... :) However, if others want to be conforming, I 
> expect they _ought_ to be using this mechanism, as well...
> 
> Thus, perhaps it ought to be an unconditional behavior of clang to include 
> the file if it exists, unless `-ffreestanding` is passed.
This is still checking GCCInstallation.isValid(), OPT_nostdinc, and only 
attempting to load the header on Linux OSes.

I don't think it shouldn't be conditioned by the former two, and I think it 
should attempt to include stdc-predef.h if it exists on *all* OSes, not just 
Linux (for the reasons described in the above comment).


https://reviews.llvm.org/D34158



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to