//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // [depr.c.headers]p2: // Every C header, each of which has a name of the form name.h, behaves as if // each name placed in the standard library namespace by the corresponding // cname header is placed within the global namespace scope. // // This implies that the name in the global namespace and the name in namespace // std declare the same entity, so check that that is actually the case. // Pull in libc++'s static_assert emulation if in C++98 mode. #include template struct check { static_assert(F == G, ""); }; // ctype.h #include #include void test_ctype() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // fenv.h #include #include void test_fenv() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // inttypes.h #include #include // Avoid error if abs and div are not declared by . struct nat {}; static void abs(nat); static void div(nat); namespace std { static void abs(nat); static void div(nat); } // These may or may not exist, depending on whether intmax_t // is an extended integer type (larger than long long). template sizeof(long long))> void test_inttypes_abs_div() { check(); check(); } template<> void test_inttypes_abs_div() {} void test_inttypes() { test_inttypes_abs_div(); check(); check(); check(); check(); check(); check(); } // locale.h #include #include void test_locale() { check(); check(); } // math.h #include #include template void test_math_float() { typedef Float ff(Float); typedef Float ffi(Float, int); typedef Float ffpi(Float, int*); typedef Float ffl(Float, long); typedef Float fff(Float, Float); typedef Float ffpf(Float, Float*); typedef Float ffld(Float, long double); typedef Float fffpi(Float, Float, int*); typedef Float ffff(Float, Float, Float); typedef bool bf(Float); typedef bool bff(Float, Float); typedef int i_f(Float); typedef long lf(Float); typedef long long llf(Float); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } void test_math() { test_math_float(); test_math_float(); test_math_float(); check(); check(); check(); } // setjmp.h #include #include void test_setjmp() { check(); } // signal.h #include #include void test_signal() { check(); typedef void Handler(int); check(); } // stdio.h #include #include void test_stdio() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // stdlib.h #include #include void test_stdlib() { typedef int Comp(const void*, const void*); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // string.h #include #include void test_string() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // time.h #include #include void test_time() { check(); check(); check(); check(); check(); check(); check(); check(); check(); } #if 0 // FIXME: and are missing. // uchar.h #include #include void test_uchar() { check(); check(); check(); check(); } #endif // wchar.h #include #include void test_wchar() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } // wctype.h #include #include void test_wctype() { check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); check(); } int main() { test_ctype(); test_fenv(); test_inttypes(); test_locale(); test_math(); test_setjmp(); test_signal(); test_stdio(); test_stdlib(); test_string(); test_time(); //test_uchar(); test_wchar(); test_wctype(); }