This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
27
unikernel/duniverse/cppo/test/lexical.cppo
Normal file
27
unikernel/duniverse/cppo/test/lexical.cppo
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(* This test shows that the definition of BAR captures the original
|
||||
definition of FOO, so even if FOO is redefined, the expansion of
|
||||
BAR does not change. *)
|
||||
#define FOO "original definition"
|
||||
#define BAR FOO
|
||||
#undef FOO
|
||||
#define FOO "new definition"
|
||||
FOO (* expands to "new definition" *)
|
||||
BAR (* expands to "original definition" *)
|
||||
|
||||
(* This test shows that a formal parameter can shadow a previously
|
||||
defined macro. *)
|
||||
#define F(FOO) FOO
|
||||
F(42) (* expands to 42 *)
|
||||
|
||||
(* This test shows that two formal parameters can have the same
|
||||
name. In that case, the second parameter shadows the first one. *)
|
||||
#define G(X, X) X+X
|
||||
G(42,23) (* expands to 23+23 *)
|
||||
|
||||
(* This test shows that it is OK to pass an empty argument to a macro
|
||||
that expects one parameter. This is interpreted as passing one
|
||||
empty argument. *)
|
||||
#define expect(x) show(x)
|
||||
expect(42)
|
||||
expect("23")
|
||||
expect()
|
||||
Loading…
Add table
Add a link
Reference in a new issue