Eli Friedman | 3c0eb16 | 2008-05-27 03:33:27 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | |
| 3 | typedef int i16_1 __attribute((mode(HI))); |
| 4 | int i16_1_test[sizeof(i16_1) == 2 ? 1 : -1]; |
| 5 | typedef int i16_2 __attribute((__mode__(__HI__))); |
| 6 | int i16_2_test[sizeof(i16_1) == 2 ? 1 : -1]; |
| 7 | |
| 8 | typedef float f64 __attribute((mode(DF))); |
| 9 | int f64_test[sizeof(f64) == 8 ? 1 : -1]; |
| 10 | |
| 11 | typedef int invalid_1 __attribute((mode)); // expected-error{{attribute requires unquoted parameter}} |
| 12 | typedef int invalid_2 __attribute((mode())); // expected-error{{attribute requires unquoted parameter}} |
| 13 | typedef int invalid_3 __attribute((mode(II))); // expected-error{{unknown machine mode}} |
| 14 | typedef struct {int i,j,k;} invalid_4 __attribute((mode(SI))); // expected-error{{mode attribute only supported for integer and floating-point types}} |
| 15 | typedef float invalid_5 __attribute((mode(SI))); // expected-error{{type of machine mode does not match type of base type}} |
Chris Lattner | e5c5ee1 | 2008-06-29 00:16:31 +0000 | [diff] [blame] | 16 | |
| 17 | int **__attribute((mode(QI)))* i32; // expected-error{{mode attribute}} |
Eli Friedman | 7339749 | 2009-03-03 06:41:03 +0000 | [diff] [blame^] | 18 | |
| 19 | typedef _Complex double c32 __attribute((mode(SC))); |
| 20 | int c32_test[sizeof(c32) == 8 ? 1 : -1]; |
| 21 | typedef _Complex float c64 __attribute((mode(DC))); |
| 22 | typedef _Complex float c80 __attribute((mode(XC))); |