has_attribute.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // RUN: %clang_cc1 -triple arm-unknown-linux -verify -E %s -o - | FileCheck %s
  2. // CHECK: always_inline
  3. #if __has_attribute(always_inline)
  4. int always_inline();
  5. #endif
  6. // CHECK: __always_inline__
  7. #if __has_attribute(__always_inline__)
  8. int __always_inline__();
  9. #endif
  10. // CHECK: no_dummy_attribute
  11. #if !__has_attribute(dummy_attribute)
  12. int no_dummy_attribute();
  13. #endif
  14. // CHECK: has_has_attribute
  15. #ifdef __has_attribute
  16. int has_has_attribute();
  17. #endif
  18. // CHECK: has_something_we_dont_have
  19. #if !__has_attribute(something_we_dont_have)
  20. int has_something_we_dont_have();
  21. #endif
  22. // rdar://10253857
  23. #if __has_attribute(__const)
  24. int fn3() __attribute__ ((__const));
  25. #endif
  26. #if __has_attribute(const)
  27. static int constFunction() __attribute__((const));
  28. #endif
  29. // CHECK: has_no_volatile_attribute
  30. #if !__has_attribute(volatile)
  31. int has_no_volatile_attribute();
  32. #endif
  33. // CHECK: has_arm_interrupt
  34. #if __has_attribute(interrupt)
  35. int has_arm_interrupt();
  36. #endif
  37. // CHECK: does_not_have_dllexport
  38. #if !__has_attribute(dllexport)
  39. int does_not_have_dllexport();
  40. #endif
  41. // CHECK: does_not_have_uuid
  42. #if !__has_attribute(uuid)
  43. int does_not_have_uuid
  44. #endif
  45. #if __has_cpp_attribute(selectany) // expected-error {{token is not a valid binary operator in a preprocessor subexpression}}
  46. #endif