]> git.sur5r.net Git - cc65/blob - test/ref/cc65090124.c
Only for jumps, the lib uses named asm labels in branches
[cc65] / test / ref / cc65090124.c
1 /*
2   !!DESCRIPTION!! 
3   !!ORIGIN!!      testsuite
4   !!LICENCE!!     Public Domain
5   !!AUTHOR!!
6 */
7
8 #include <stdio.h>
9
10 /*
11 there is a bug in the preprocessor (i think) ... the following works 
12 (compiles) correctly:
13
14 unsigned long fs,fd,a;
15
16 unsigned long _func(unsigned long x,unsigned long y)
17 {
18         return 0;
19 }
20
21 int main(void)
22 {
23         fs=(_func((fd/a),(_func(2,0x0082c90f))));
24 }
25
26 now if i wrap _func into a macro like this:
27
28 #define func(x,y)       _func(x,y)
29
30 int main(void)
31 {
32         fs=(func((fd/a),(func(2,0x0082c90f))));
33 }
34
35 i get "Error: ')' expected" on that line. (this is with the snapshot, freshly 
36 compiled 5 minutes ago)
37 */
38
39 unsigned long fs,fd,a;
40
41 unsigned long _func1(unsigned long x,unsigned long y)
42 {
43         return 0;
44 }
45
46 int test1(void)
47 {
48         fs=(_func1((fd/a),(_func1(2,0x0082c90f))));
49 }
50
51 #define func(x,y)       _func1(x,y)
52
53 int test2(void)
54 {
55         fs=(func((fd/a),(func(2,0x0082c90f))));
56 }
57
58 int main(void)
59 {
60     printf("it works :)\n");
61
62     return 0;
63 }