comparison clang/test/Sema/align_value.c @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children c4bab56944e8
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 typedef double * __attribute__((align_value(64))) aligned_double;
4
5 void foo(aligned_double x, double * y __attribute__((align_value(32)))) { };
6
7 // expected-error@+1 {{requested alignment is not a power of 2}}
8 typedef double * __attribute__((align_value(63))) aligned_double1;
9
10 // expected-error@+1 {{requested alignment is not a power of 2}}
11 typedef double * __attribute__((align_value(-2))) aligned_double2;
12
13 // expected-error@+1 {{attribute takes one argument}}
14 typedef double * __attribute__((align_value(63, 4))) aligned_double3;
15
16 // expected-error@+1 {{attribute takes one argument}}
17 typedef double * __attribute__((align_value())) aligned_double3a;
18
19 // expected-error@+1 {{attribute takes one argument}}
20 typedef double * __attribute__((align_value)) aligned_double3b;
21
22 // expected-error@+1 {{'align_value' attribute requires integer constant}}
23 typedef double * __attribute__((align_value(4.5))) aligned_double4;
24
25 // expected-warning@+1 {{'align_value' attribute only applies to a pointer or reference ('int' is invalid)}}
26 typedef int __attribute__((align_value(32))) aligned_int;
27
28 typedef double * __attribute__((align_value(32*2))) aligned_double5;
29
30 // expected-warning@+1 {{'align_value' attribute only applies to variables and typedefs}}
31 void foo() __attribute__((align_value(32)));
32