blob: 0f8d5da24a6455f53d586a7c50405d83e46d1aac [file] [log] [blame]
Eli Friedman3c0eb162008-05-27 03:33:27 +00001// RUN: clang -fsyntax-only -verify %s
2
3typedef int i16_1 __attribute((mode(HI)));
4int i16_1_test[sizeof(i16_1) == 2 ? 1 : -1];
5typedef int i16_2 __attribute((__mode__(__HI__)));
6int i16_2_test[sizeof(i16_1) == 2 ? 1 : -1];
7
8typedef float f64 __attribute((mode(DF)));
9int f64_test[sizeof(f64) == 8 ? 1 : -1];
10
11typedef int invalid_1 __attribute((mode)); // expected-error{{attribute requires unquoted parameter}}
12typedef int invalid_2 __attribute((mode())); // expected-error{{attribute requires unquoted parameter}}
13typedef int invalid_3 __attribute((mode(II))); // expected-error{{unknown machine mode}}
14typedef struct {int i,j,k;} invalid_4 __attribute((mode(SI))); // expected-error{{mode attribute only supported for integer and floating-point types}}
15typedef float invalid_5 __attribute((mode(SI))); // expected-error{{type of machine mode does not match type of base type}}
Chris Lattnere5c5ee12008-06-29 00:16:31 +000016
17int **__attribute((mode(QI)))* i32; // expected-error{{mode attribute}}