OSDN Git Service

Use Clang's __has_* macros in Compiler.h to test for features
authorReid Kleckner <reid@kleckner.net>
Mon, 8 Jul 2013 15:31:29 +0000 (15:31 +0000)
committerReid Kleckner <reid@kleckner.net>
Mon, 8 Jul 2013 15:31:29 +0000 (15:31 +0000)
commit221f6d777e56517591766a582f542af92d1f19c9
tree6c75a994123c319fea9c47a31f3afce9d3e508f5
parent73e97d0f48cf9ed3093019064f6340617ac8de9e
Use Clang's __has_* macros in Compiler.h to test for features

When targetting Windows, clang does not define __GNUC__, and as a result
we don't use our attributes with it.  This leads to warnings about
unused functions that are already annotated with LLVM_ATTRIBUTE_UNUSED.
Rather than testing for __clang__, we can use its __has_attribute and
__has_builtin macros directlty.

While I'm here, conditionally define and use __GNUC_PREREQ for gcc
version checks.  Spelling the check out with three comparisons is
verbose and error prone.

Reviewers: aaron.ballman

Differential Revision: http://llvm-reviews.chandlerc.com/D1080

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185831 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Compiler.h