Chris Lattner | f5db8f8 | 2009-04-19 07:00:02 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=0 -E %s > %t && |
Daniel Dunbar | 5bea06a | 2008-12-01 19:23:47 +0000 | [diff] [blame] | 2 | |
| 3 | #ifndef __ASSEMBLER__ |
| 4 | #error "__ASSEMBLER__ not defined" |
| 5 | #endif |
Chris Lattner | e966d9a | 2009-03-20 16:28:22 +0000 | [diff] [blame] | 6 | |
| 7 | |
| 8 | // Invalid token pasting is ok. |
| 9 | // RUN: grep '1: X .' %t && |
| 10 | #define A X ## . |
| 11 | 1: A |
| 12 | |
| 13 | // Line markers are not linemarkers in .S files, they are passed through. |
| 14 | // RUN: grep '# 321' %t && |
| 15 | # 321 |
| 16 | |
| 17 | // Unknown directives are passed through. |
| 18 | // RUN: grep '# B C' %t && |
| 19 | # B C |
| 20 | |
| 21 | // Unknown directives are expanded. |
| 22 | // RUN: grep '# BAR42' %t && |
| 23 | #define D(x) BAR ## x |
| 24 | # D(42) |
| 25 | |
| 26 | // Unmatched quotes are permitted. |
| 27 | // RUN: grep "2: '" %t && |
| 28 | // RUN: grep '3: "' %t && |
| 29 | 2: ' |
| 30 | 3: " |
| 31 | |
Daniel Dunbar | c25d805 | 2009-05-22 21:35:34 +0000 | [diff] [blame] | 32 | // (balance quotes to keep editors happy): "' |
| 33 | |
Chris Lattner | e966d9a | 2009-03-20 16:28:22 +0000 | [diff] [blame] | 34 | // Empty char literals are ok. |
| 35 | // RUN: grep "4: ''" %t && |
| 36 | 4: '' |
| 37 | |
Chris Lattner | f1538de | 2009-03-23 17:32:45 +0000 | [diff] [blame] | 38 | |
| 39 | // Portions of invalid pasting should still expand as macros. |
| 40 | // rdar://6709206 |
| 41 | // RUN: grep "5: expanded (" %t && |
| 42 | #define M4 expanded |
| 43 | #define M5() M4 ## ( |
| 44 | |
| 45 | 5: M5() |
| 46 | |
Chris Lattner | f5db8f8 | 2009-04-19 07:00:02 +0000 | [diff] [blame] | 47 | // rdar://6804322 |
| 48 | // RUN: grep -F "6: blarg $foo" %t && |
| 49 | #define FOO(name) name ## $foo |
| 50 | 6: FOO(blarg) |
| 51 | |
| 52 | // RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=1 -E %s > %t && |
| 53 | // RUN: grep -F "7: blarg$foo" %t && |
| 54 | #define FOO(name) name ## $foo |
| 55 | 7: FOO(blarg) |
Chris Lattner | f1538de | 2009-03-23 17:32:45 +0000 | [diff] [blame] | 56 | |
| 57 | |
Daniel Dunbar | c25d805 | 2009-05-22 21:35:34 +0000 | [diff] [blame] | 58 | // |
| 59 | #define T6() T6 #nostring |
| 60 | #define T7(x) T7 #x |
| 61 | T6() |
| 62 | T7(foo) |
| 63 | // RUN: grep 'T6 #nostring' %t && |
| 64 | // RUN: grep 'T7 "foo"' %t && |
| 65 | |
Eli Friedman | 4c3ba6c | 2009-05-24 19:25:46 +0000 | [diff] [blame^] | 66 | // Concatenation with period doesn't leave a space |
| 67 | // RUN: grep '.T8' %t && |
| 68 | #define T8(A,B) A ## B |
| 69 | T8(.,T8) |
| 70 | |
Chris Lattner | e966d9a | 2009-03-20 16:28:22 +0000 | [diff] [blame] | 71 | // RUN: true |