Commit | Line | Data |
---|---|---|
a4100ebe | 1 | /* testsppreplaced.c --- unit test for CPP/SPP Replacement |
73b0cd50 | 2 | Copyright (C) 2007-2011 Free Software Foundation, Inc. |
a4100ebe CY |
3 | |
4 | Author: Eric M. Ludlam <eric@siege-engine.com> | |
5 | ||
6 | This file is part of GNU Emacs. | |
7 | ||
8 | GNU Emacs is free software: you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation, either version 3 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | GNU Emacs is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
20 | */ | |
21 | ||
22 | /* What the SPP replace file would looklike with MACROS replaced: */ | |
74ea13c1 CY |
23 | |
24 | /* TEST: The EMU keyword doesn't screw up the function defn. */ | |
25 | char parse_around_emu () | |
26 | { | |
27 | } | |
28 | ||
29 | /* TEST: A simple word can be replaced in a definition. */ | |
30 | float returnanfloat() | |
31 | { | |
32 | } | |
33 | ||
34 | /* TEST: Punctuation an be replaced in a definition. */ | |
35 | int foo::bar () | |
36 | { | |
37 | } | |
38 | ||
39 | /* TEST: Multiple lexical characters in a definition */ | |
40 | int mysuper::baz () | |
41 | { | |
42 | } | |
43 | ||
44 | /* TEST: Macro replacement. */ | |
45 | int increment (int in) { | |
46 | return in+1; | |
47 | } | |
48 | ||
49 | /* TEST: Macro replacement with complex args */ | |
50 | int myFcn1 (); | |
51 | ||
52 | int myFcn2 (int a, int b); | |
53 | int myFcn3 (int a, int b); | |
54 | ||
55 | /* TEST: Multiple args to a macro. */ | |
56 | struct ma_struct { int moose; int penguin; int emu; }; | |
57 | ||
58 | /* TEST: Macro w/ args, but no body. */ | |
59 | ||
60 | /* TEST: Not a macro with args, but close. */ | |
61 | int not_with_args_fcn (moose) | |
62 | { | |
63 | } | |
64 | ||
65 | /* TEST: macro w/ continuation. */ | |
66 | int continuation_symbol () { }; | |
67 | ||
68 | /* TEST: macros in a macro - tail processing */ | |
69 | ||
70 | int tail (int q) {} | |
71 | ||
72 | /* TEST: macros used impropertly. */ | |
73 | ||
74 | int tail_fcn(int q); | |
75 | ||
76 | /* TEST: feature of CPP from LSD <lsdsgster@...> */ | |
77 | ||
78 | int __gthrw_foo (int arg1) { } | |
79 | ||
80 | /* TEST: macros using macros */ | |
81 | int foo; | |
82 | ||
83 | /* TEST: macros with args using macros */ | |
84 | int noodle(int noodle); | |
85 | ||
86 | /* TEST: Double macro using the argument stack. */ | |
87 | int that_foo(int i); | |
88 | int this_foo(int i); | |
89 | ||
90 | /* TEST: The G++ namespace macro hack. Not really part of SPP. */ | |
91 | namespace baz { | |
92 | ||
93 | int bazfnc(int b) { } | |
94 | ||
95 | } | |
96 | ||
97 | namespace foo { namespace bar { | |
98 | ||
99 | int foo_bar_func(int a) { } | |
100 | ||
101 | } | |
102 | } | |
103 | ||
104 | /* TEST: The VC++ macro hack. */ | |
105 | namespace std { | |
106 | ||
107 | int inside_std_namespace(int a) { } | |
108 | ||
109 | } | |
110 | ||
111 | /* TEST: Recursion prevention. CPP doesn't allow even 1 level of recursion. */ | |
112 | int MACROA () { | |
113 | ||
114 | } | |
115 | ||
116 | ||
117 | /* End */ | |
3999968a | 118 |