* gdb.base/macscp.exp: Change "M" to "MACRO_TO_EXPAND"
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / macscp1.c
1 #include <stdio.h>
2
3 #define SPLICE(a, b) INNER_SPLICE(a, b)
4 #define INNER_SPLICE(a, b) a ## b
5 #define STRINGIFY(a) INNER_STRINGIFY(a)
6 #define INNER_STRINGIFY(a) #a
7
8 /* A macro named UNTIL_<func> is #defined until just before the
9 definition of the function <func>.
10
11 A macro named BEFORE_<func> is not #defined until just before the
12 definition of <func>.
13
14 The macro WHERE is redefined before each function <func> to the
15 token list ``before <func>''.
16
17 The macscp IN_MACSCP2_H and IN_MACSCP3_H are defined while
18 processing those header files; macscp4.h uses them to choose
19 appropriate function names, output strings, and macro definitions. */
20
21 #define UNTIL_MACSCP1_1
22 #define UNTIL_MACSCP2_1
23 #define UNTIL_MACSCP4_1_FROM_MACSCP2
24 #define UNTIL_MACSCP4_2_FROM_MACSCP2
25 #define UNTIL_MACSCP2_2
26 #define UNTIL_MACSCP1_2
27 #define UNTIL_MACSCP3_1
28 #define UNTIL_MACSCP4_1_FROM_MACSCP3
29 #define UNTIL_MACSCP4_2_FROM_MACSCP3
30 #define UNTIL_MACSCP3_2
31 #define UNTIL_MACSCP1_3
32
33 #define WHERE before macscp1_1
34 #define BEFORE_MACSCP1_1
35 #undef UNTIL_MACSCP1_1
36 void
37 macscp1_1 ()
38 {
39 puts ("macscp1_1");
40 }
41
42 #include "macscp2.h"
43
44 #undef WHERE
45 #define WHERE before macscp1_2
46 #define BEFORE_MACSCP1_2
47 #undef UNTIL_MACSCP1_2
48 void
49 macscp1_2 ()
50 {
51 puts ("macscp1_2");
52 }
53
54 #include "macscp3.h"
55
56 #undef WHERE
57 #define WHERE before macscp1_3
58 #define BEFORE_MACSCP1_3
59 #undef UNTIL_MACSCP1_3
60 void
61 macscp1_3 ()
62 {
63 puts ("macscp1_3");
64 }
65
66 void
67 macscp_expr (void)
68 {
69 int foo = -1;
70
71 foo = 0; /* set breakpoint here */
72 #define MACRO_TO_EXPAND foo
73 foo = 1;
74 #undef MACRO_TO_EXPAND
75 foo = 2;
76 }
77
78 int
79 main (int argc, char **argv)
80 {
81 macscp1_1 ();
82 macscp2_1 ();
83 macscp4_1_from_macscp2 ();
84 macscp4_2_from_macscp2 ();
85 macscp2_2 ();
86 macscp1_2 ();
87 macscp3_1 ();
88 macscp4_1_from_macscp3 ();
89 macscp4_2_from_macscp3 ();
90 macscp3_2 ();
91 macscp1_3 ();
92 macscp_expr ();
93 }
This page took 0.032824 seconds and 5 git commands to generate.