feature_tests.c revision 5297d71e8c85f9b04dc31c690e91c6a2f7eddb90
1// RUN: %clang_cc1 %s -triple=i686-apple-darwin9
2// RUN: %clang_cc1 %s -E -triple=i686-apple-darwin9
3#ifndef __has_feature
4#error Should have __has_feature
5#endif
6
7
8#if __has_feature(something_we_dont_have)
9#error Bad
10#endif
11
12#if  !__has_builtin(__builtin_huge_val) || \
13     !__has_builtin(__builtin_shufflevector) || \
14     !__has_builtin(__builtin_trap) || \
15     !__has_feature(attribute_analyzer_noreturn) || \
16     !__has_feature(attribute_overloadable)
17#error Clang should have these
18#endif
19
20#if __has_builtin(__builtin_insanity)
21#error Clang should not have this
22#endif
23
24#if !__has_feature(__attribute_deprecated_with_message__)
25#error Feature name in double underscores does not work
26#endif
27
28// Make sure we have x86 builtins only (forced with target triple).
29
30#if !__has_builtin(__builtin_ia32_emms) || \
31    __has_builtin(__builtin_altivec_abs_v4sf)
32#error Broken handling of target-specific builtins
33#endif
34