Debian Codegraph @

gcc/testsuite/gcc.dg/spellcheck-stdlib.c

raw
1 /* Missing <stddef.h>. */
2
3 void *ptr = NULL; /* { dg-error "'NULL' undeclared here" } */
4 /* { dg-message "'NULL' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */
5
6 ptrdiff_t pd; /* { dg-error "unknown type name 'ptrdiff_t'" } */
7 /* { dg-message "'ptrdiff_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */
8
9 wchar_t wc; /* { dg-error "unknown type name 'wchar_t'" } */
10 /* { dg-message "'wchar_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */
11
12 size_t sz; /* { dg-error "unknown type name 'size_t'" } */
13 /* { dg-message "'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>'" "" { target *-*-* } .-1 } */
14
15 /* Missing <stdio.h>. */
16
17 void test_stdio_h (void)
18 {
19 FILE *f; /* { dg-error "unknown type name 'FILE'" } */
20 /* { dg-message "'FILE' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
21
22 char buf[BUFSIZ]; /* { dg-error "'BUFSIZ' undeclared" } */
23 /* { dg-message "'BUFSIZ' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
24
25 char buf2[FILENAME_MAX]; /* { dg-error "'FILENAME_MAX' undeclared" } */
26 /* { dg-message "'FILENAME_MAX' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
27
28 stderr; /* { dg-error "'stderr' undeclared" } */
29 /* { dg-message "'stderr' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
30
31 stdin; /* { dg-error "'stdin' undeclared" } */
32 /* { dg-message "'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
33
34 stdout; /* { dg-error "'stdout' undeclared" } */
35 /* { dg-message "'stdout' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
36
37 EOF; /* { dg-error "'EOF' undeclared" } */
38 /* { dg-message "'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'" "" { target *-*-* } .-1 } */
39 }
40
41 /* Missing <stdlib.h>. */
42
43 void test_stdlib (int i)
44 {
45 i = EXIT_SUCCESS; /* { dg-error "'EXIT_SUCCESS' undeclared" } */
46 /* { dg-message "'EXIT_SUCCESS' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'" "" { target *-*-* } .-1 } */
47 i = EXIT_FAILURE; /* { dg-error "'EXIT_FAILURE' undeclared" } */
48 /* { dg-message "'EXIT_FAILURE' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'" "" { target *-*-* } .-1 } */
49 }
50
51 /* Missing <errno.h>. */
52
53 int test_errno_h (void)
54 {
55 return errno; /* { dg-error "'errno' undeclared" } */
56 /* { dg-message "'errno' is defined in header '<errno.h>'; this is probably fixable by adding '#include <errno.h>'" "" { target *-*-* } .-1 } */
57 }
58
59 /* Missing <stdarg.h>. */
60
61 void test_stdarg_h (void)
62 {
63 va_list ap; /* { dg-error "unknown type name 'va_list'" } */
64 /* { dg-message "'va_list' is defined in header '<stdarg.h>'; this is probably fixable by adding '#include <stdarg.h>'" "" { target *-*-* } .-1 } */
65 }
66
67 /* Missing <limits.h>. */
68 int test_INT_MAX (void)
69 {
70 return INT_MAX; /* { dg-line INT_MAX_line } */
71 /* { dg-error "'INT_MAX' undeclared" "" { target *-*-* } INT_MAX_line } */
72 /* { dg-bogus "__INT_MAX__" "" { target *-*-* } INT_MAX_line } */
73 /* { dg-message "'INT_MAX' is defined in header '<limits.h>'; this is probably fixable by adding '#include <limits.h>'" "" { target *-*-* } INT_MAX_line } */
74 }
75
76 /* Missing <float.h>. */
77 float test_FLT_MAX = FLT_MAX; /* { dg-line FLT_MAX_line } */
78 /* { dg-error "'FLT_MAX' undeclared" "" { target *-*-* } FLT_MAX_line } */
79 /* { dg-message "'FLT_MAX' is defined in header '<float.h>'; this is probably fixable by adding '#include <float.h>'" "" { target *-*-* } FLT_MAX_line } */