blob: 4d6ce288927c642308e2c1b8f0496d0fa2f745c4 [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}}
Eli Friedman73397492009-03-03 06:41:03 +000018
19typedef _Complex double c32 __attribute((mode(SC)));
20int c32_test[sizeof(c32) == 8 ? 1 : -1];
21typedef _Complex float c64 __attribute((mode(DC)));
22typedef _Complex float c80 __attribute((mode(XC)));