Various minor fixes for compiler/linter (other then splint itself) warnings.
[splint-patched.git] / test / args.c
blob5fa3351c4a346fb438ef0959e48e49f38af5dac8
1 # include <stdarg.h>
2 # include "bool.h"
3 int sumn (int x, ...)
5 int y = 0;
6 void *yaba;
7 va_list args;
9 va_start (args, (void *)x); /* okay (args counts as out param) */
10 while (x > 0)
12 x--;
13 y = va_arg (args, int); /* okay */
14 y = va_arg (args, char *); /* type error */
15 y = va_arg (yaba, int); /* error */
17 return y;
20 int test (int x, char *s)
22 x = sumn(); /* bad */
23 x = sumn(x); /* okay */
24 x = sumn(s); /* bad */
25 x = sumn(x, s); /* okay */
27 x = test (x, s, x); /* bad */
28 return x;
31 int missingargs (int x, int y) /* this is okay */
33 y = x;
34 return x;
37 int severalargs (char c, int y, bool b) /* first arg: int, second char *, third extra */
39 if (b) { c = 'a'; }
40 return y;
43 int severalargs2 (int x) /* bad */
45 return x;
48 int voidargs (char c) /* bad */
50 c = 'a';
51 return 3;
54 int any (...) /* ok */
56 return 3;
59 int many1 (int x, char c, float f) /* bad */
64 return x;
67 int many2 (int x, char c, ...)
70 return x;
73 int many3 (int x) /* bad */
75 return x;