WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Compiler.h
1 //===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines several macros, based on the current compiler. This allows
11 // use of compiler-specific features in a way that remains portable.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_SUPPORT_COMPILER_H
16 #define LLVM_SUPPORT_COMPILER_H
17 
18 #ifndef __has_feature
19 # define __has_feature(x) 0
20 #endif
21 
22 #ifndef __has_extension
23 # define __has_extension(x) 0
24 #endif
25 
26 #ifndef __has_attribute
27 # define __has_attribute(x) 0
28 #endif
29 
30 #ifndef __has_builtin
31 # define __has_builtin(x) 0
32 #endif
33 
37 #ifndef LLVM_GNUC_PREREQ
38 # if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
39 # define LLVM_GNUC_PREREQ(maj, min, patch) \
40  ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \
41  ((maj) << 20) + ((min) << 10) + (patch))
42 # elif defined(__GNUC__) && defined(__GNUC_MINOR__)
43 # define LLVM_GNUC_PREREQ(maj, min, patch) \
44  ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
45 # else
46 # define LLVM_GNUC_PREREQ(maj, min, patch) 0
47 # endif
48 #endif
49 
50 #ifndef LLVM_ATTRIBUTE_UNUSED_RESULT
51 #if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0)
52 #define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__))
53 #else
54 #define LLVM_ATTRIBUTE_UNUSED_RESULT
55 #endif
56 #endif
57 
58 #ifndef LLVM_UNLIKELY
59 #if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0)
60 #define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true)
61 #define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false)
62 #else
63 #define LLVM_LIKELY(EXPR) (EXPR)
64 #define LLVM_UNLIKELY(EXPR) (EXPR)
65 #endif
66 #endif
67 
68 #endif