Mercurial > emacs
annotate test/cedet/tests/testsppreplace.c @ 112218:376148b31b5e
Add 2011 to FSF/AIST copyright years.
| author | Glenn Morris <rgm@gnu.org> |
|---|---|
| date | Sun, 02 Jan 2011 15:50:46 -0800 |
| parents | 89eccb374dec |
| children | ef719132ddfa |
| rev | line source |
|---|---|
|
107698
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
1 /* testsppreplace.c --- unit test for CPP/SPP Replacement |
|
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
107698
diff
changeset
|
2 Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
|
107698
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
3 |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
4 Author: Eric M. Ludlam <eric@siege-engine.com> |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
5 |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
6 This file is part of GNU Emacs. |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
7 |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
8 GNU Emacs is free software: you can redistribute it and/or modify |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
11 (at your option) any later version. |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
12 |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
13 GNU Emacs is distributed in the hope that it will be useful, |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
16 GNU General Public License for more details. |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
17 |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
|
89eccb374dec
Update Semantic test copyrights, delete some test files (Bug#4656).
Chong Yidong <cyd@stupidchicken.com>
parents:
105377
diff
changeset
|
20 */ |
| 104494 | 21 |
| 22 /* TEST: The EMU keyword doesn't screw up the function defn. */ | |
| 23 #define EMU | |
| 24 #define EMU2 /*comment*/ | |
| 25 char EMU parse_around_emu EMU2 (EMU) | |
| 26 { | |
| 27 } | |
| 28 | |
| 29 /* TEST: A simple word can be replaced in a definition. */ | |
| 30 #define SUBFLOAT /* Some Float */ float | |
| 31 SUBFLOAT returnanfloat() | |
| 32 { | |
| 33 } | |
| 34 | |
| 35 /* TEST: Punctuation an be replaced in a definition. */ | |
| 36 #define COLON : | |
| 37 int foo COLON COLON bar () | |
| 38 { | |
| 39 } | |
| 40 | |
| 41 /* TEST: Multiple lexical characters in a definition */ | |
| 42 #define SUPER mysuper:: | |
| 43 int SUPER baz () | |
| 44 { | |
| 45 } | |
| 46 | |
| 47 /* TEST: Macro replacement. */ | |
| 48 #define INT_FCN(name) int name (int in) | |
| 49 | |
| 50 INT_FCN(increment) { | |
| 51 return in+1; | |
| 52 } | |
| 53 | |
| 54 /* TEST: Macro replacement with complex args */ | |
| 55 #define P_(proto) () | |
| 56 | |
| 57 int myFcn1 P_((a,b)); | |
| 58 | |
| 59 #define P__(proto) proto | |
| 60 | |
| 61 int myFcn2 P__((int a, int b)); | |
| 62 int myFcn3 (int a, int b); | |
| 63 | |
| 64 /* TEST: Multiple args to a macro. */ | |
| 65 #define MULTI_ARGS(name, field1, field2, field3) struct name { int field1; int field2; int field3; } | |
| 66 | |
| 67 MULTI_ARGS(ma_struct, moose, penguin, emu); | |
| 68 | |
| 69 /* TEST: Macro w/ args, but no body. */ | |
| 70 #define NO_BODY(name) | |
| 71 | |
| 72 NO_BODY(Moose); | |
| 73 | |
| 74 /* TEST: Not a macro with args, but close. */ | |
| 75 #define NOT_WITH_ARGS (moose) | |
| 76 | |
| 77 int not_with_args_fcn NOT_WITH_ARGS | |
| 78 { | |
| 79 } | |
| 80 | |
| 81 /* TEST: macro w/ continuation. */ | |
| 82 #define WITH_CONT \ | |
| 83 continuation_symbol | |
| 84 | |
| 85 int WITH_CONT () { }; | |
| 86 | |
| 87 /* TEST: macros in a macro - tail processing */ | |
| 88 #define tail_with_args_and_long_name(a) (int a) | |
| 89 #define int_arg tail_with_args_and_long_name | |
| 90 | |
| 91 int tail int_arg(q) {} | |
| 92 | |
| 93 /* TEST: macros used improperly. */ | |
| 94 #define tail_fail tail_with_args_and_long_name(q) | |
| 95 | |
| 96 int tail_fcn tail_fail(q); | |
| 97 | |
| 98 /* TEST: feature of CPP from LSD <lsdsgster@...> */ | |
| 99 #define __gthrw_(name) __gthrw_ ## name | |
| 100 | |
| 101 int __gthrw_(foo) (int arg1) { } | |
| 102 | |
| 103 /* TEST: macros using macros */ | |
| 104 #define macro_foo foo | |
| 105 #define mf_declare int macro_foo | |
| 106 | |
| 107 mf_declare; | |
| 108 | |
| 109 /* TEST: macros with args using macros */ | |
| 110 #define Amacro(A) (int A) | |
| 111 #define mf_Amacro(B) int B Amacro(B) | |
| 112 | |
| 113 mf_Amacro(noodle); | |
| 114 | |
| 115 /* TEST: Double macro using the argument stack. */ | |
| 116 #define MACRO0(name) int that_ ## name(int i); | |
| 117 #define MACRO1(name) int this_ ## name(int i); | |
| 118 #define MACRO2(name) MACRO0(name) MACRO1(name) | |
| 119 | |
| 120 MACRO2(foo) | |
| 121 | |
| 122 /* TEST: The G++ namespace macro hack. Not really part of SPP. */ | |
| 123 _GLIBCXX_BEGIN_NAMESPACE(baz) | |
| 124 | |
| 125 int bazfnc(int b) { } | |
| 126 | |
| 127 _GLIBCXX_END_NAMESPACE; | |
| 128 | |
| 129 _GLIBCXX_BEGIN_NESTED_NAMESPACE(foo,bar) | |
| 130 | |
| 131 int foo_bar_func(int a) { } | |
| 132 | |
| 133 _GLIBCXX_END_NESTED_NAMESPACE; | |
| 134 | |
| 135 | |
| 136 /* TEST: The VC++ macro hack. */ | |
| 137 _STD_BEGIN | |
| 138 | |
| 139 int inside_std_namespace(int a) { } | |
| 140 | |
| 141 _STD_END | |
| 142 | |
| 143 /* TEST: Recursion prevention. CPP doesn't allow even 1 level of recursion. */ | |
| 144 #define STARTMACRO MACROA | |
| 145 #define MACROA MACROB | |
| 146 #define MACROB MACROA | |
| 147 | |
| 148 int STARTMACRO () { | |
| 149 | |
| 150 } | |
| 151 | |
| 152 | |
| 153 /* END */ | |
| 105377 | 154 |
| 155 /* arch-tag: ee9bd650-35f4-468f-82d7-a5f3606c0132 | |
| 156 (do not change this comment) */ |
