Various minor fixes for compiler/linter (other then splint itself) warnings.
[splint-patched.git] / test / libs.c
blobedd943114e9e0e25ac4379bd2e2a2ba1dc4a6405
1 /*
2 ** test of standard library
3 */
5 int compare (int x, int y)
7 x = y;
8 return (3);
11 char *compare2 (int x, int y)
13 x = y;
14 return "ok";
17 void
18 leave (int i)
20 exit ("hullo"); /* 1. Function exit expects arg 1 to be int gets char * */
21 exit (i); /* 2. Unreachable code */
24 void
25 print (char *s, FILE *f)
27 char c;
29 fprintf (f, s);
30 printf(s);
31 fprintf (stderr, s);
33 c = fgetc(f); /* 3. Assignment of int to char: c = fgetc(f) */
34 c = getc (f); /* 4. Assignment of int to char: c = getc(f) */
37 int
38 main (void)
40 unsigned int x;
42 x = NULL;
44 /*@-null@*/ /* suppress errors for passing NULL's */
45 /*@-noeffect@*/
46 (void) bsearch (NULL, NULL, sizeof(int), compare) ; /* 5, 6 */
47 (void) bsearch (NULL, NULL, sizeof(int), sizeof(int), (int (*) ()) compare) ; /* ok */
48 bsearch (NULL, NULL, sizeof(int), sizeof(int), (char (*) ()) compare2) ; /* 7, 8 */
49 /*@=noeffect@*/
51 qsort (NULL, x, x, (int (*)()) compare);
52 qsort (x, x, x, (char (*)()) compare2); /* 9, 10. */
54 signal (SIGHUP, compare); /* 11. */
55 signal (SIGHUP, leave);
57 return 23;