align_value.c 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. // RUN: %clang_cc1 -fsyntax-only -verify %s
  2. typedef double * __attribute__((align_value(64))) aligned_double;
  3. void foo(aligned_double x, double * y __attribute__((align_value(32)))) { };
  4. // expected-error@+1 {{requested alignment is not a power of 2}}
  5. typedef double * __attribute__((align_value(63))) aligned_double1;
  6. // expected-error@+1 {{requested alignment is not a power of 2}}
  7. typedef double * __attribute__((align_value(-2))) aligned_double2;
  8. // expected-error@+1 {{attribute takes one argument}}
  9. typedef double * __attribute__((align_value(63, 4))) aligned_double3;
  10. // expected-error@+1 {{attribute takes one argument}}
  11. typedef double * __attribute__((align_value())) aligned_double3a;
  12. // expected-error@+1 {{attribute takes one argument}}
  13. typedef double * __attribute__((align_value)) aligned_double3b;
  14. // expected-error@+1 {{'align_value' attribute requires integer constant}}
  15. typedef double * __attribute__((align_value(4.5))) aligned_double4;
  16. // expected-warning@+1 {{'align_value' attribute only applies to a pointer or reference ('int' is invalid)}}
  17. typedef int __attribute__((align_value(32))) aligned_int;
  18. typedef double * __attribute__((align_value(32*2))) aligned_double5;
  19. // expected-warning@+1 {{'align_value' attribute only applies to variables and typedefs}}
  20. void foo() __attribute__((align_value(32)));