fix BRE \0 test case
[libc-test] / src / api / stdlib.c
1 #include <stdlib.h>
2 #define T(t) (t*)0;
3 #define F(t,n) {t *y = &x.n;}
4 #define C(n) switch(n){case n:;}
5 static void f()
6 {
7 C(EXIT_FAILURE)
8 C(EXIT_SUCCESS)
9 C(RAND_MAX)
10 C(MB_CUR_MAX)
11 {void *x=NULL;}
12 T(div_t)
13 T(ldiv_t)
14 T(lldiv_t)
15 T(size_t)
16 T(wchar_t)
17 #ifdef _POSIX_C_SOURCE
18 C(WEXITSTATUS(0))
19 C(WIFEXITED(0))
20 C(WIFSIGNALED(0))
21 C(WIFSTOPPED(0))
22 C(WNOHANG)
23 C(WSTOPSIG(0))
24 C(WTERMSIG(0))
25 C(WUNTRACED)
26 #endif
27 {void(*p)(int) = _Exit;}
28 {void(*p)(void) = abort;}
29 {int(*p)(int) = abs;}
30 {int(*p)(void(*)(void)) = atexit;}
31 {double(*p)(const char*) = atof;}
32 {int(*p)(const char*) = atoi;}
33 {long(*p)(const char*) = atol;}
34 {long long(*p)(const char*) = atoll;}
35 {void*(*p)(const void*,const void*,size_t,size_t,int(*)(const void*,const void*)) = bsearch;}
36 {void*(*p)(size_t,size_t) = calloc;}
37 {div_t(*p)(int,int) = div;}
38 {void(*p)(int) = exit;}
39 {void(*p)(void*) = free;}
40 {char*(*p)(const char*) = getenv;}
41 {int(*p)(char**,char*const*,char**) = getsubopt;}
42 {long(*p)(long) = labs;}
43 {ldiv_t(*p)(long,long) = ldiv;}
44 {long long(*p)(long long) = llabs;}
45 {lldiv_t(*p)(long long,long long) = lldiv;}
46 {void*(*p)(size_t) = malloc;}
47 {int(*p)(const char*,size_t) = mblen;}
48 {size_t(*p)(wchar_t*restrict,const char*restrict,size_t) = mbstowcs;}
49 {int(*p)(wchar_t*restrict,const char*restrict,size_t) = mbtowc;}
50 {int(*p)(void**,size_t,size_t) = posix_memalign;}
51 {void(*p)(void*,size_t,size_t,int(*)(const void*,const void*)) = qsort;}
52 {int(*p)(void) = rand;}
53 {void*(*p)(void*,size_t) = realloc;}
54 {void(*p)(unsigned) = srand;}
55 {double(*p)(const char*restrict,char**restrict) = strtod;}
56 {float(*p)(const char*restrict,char**restrict) = strtof;}
57 {long(*p)(const char*restrict,char**restrict,int) = strtol;}
58 {long double(*p)(const char*restrict,char**restrict) = strtold;}
59 {long long(*p)(const char*restrict,char**restrict,int) = strtoll;}
60 {unsigned long(*p)(const char*restrict,char**restrict,int) = strtoul;}
61 {unsigned long long(*p)(const char*restrict,char**restrict,int) = strtoull;}
62 {int(*p)(const char*) = system;}
63 {size_t(*p)(char*restrict,const wchar_t*restrict,size_t) = wcstombs;}
64 {int(*p)(char*,wchar_t) = wctomb;}
65 #ifdef _POSIX_C_SOURCE
66 {char*(*p)(char*) = mkdtemp;}
67 {int(*p)(char*) = mkstemp;}
68 {int(*p)(const char*,const char*,int) = setenv;}
69 {int(*p)(const char*) = unsetenv;}
70 #endif
71 #ifdef _XOPEN_SOURCE
72 {long(*p)(const char*) = a64l;}
73 {double(*p)(void) = drand48;}
74 {double(*p)(unsigned short[]) = erand48;}
75 {int(*p)(int) = grantpt;}
76 {char*(*p)(unsigned,char*,size_t) = initstate;}
77 {long(*p)(unsigned short[]) = jrand48;}
78 {char*(*p)(long) = l64a;}
79 {void(*p)(unsigned short[]) = lcong48;}
80 {long(*p)(void) = lrand48;}
81 {long(*p)(void) = mrand48;}
82 {long(*p)(unsigned short[]) = nrand48;}
83 {char*(*p)(int) = ptsname;}
84 {int(*p)(char*) = putenv;}
85 {long(*p)(void) = random;}
86 {char*(*p)(const char*restrict,char*restrict) = realpath;}
87 {unsigned short*(*p)(unsigned short[]) = seed48;}
88 {void(*p)(const char*) = setkey;}
89 {char*(*p)(char*) = setstate;}
90 {void(*p)(long) = srand48;}
91 {void(*p)(unsigned) = srandom;}
92 {int(*p)(int) = unlockpt;}
93 #endif
94 }
95
96 #ifdef _XOPEN_SOURCE
97 #include <fcntl.h>
98 static void g()
99 {
100 {int(*p)(int) = posix_openpt;}
101 }
102 #endif
103