File: assembler-with-cpp.c

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,235,796 kB
  • sloc: cpp: 7,617,614; ansic: 1,433,901; asm: 1,058,726; python: 252,096; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 10,032; ml: 5,111; perl: 4,720; awk: 3,523; makefile: 3,401; javascript: 2,272; xml: 892; fortran: 770
file content (83 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// RUN: %clang_cc1 -x assembler-with-cpp -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s

#ifndef __ASSEMBLER__
#error "__ASSEMBLER__ not defined"
#endif


// Invalid token pasting is ok. 
#define A X ## .
1: A
// CHECK-Identifiers-False: 1: X .

// Line markers are not linemarkers in .S files, they are passed through.
# 321
// CHECK-Identifiers-False: # 321

// Unknown directives are passed through.
# B C
// CHECK-Identifiers-False: # B C

// Unknown directives are expanded.
#define D(x) BAR ## x
# D(42)
// CHECK-Identifiers-False: # BAR42

// Unmatched quotes are permitted.
2: '
3: "
// CHECK-Identifiers-False: 2: '
// CHECK-Identifiers-False: 3: "

// (balance quotes to keep editors happy): "'

// Empty char literals are ok.
4: ''
// CHECK-Identifiers-False: 4: ''


// Portions of invalid pasting should still expand as macros.
#define M4 expanded
#define M5() M4 ## (

5: M5()
// CHECK-Identifiers-False: 5: expanded (

#define FOO(name)  name ## $foo
6: FOO(blarg)
// CHECK-Identifiers-False: 6: blarg $foo

// RUN: %clang_cc1 -x assembler-with-cpp -fdollars-in-identifiers -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s
#define FOO(name)  name ## $foo
7: FOO(blarg)
// CHECK-Identifiers-True: 7: blarg$foo

// 
#define T6() T6 #nostring
#define T7(x) T7 #x
8: T6()
9: T7(foo)
// CHECK-Identifiers-True: 8: T6 #nostring
// CHECK-Identifiers-True: 9: T7 "foo"

// Concatenation with period doesn't leave a space
#define T8(A,B) A ## B
10: T8(.,T8)
// CHECK-Identifiers-True: 10: .T8

// This should not crash.
#define T11(a) #0
11: T11(b)
// CHECK-Identifiers-True: 11: #0

// Universal character names can specify basic ascii and control characters
12: \u0020\u0030
// CHECK-Identifiers-False: 12: \u0020\u0030

// This should not crash
# ##
// CHECK-Identifiers-False: # ##

#define X(a) # # # 1
X(1)
// CHECK-Identifiers-False: # # # 1