]> andersk Git - splint.git/blame - test/libs.c
*** empty log message ***
[splint.git] / test / libs.c
CommitLineData
885824d3 1/*
2** test of standard library
3*/
4
5int compare (int x, int y)
6{
7 x = y;
8 return (3);
9}
10
11char *compare2 (int x, int y)
12{
13 x = y;
14 return "ok";
15}
16
17void
18leave (int i)
19{
20 exit ("hullo"); /* 1. Function exit expects arg 1 to be int gets char * */
21 exit (i); /* 2. Unreachable code */
22}
23
24void
25print (char *s, FILE *f)
26{
27 char c;
28
29 fprintf (f, s);
30 printf(s);
31 fprintf (stderr, s);
32
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) */
35}
36
37int
38main (void)
39{
40 unsigned int x;
41
42 x = NULL;
43
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@*/
50
51 qsort (NULL, x, x, (int (*)()) compare);
52 qsort (x, x, x, (char (*)()) compare2); /* 9, 10. */
53
54 signal (SIGHUP, compare); /* 11. */
55 signal (SIGHUP, leave);
56
57 return 23;
58}
59
60
This page took 1.146105 seconds and 5 git commands to generate.