PR macros/13205:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / macscp1.c
CommitLineData
6827a8f8
JB
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
9a044a89
TT
8#define FIFTY_SEVEN 57
9
10#define FORTY_EIGHT 48
11#undef FORTY_EIGHT
12
7c8adf68
TT
13struct outer
14{
15 struct fields
16 {
17 struct fault
18 {
19 int addr;
20 } fault;
21 } fields;
22};
23struct outer address;
24
25#define addr fields.fault.addr
26
6827a8f8
JB
27/* A macro named UNTIL_<func> is #defined until just before the
28 definition of the function <func>.
29
30 A macro named BEFORE_<func> is not #defined until just before the
31 definition of <func>.
32
33 The macro WHERE is redefined before each function <func> to the
34 token list ``before <func>''.
35
36 The macscp IN_MACSCP2_H and IN_MACSCP3_H are defined while
37 processing those header files; macscp4.h uses them to choose
38 appropriate function names, output strings, and macro definitions. */
39
40#define UNTIL_MACSCP1_1
41#define UNTIL_MACSCP2_1
42#define UNTIL_MACSCP4_1_FROM_MACSCP2
43#define UNTIL_MACSCP4_2_FROM_MACSCP2
44#define UNTIL_MACSCP2_2
45#define UNTIL_MACSCP1_2
46#define UNTIL_MACSCP3_1
47#define UNTIL_MACSCP4_1_FROM_MACSCP3
48#define UNTIL_MACSCP4_2_FROM_MACSCP3
49#define UNTIL_MACSCP3_2
50#define UNTIL_MACSCP1_3
51
52#define WHERE before macscp1_1
53#define BEFORE_MACSCP1_1
54#undef UNTIL_MACSCP1_1
55void
56macscp1_1 ()
57{
58 puts ("macscp1_1");
59}
60
61#include "macscp2.h"
62
63#undef WHERE
64#define WHERE before macscp1_2
65#define BEFORE_MACSCP1_2
66#undef UNTIL_MACSCP1_2
67void
68macscp1_2 ()
69{
70 puts ("macscp1_2");
71}
72
73#include "macscp3.h"
74
75#undef WHERE
76#define WHERE before macscp1_3
77#define BEFORE_MACSCP1_3
78#undef UNTIL_MACSCP1_3
79void
80macscp1_3 ()
81{
82 puts ("macscp1_3");
83}
84
d705c43c
PA
85void
86macscp_expr (void)
87{
88 int foo = -1;
89
90 foo = 0; /* set breakpoint here */
506800a9 91#define MACRO_TO_EXPAND foo
d705c43c 92 foo = 1;
506800a9 93#undef MACRO_TO_EXPAND
abc9d0dc 94 foo = 2; /* stopping point for line test */
d705c43c
PA
95}
96
9a044a89
TT
97#define TWENTY_THREE 23
98
6827a8f8
JB
99int
100main (int argc, char **argv)
101{
102 macscp1_1 ();
103 macscp2_1 ();
104 macscp4_1_from_macscp2 ();
105 macscp4_2_from_macscp2 ();
106 macscp2_2 ();
107 macscp1_2 ();
108 macscp3_1 ();
109 macscp4_1_from_macscp3 ();
110 macscp4_2_from_macscp3 ();
111 macscp3_2 ();
112 macscp1_3 ();
d705c43c 113 macscp_expr ();
6827a8f8 114}
This page took 1.227555 seconds and 4 git commands to generate.