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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 14:16:04 PDT 2018


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 actually GCC and not Clang or ICC in emulation?

  #if defined(__GNU_C__) && !defined(__clang__)
  // we're gcc
  #elif defined(__clang__)
  // we're clang
  #elif defined(__INTEL_COMPILER)
  // we're icc
  #endif

Or maybe:

  #ifdef(__clang__)
  // we're clang
  #elif defined(__INTEL_COMPILER)
  // we're icc
  #else
  // default to gcc
  #endif

Maybe GCC has something better for this case than `__GNU_C__`?

Regarding the glibc headers, do you know why glibc doesn't just add code for `__clang__` rather than Clang (and ICC) claim to be a gcc compatible to a point compiler?

Regarding the command line addition, I'd prefer to fix the kernel's compiler detection, but I will keep your idea in mind.  It's good to have a few solutions in our back pockets should the preferred be shown to be faulty.

Thanks again.


Repository:
  rC Clang

https://reviews.llvm.org/D51011





More information about the cfe-commits mailing list