1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
2*4684ddb6SLionel Sambuc //
3*4684ddb6SLionel Sambuc // The LLVM Compiler Infrastructure
4*4684ddb6SLionel Sambuc //
5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*4684ddb6SLionel Sambuc //
8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===//
9*4684ddb6SLionel Sambuc
10*4684ddb6SLionel Sambuc // test <stdlib.h>
11*4684ddb6SLionel Sambuc
12*4684ddb6SLionel Sambuc #include <stdlib.h>
13*4684ddb6SLionel Sambuc #include <type_traits>
14*4684ddb6SLionel Sambuc
15*4684ddb6SLionel Sambuc #ifndef EXIT_FAILURE
16*4684ddb6SLionel Sambuc #error EXIT_FAILURE not defined
17*4684ddb6SLionel Sambuc #endif
18*4684ddb6SLionel Sambuc
19*4684ddb6SLionel Sambuc #ifndef EXIT_SUCCESS
20*4684ddb6SLionel Sambuc #error EXIT_SUCCESS not defined
21*4684ddb6SLionel Sambuc #endif
22*4684ddb6SLionel Sambuc
23*4684ddb6SLionel Sambuc #ifndef MB_CUR_MAX
24*4684ddb6SLionel Sambuc #error MB_CUR_MAX not defined
25*4684ddb6SLionel Sambuc #endif
26*4684ddb6SLionel Sambuc
27*4684ddb6SLionel Sambuc #ifndef NULL
28*4684ddb6SLionel Sambuc #error NULL not defined
29*4684ddb6SLionel Sambuc #endif
30*4684ddb6SLionel Sambuc
31*4684ddb6SLionel Sambuc #ifndef RAND_MAX
32*4684ddb6SLionel Sambuc #error RAND_MAX not defined
33*4684ddb6SLionel Sambuc #endif
34*4684ddb6SLionel Sambuc
main()35*4684ddb6SLionel Sambuc int main()
36*4684ddb6SLionel Sambuc {
37*4684ddb6SLionel Sambuc size_t s = 0;
38*4684ddb6SLionel Sambuc div_t d;
39*4684ddb6SLionel Sambuc ldiv_t ld;
40*4684ddb6SLionel Sambuc lldiv_t lld;
41*4684ddb6SLionel Sambuc char** endptr = 0;
42*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(atof("")), double>::value), "");
43*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(atoi("")), int>::value), "");
44*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(atol("")), long>::value), "");
45*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(atoll("")), long long>::value), "");
46*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(getenv("")), char*>::value), "");
47*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtod("", endptr)), double>::value), "");
48*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtof("", endptr)), float>::value), "");
49*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtold("", endptr)), long double>::value), "");
50*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtol("", endptr,0)), long>::value), "");
51*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtoll("", endptr,0)), long long>::value), "");
52*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtoul("", endptr,0)), unsigned long>::value), "");
53*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(strtoull("", endptr,0)), unsigned long long>::value), "");
54*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(rand()), int>::value), "");
55*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(srand(0)), void>::value), "");
56*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(calloc(0,0)), void*>::value), "");
57*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(free(0)), void>::value), "");
58*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(malloc(0)), void*>::value), "");
59*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(realloc(0,0)), void*>::value), "");
60*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(abort()), void>::value), "");
61*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(atexit(0)), int>::value), "");
62*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(exit(0)), void>::value), "");
63*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(_Exit(0)), void>::value), "");
64*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(getenv("")), char*>::value), "");
65*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(system("")), int>::value), "");
66*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(bsearch(0,0,0,0,0)), void*>::value), "");
67*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(qsort(0,0,0,0)), void>::value), "");
68*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(abs(0)), int>::value), "");
69*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(labs((long)0)), long>::value), "");
70*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(llabs((long long)0)), long long>::value), "");
71*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(div(0,0)), div_t>::value), "");
72*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(ldiv(0L,0L)), ldiv_t>::value), "");
73*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(lldiv(0LL,0LL)), lldiv_t>::value), "");
74*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(mblen("",0)), int>::value), "");
75*4684ddb6SLionel Sambuc wchar_t* pw = 0;
76*4684ddb6SLionel Sambuc const wchar_t* pwc = 0;
77*4684ddb6SLionel Sambuc char* pc = 0;
78*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(mbtowc(pw,"",0)), int>::value), "");
79*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(wctomb(pc,L' ')), int>::value), "");
80*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(mbstowcs(pw,"",0)), size_t>::value), "");
81*4684ddb6SLionel Sambuc static_assert((std::is_same<decltype(wcstombs(pc,pwc,0)), size_t>::value), "");
82*4684ddb6SLionel Sambuc }
83