Add C++11 header <cuchar>.
[official-gcc.git] / libcpp / location-example.txt
bloba5f95b2baf8dd1f4c3eea24396aaaebd8501af3e
1 Consider compiling test.c, with this content:
2 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
3 #include "test.h"
5 int
6 main (int argc, char **argv)
8   int a = PLUS (1,2);
9   int b = PLUS (3,4);
10   return 0;
12 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 ...where test.h has this content:
15 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
16 extern int foo ();
18 #define PLUS(A, B) A + B
19 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 The undocumented -fdump-internal-locations option outputs this information
23 to stderr, showing what each source_location value means.  Source code
24 lines are quoted, showing both per-line source_location values and
25 per-line&column source_location values (written vertically under the
26 corresponding character of source code).
28 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
29 RESERVED LOCATIONS
30   source_location interval: 0 <= loc < 2
32 ORDINARY MAP: 0
33   source_location interval: 2 <= loc < 3
34   file: test.c
35   starting at line: 1
36   column bits: 7
37 test.c:  1|loc:    2|#include "test.h"
38                     |00000001111111111
39                     |34567890123456789
41 ORDINARY MAP: 1
42   source_location interval: 3 <= loc < 4
43   file: <built-in>
44   starting at line: 0
45   column bits: 0
47 ORDINARY MAP: 2
48   source_location interval: 4 <= loc < 5
49   file: <command-line>
50   starting at line: 0
51   column bits: 0
53 ORDINARY MAP: 3
54   source_location interval: 5 <= loc < 5005
55   file: /usr/include/stdc-predef.h
56   starting at line: 1
57   column bits: 7
58 (contents of /usr/include/stdc-predef.h snipped for brevity)
60 ORDINARY MAP: 4
61   source_location interval: 5005 <= loc < 5006
62   file: <command-line>
63   starting at line: 1
64   column bits: 7
66 ORDINARY MAP: 5
67   source_location interval: 5006 <= loc < 5134
68   file: test.c
69   starting at line: 1
70   column bits: 7
71 test.c:  1|loc: 5006|#include "test.h"
72                     |55555555555555555
73                     |00000000000000000
74                     |00011111111112222
75                     |78901234567890123
77 ORDINARY MAP: 6
78   source_location interval: 5134 <= loc < 5416
79   file: test.h
80   starting at line: 1
81   column bits: 7
82 test.h:  1|loc: 5134|extern int foo ();
83                     |555555555555555555
84                     |111111111111111111
85                     |333334444444444555
86                     |567890123456789012
87 test.h:  2|loc: 5262|
88                     |
89                     |
90                     |
91                     |
92 test.h:  3|loc: 5390|#define PLUS(A, B) A + B
93                     |555555555555555555555555
94                     |333333333444444444444444
95                     |999999999000000000011111
96                     |123456789012345678901234
98 ORDINARY MAP: 7
99   source_location interval: 5416 <= loc < 6314
100   file: test.c
101   starting at line: 2
102   column bits: 7
103 test.c:  2|loc: 5416|
104                     |
105                     |
106                     |
107                     |
108 test.c:  3|loc: 5544|int
109                     |555
110                     |555
111                     |444
112                     |567
113 test.c:  4|loc: 5672|main (int argc, char **argv)
114                     |5555555555555555555555555555
115                     |6666666666666666666666666667
116                     |7777777888888888899999999990
117                     |3456789012345678901234567890
118 test.c:  5|loc: 5800|{
119                     |5
120                     |8
121                     |0
122                     |1
123 test.c:  6|loc: 5928|  int a = PLUS (1,2);
124                     |555555555555555555555
125                     |999999999999999999999
126                     |233333333334444444444
127                     |901234567890123456789
128 test.c:  7|loc: 6056|  int b = PLUS (3,4);
129                     |666666666666666666666
130                     |000000000000000000000
131                     |555666666666677777777
132                     |789012345678901234567
133 test.c:  8|loc: 6184|  return 0;
134                     |66666666666
135                     |11111111111
136                     |88888999999
137                     |56789012345
138 test.c:  9|loc: 6312|}
139                     |6
140                     |3
141                     |1
142                     |3
144 UNALLOCATED LOCATIONS
145   source_location interval: 6314 <= loc < 2147483633
147 MACRO 1: PLUS (7 tokens)
148   source_location interval: 2147483633 <= loc < 2147483640
149 test.c:7:11: note: expansion point is location 6067
150    int b = PLUS (3,4);
151            ^
152   map->start_location: 2147483633
153   macro_locations:
154     0: 6073, 5410
155 test.c:7:17: note: token 0 has x-location == 6073
156    int b = PLUS (3,4);
157                  ^
158 test.c:7:17: note: token 0 has y-location == 5410
159     1: 5412, 5412
160 In file included from test.c:1:0:
161 test.h:3:22: note: token 1 has x-location == y-location == 5412
162  #define PLUS(A, B) A + B
163                       ^
164     2: 6075, 5414
165 test.c:7:19: note: token 2 has x-location == 6075
166    int b = PLUS (3,4);
167                    ^
168 test.c:7:19: note: token 2 has y-location == 5414
169     3: 0, 2947526575
170 cc1: note: token 3 has x-location == 0
171 cc1: note: token 3 has y-location == 2947526575
172     4: 2947526575, 2947526575
173 x-location == y-location == 2947526575 encodes token # 800042942
174     5: 2947526575, 2947526575
175 x-location == y-location == 2947526575 encodes token # 800042942
176     6: 2947526575, 2947526575
177 x-location == y-location == 2947526575 encodes token # 800042942
179 MACRO 0: PLUS (7 tokens)
180   source_location interval: 2147483640 <= loc < 2147483647
181 test.c:6:11: note: expansion point is location 5939
182    int a = PLUS (1,2);
183            ^
184   map->start_location: 2147483640
185   macro_locations:
186     0: 5945, 5410
187 test.c:6:17: note: token 0 has x-location == 5945
188    int a = PLUS (1,2);
189                  ^
190 test.c:6:17: note: token 0 has y-location == 5410
191     1: 5412, 5412
192 In file included from test.c:1:0:
193 test.h:3:22: note: token 1 has x-location == y-location == 5412
194  #define PLUS(A, B) A + B
195                       ^
196     2: 5947, 5414
197 test.c:6:19: note: token 2 has x-location == 5947
198    int a = PLUS (1,2);
199                    ^
200 test.c:6:19: note: token 2 has y-location == 5414
201     3: 0, 2947526575
202 cc1: note: token 3 has x-location == 0
203 cc1: note: token 3 has y-location == 2947526575
204     4: 2947526575, 2947526575
205 x-location == y-location == 2947526575 encodes token # 800042935
206     5: 2947526575, 2947526575
207 x-location == y-location == 2947526575 encodes token # 800042935
208     6: 2947526575, 2947526575
209 x-location == y-location == 2947526575 encodes token # 800042935
211 MAX_SOURCE_LOCATION
212   source_location interval: 2147483647 <= loc < 2147483648
214 AD-HOC LOCATIONS
215   source_location interval: 2147483648 <= loc < 4294967295
216 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^