blob: fc9ffed71f16d7cb7199561b840f1f59cb4b132d [file] [log] [blame]
Elliott Hughes13da6002025-02-03 10:42:13 -08001// Copyright (C) 2017 The Android Open Source Project
2// SPDX-License-Identifier: BSD-2-Clause
Elliott Hughes21b56eb2017-10-20 17:57:17 -07003
4#include <stdlib.h>
5
6#include "header_checks.h"
7
8static void stdlib_h() {
9 MACRO(EXIT_FAILURE);
10 MACRO_VALUE(EXIT_SUCCESS, 0);
11
12 MACRO(RAND_MAX);
13
14 MACRO(MB_CUR_MAX);
15
16 MACRO(NULL);
17
18 TYPE(div_t);
19 TYPE(ldiv_t);
20 TYPE(lldiv_t);
21 TYPE(size_t);
22 TYPE(wchar_t);
23
24#if !defined(WEXITSTATUS)
25#error WEXITSTATUS
26#endif
27#if !defined(WIFEXITED)
28#error WIFEXITED
29#endif
30#if !defined(WIFSIGNALED)
31#error WIFSIGNALED
32#endif
33#if !defined(WIFSTOPPED)
34#error WIFSTOPPED
35#endif
36 MACRO(WNOHANG);
37#if !defined(WSTOPSIG)
38#error WSTOPSIG
39#endif
40#if !defined(WTERMSIG)
41#error WTERMSIG
42#endif
43 MACRO(WUNTRACED);
44
45 FUNCTION(_Exit, void (*f)(int));
46#if !defined(__BIONIC__)
47 FUNCTION(a64l, long (*f)(const char*));
48#endif
49 FUNCTION(abort, void (*f)(void));
50 FUNCTION(abs, int (*f)(int));
51 FUNCTION(atexit, int (*f)(void (*)(void)));
52 FUNCTION(atof, double (*f)(const char*));
53 FUNCTION(atoi, int (*f)(const char*));
54 FUNCTION(atol, long (*f)(const char*));
55 FUNCTION(atoll, long long (*f)(const char*));
56 FUNCTION(bsearch, void* (*f)(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)));
57 FUNCTION(calloc, void* (*f)(size_t, size_t));
58 FUNCTION(div, div_t (*f)(int, int));
59 FUNCTION(drand48, double (*f)(void));
60 FUNCTION(erand48, double (*f)(unsigned short[3]));
61 FUNCTION(exit, void (*f)(int));
62 FUNCTION(free, void (*f)(void*));
63 FUNCTION(getenv, char* (*f)(const char*));
64 FUNCTION(getsubopt, int (*f)(char**, char* const*, char**));
65 FUNCTION(grantpt, int (*f)(int));
66 FUNCTION(initstate, char* (*f)(unsigned, char*, size_t));
67 FUNCTION(jrand48, long (*f)(unsigned short[3]));
68#if !defined(__BIONIC__)
69 FUNCTION(l64a, char* (*f)(long));
70#endif
71 FUNCTION(labs, long (*f)(long));
72 FUNCTION(lcong48, void (*f)(unsigned short[7]));
73 FUNCTION(ldiv, ldiv_t (*f)(long, long));
74 FUNCTION(llabs, long long (*f)(long long));
75 FUNCTION(lldiv, lldiv_t (*f)(long long, long long));
76 FUNCTION(lrand48, long (*f)(void));
77 FUNCTION(malloc, void* (*f)(size_t));
78 FUNCTION(mblen, int (*f)(const char*, size_t));
79 FUNCTION(mbstowcs, size_t (*f)(wchar_t*, const char*, size_t));
80 FUNCTION(mbtowc, int (*f)(wchar_t*, const char*, size_t));
81 FUNCTION(mkdtemp, char* (*f)(char*));
82 FUNCTION(mkstemp, int (*f)(char*));
83 FUNCTION(mrand48, long (*f)(void));
84 FUNCTION(nrand48, long (*f)(unsigned short[3]));
85 FUNCTION(posix_memalign, int (*f)(void**, size_t, size_t));
86 FUNCTION(posix_openpt, int (*f)(int));
87 FUNCTION(ptsname, char* (*f)(int));
88 FUNCTION(putenv, int (*f)(char*));
89 FUNCTION(qsort, void (*f)(void*, size_t, size_t, int (*)(const void*, const void*)));
Elliott Hughes534702c2024-08-05 15:54:41 +000090#if !defined(__GLIBC__) // Our glibc is too old.
91 FUNCTION(qsort_r, void (*f)(void*, size_t, size_t, int (*)(const void*, const void*, void*), void*));
92#endif
Elliott Hughes21b56eb2017-10-20 17:57:17 -070093 FUNCTION(rand, int (*f)(void));
94 FUNCTION(rand_r, int (*f)(unsigned*));
95 FUNCTION(random, long (*f)(void));
96 FUNCTION(realloc, void* (*f)(void*, size_t));
Elliott Hughesf4d57ac2025-01-28 14:22:12 -080097#if !defined(__GLIBC__) // Our glibc is too old.
98 FUNCTION(reallocarray, void* (*f)(void*, size_t, size_t));
99#endif
Elliott Hughes21b56eb2017-10-20 17:57:17 -0700100 FUNCTION(realpath, char* (*f)(const char*, char*));
101 FUNCTION(seed48, unsigned short* (*f)(unsigned short[3]));
102 FUNCTION(setenv, int (*f)(const char*, const char*, int));
103#if !defined(__BIONIC__)
104 FUNCTION(setkey, void (*f)(const char*));
105#endif
106 FUNCTION(setstate, char* (*f)(char*));
107 FUNCTION(srand, void (*f)(unsigned));
108 FUNCTION(srand48, void (*f)(long));
109 FUNCTION(srandom, void (*f)(unsigned));
110 FUNCTION(strtod, double (*f)(const char*, char**));
111 FUNCTION(strtof, float (*f)(const char*, char**));
112 FUNCTION(strtol, long (*f)(const char*, char**, int));
113 FUNCTION(strtold, long double (*f)(const char*, char**));
114 FUNCTION(strtoll, long long (*f)(const char*, char**, int));
115 FUNCTION(strtoul, unsigned long (*f)(const char*, char**, int));
116 FUNCTION(strtoull, unsigned long long (*f)(const char*, char**, int));
117 FUNCTION(system, int (*f)(const char*));
118 FUNCTION(unlockpt, int (*f)(int));
119 FUNCTION(unsetenv, int (*f)(const char*));
120 FUNCTION(wcstombs, size_t (*f)(char*, const wchar_t*, size_t));
121 FUNCTION(wctomb, int (*f)(char*, wchar_t));
122}