[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-23 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Kernel patch: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=815f0ddb346c196018d4d8f8f55c12b83da1de3f Thanks Eli and Richard, I appreciate it. Repository: rC Clang https://reviews.llvm.org/D51011

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-21 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Thanks Eli. I wholeheartedly prefer feature detection to explicit version checks. One thing that makes this hard is the lack of __has_attribute in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970. Repository: rC Clang

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-21 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. I'd suggest something like this, if you really need to detect the compiler: #if defined(__clang__) // clang #elif defined(__INTEL_COMPILER) // icc #elif defined(__GNUC__) // gcc #else #error "Unknown compiler" #endif > Regarding the glibc headers,

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-21 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Richard, Thanks for the review, context, and suggestions. I appreciate it. > Can you instead change the kernel to require GCC >= 4.6 or some suitable > version of Clang? Can you help me create an accurate C preprocessor check that the compiler in use is

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-20 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. Another possibility would be to add a command-line argument to set the version of GCC that clang pretends to be. We have a similar mechanism for our MSVC compatibility mode already. Repository: rC Clang https://reviews.llvm.org/D51011

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-20 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. We are not fully compatible with any version of GCC later than 4.2, as we do not implement `__builtin_va_arg_pack` / `__builtin_va_arg_pack_len`. These builtins are used by the glibc headers if we claim to be GCC >= 4.3 (at least according to

[PATCH] D51011: [Preprocessor] raise gcc compatibility macros.

2018-08-20 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers created this revision. nickdesaulniers added a reviewer: aaron.ballman. Herald added a subscriber: cfe-commits. Building the Linux kernel with clang is now broken as of commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6"). We were getting lucky that Clang