assembler-with-cpp.c revision 78d5590d896cb95eea972754ad40735927ae585f
1// RUN: clang-cc -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s 2 3#ifndef __ASSEMBLER__ 4#error "__ASSEMBLER__ not defined" 5#endif 6 7 8// Invalid token pasting is ok. 9#define A X ## . 101: A 11// CHECK-Identifiers-False: 1: X . 12 13// Line markers are not linemarkers in .S files, they are passed through. 14# 321 15// CHECK-Identifiers-False: # 321 16 17// Unknown directives are passed through. 18# B C 19// CHECK-Identifiers-False: # B C 20 21// Unknown directives are expanded. 22#define D(x) BAR ## x 23# D(42) 24// CHECK-Identifiers-False: # BAR42 25 26// Unmatched quotes are permitted. 272: ' 283: " 29// CHECK-Identifiers-False: 2: ' 30// CHECK-Identifiers-False: 3: " 31 32// (balance quotes to keep editors happy): "' 33 34// Empty char literals are ok. 354: '' 36// CHECK-Identifiers-False: 4: '' 37 38 39// Portions of invalid pasting should still expand as macros. 40// rdar://6709206 41#define M4 expanded 42#define M5() M4 ## ( 43 445: M5() 45// CHECK-Identifiers-False: 5: expanded ( 46 47// rdar://6804322 48#define FOO(name) name ## $foo 496: FOO(blarg) 50// CHECK-Identifiers-False: 6: blarg $foo 51 52// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s 53#define FOO(name) name ## $foo 547: FOO(blarg) 55// CHECK-Identifiers-True: 7: blarg$foo 56 57// 58#define T6() T6 #nostring 59#define T7(x) T7 #x 608: T6() 619: T7(foo) 62// CHECK-Identifiers-True: 8: T6 #nostring 63// CHECK-Identifiers-True: 9: T7 "foo" 64 65// Concatenation with period doesn't leave a space 66#define T8(A,B) A ## B 6710: T8(.,T8) 68// CHECK-Identifiers-True: 10: .T8 69 70// This should not crash. 71#define T11(a) #0 7211: T11(b) 73// CHECK-Identifiers-True: 11: #0 74 75