]> andersk Git - splint.git/blame - test/args.c
Fixes for win32
[splint.git] / test / args.c
CommitLineData
885824d3 1# include <stdarg.h>
2# include "bool.h"
3int sumn (int x, ...)
4{
5 int y = 0;
6 void *yaba;
7 va_list args;
8
9 va_start (args, (void *)x); /* okay (args counts as out param) */
10 while (x > 0)
11 {
12 x--;
13 y = va_arg (args, int); /* okay */
14 y = va_arg (args, char *); /* type error */
15 y = va_arg (yaba, int); /* error */
16 }
17 return y;
18}
19
20int test (int x, char *s)
21{
22 x = sumn(); /* bad */
23 x = sumn(x); /* okay */
24 x = sumn(s); /* bad */
25 x = sumn(x, s); /* okay */
26
27 x = test (x, s, x); /* bad */
28 return x;
29}
30
31int missingargs (int x, int y) /* this is okay */
32{
33 y = x;
34 return x;
35}
36
37int severalargs (char c, int y, bool b) /* first arg: int, second char *, third extra */
38{
39 if (b) { c = 'a'; }
40 return y;
41}
42
43int severalargs2 (int x) /* bad */
44{
45 return x;
46}
47
48int voidargs (char c) /* bad */
49{
50 c = 'a';
51 return 3;
52}
53
54int any (...) /* ok */
55{
56 return 3;
57}
58
59int many1 (int x, char c, float f) /* bad */
60{
61 x;
62 c;
63 f;
64 return x;
65}
66
67int many2 (int x, char c, ...)
68{
69 c;
70 return x;
71}
72
73int many3 (int x) /* bad */
74{
75 return x;
76}
77
78
79
This page took 0.837299 seconds and 5 git commands to generate.