annotate gcc/testsuite/gcc.dg/cpp/builtin-macro-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Origin PR preprocessor/64803
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 This test ensures that the value the __LINE__ macro expands to is
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
4 constant and corresponds to the line of the macro expansion point
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
5 the function-like macro expansion it's part of.
111
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 { dg-do run }
kono
parents:
diff changeset
8 { do-options -no-integrated-cpp } */
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 #include <assert.h>
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 #define C(a, b) a ## b
kono
parents:
diff changeset
13 #define L(x) C(L, x)
kono
parents:
diff changeset
14 #define M(a) int L(__LINE__) = __LINE__; assert(L(__LINE__) == __LINE__);
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 int
kono
parents:
diff changeset
17 main()
kono
parents:
diff changeset
18 {
kono
parents:
diff changeset
19 M(a
kono
parents:
diff changeset
20 );
kono
parents:
diff changeset
21
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
22 assert(L19 == 19); /* 19 is the line number of the
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
23 macro expansion point of the
111
kono
parents:
diff changeset
24 invocation of the M macro. Please
kono
parents:
diff changeset
25 adjust in case the layout of this
kono
parents:
diff changeset
26 file changes. */
kono
parents:
diff changeset
27 return 0;
kono
parents:
diff changeset
28 }