[libcxx] r249741 - Split <inttypes.h> out of <cinttypes>.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 13:38:54 PDT 2015


Author: rsmith
Date: Thu Oct  8 15:38:53 2015
New Revision: 249741

URL: http://llvm.org/viewvc/llvm-project?rev=249741&view=rev
Log:
Split <inttypes.h> out of <cinttypes>.

Added:
    libcxx/trunk/include/inttypes.h
      - copied, changed from r249736, libcxx/trunk/include/cinttypes
Modified:
    libcxx/trunk/include/cinttypes
    libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp

Modified: libcxx/trunk/include/cinttypes
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/cinttypes?rev=249741&r1=249740&r2=249741&view=diff
==============================================================================
--- libcxx/trunk/include/cinttypes (original)
+++ libcxx/trunk/include/cinttypes Thu Oct  8 15:38:53 2015
@@ -246,10 +246,7 @@ uintmax_t wcstoumax(const wchar_t* restr
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 using::imaxdiv_t;
-
-#undef imaxabs
 using::imaxabs;
-#undef imaxdiv
 using::imaxdiv;
 using::strtoimax;
 using::strtoumax;

Copied: libcxx/trunk/include/inttypes.h (from r249736, libcxx/trunk/include/cinttypes)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/inttypes.h?p2=libcxx/trunk/include/inttypes.h&p1=libcxx/trunk/include/cinttypes&r1=249736&r2=249741&rev=249741&view=diff
==============================================================================
--- libcxx/trunk/include/cinttypes (original)
+++ libcxx/trunk/include/inttypes.h Thu Oct  8 15:38:53 2015
@@ -1,5 +1,5 @@
 // -*- C++ -*-
-//===--------------------------- cinttypes --------------------------------===//
+//===--------------------------- inttypes.h -------------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,15 +8,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef _LIBCPP_CINTTYPES
-#define _LIBCPP_CINTTYPES
+#ifndef _LIBCPP_INTTYPES_H
+#define _LIBCPP_INTTYPES_H
 
 /*
-    cinttypes synopsis
+    inttypes.h synopsis
 
 This entire header is C99 / C++0X
 
-#include <cstdint>  // <cinttypes> includes <cstdint>
+#include <stdint.h>  // <cinttypes> includes <cstdint>
 
 Macros:
 
@@ -218,9 +218,6 @@ Macros:
     SCNxMAX
     SCNxPTR
 
-namespace std
-{
-
 Types:
 
     imaxdiv_t
@@ -232,30 +229,22 @@ uintmax_t strtoumax(const char* restrict
 intmax_t  wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
 uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
 
-}  // std
 */
 
 #include <__config>
-#include <cstdint>
-#include <inttypes.h>
+#include_next <inttypes.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
-_LIBCPP_BEGIN_NAMESPACE_STD
+#ifdef __cplusplus
 
-using::imaxdiv_t;
+#include <stdint.h>
 
 #undef imaxabs
-using::imaxabs;
 #undef imaxdiv
-using::imaxdiv;
-using::strtoimax;
-using::strtoumax;
-using::wcstoimax;
-using::wcstoumax;
 
-_LIBCPP_END_NAMESPACE_STD
+#endif
 
-#endif  // _LIBCPP_CINTTYPES
+#endif  // _LIBCPP_INTTYPES_H

Modified: libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp?rev=249741&r1=249740&r2=249741&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/inttypes_h.pass.cpp Thu Oct  8 15:38:53 2015
@@ -12,6 +12,250 @@
 #include <inttypes.h>
 #include <type_traits>
 
+#ifndef INT8_MIN
+#error INT8_MIN not defined
+#endif
+
+#ifndef INT16_MIN
+#error INT16_MIN not defined
+#endif
+
+#ifndef INT32_MIN
+#error INT32_MIN not defined
+#endif
+
+#ifndef INT64_MIN
+#error INT64_MIN not defined
+#endif
+
+#ifndef INT8_MAX
+#error INT8_MAX not defined
+#endif
+
+#ifndef INT16_MAX
+#error INT16_MAX not defined
+#endif
+
+#ifndef INT32_MAX
+#error INT32_MAX not defined
+#endif
+
+#ifndef INT64_MAX
+#error INT64_MAX not defined
+#endif
+
+#ifndef UINT8_MAX
+#error UINT8_MAX not defined
+#endif
+
+#ifndef UINT16_MAX
+#error UINT16_MAX not defined
+#endif
+
+#ifndef UINT32_MAX
+#error UINT32_MAX not defined
+#endif
+
+#ifndef UINT64_MAX
+#error UINT64_MAX not defined
+#endif
+
+#ifndef INT_LEAST8_MIN
+#error INT_LEAST8_MIN not defined
+#endif
+
+#ifndef INT_LEAST16_MIN
+#error INT_LEAST16_MIN not defined
+#endif
+
+#ifndef INT_LEAST32_MIN
+#error INT_LEAST32_MIN not defined
+#endif
+
+#ifndef INT_LEAST64_MIN
+#error INT_LEAST64_MIN not defined
+#endif
+
+#ifndef INT_LEAST8_MAX
+#error INT_LEAST8_MAX not defined
+#endif
+
+#ifndef INT_LEAST16_MAX
+#error INT_LEAST16_MAX not defined
+#endif
+
+#ifndef INT_LEAST32_MAX
+#error INT_LEAST32_MAX not defined
+#endif
+
+#ifndef INT_LEAST64_MAX
+#error INT_LEAST64_MAX not defined
+#endif
+
+#ifndef UINT_LEAST8_MAX
+#error UINT_LEAST8_MAX not defined
+#endif
+
+#ifndef UINT_LEAST16_MAX
+#error UINT_LEAST16_MAX not defined
+#endif
+
+#ifndef UINT_LEAST32_MAX
+#error UINT_LEAST32_MAX not defined
+#endif
+
+#ifndef UINT_LEAST64_MAX
+#error UINT_LEAST64_MAX not defined
+#endif
+
+#ifndef INT_FAST8_MIN
+#error INT_FAST8_MIN not defined
+#endif
+
+#ifndef INT_FAST16_MIN
+#error INT_FAST16_MIN not defined
+#endif
+
+#ifndef INT_FAST32_MIN
+#error INT_FAST32_MIN not defined
+#endif
+
+#ifndef INT_FAST64_MIN
+#error INT_FAST64_MIN not defined
+#endif
+
+#ifndef INT_FAST8_MAX
+#error INT_FAST8_MAX not defined
+#endif
+
+#ifndef INT_FAST16_MAX
+#error INT_FAST16_MAX not defined
+#endif
+
+#ifndef INT_FAST32_MAX
+#error INT_FAST32_MAX not defined
+#endif
+
+#ifndef INT_FAST64_MAX
+#error INT_FAST64_MAX not defined
+#endif
+
+#ifndef UINT_FAST8_MAX
+#error UINT_FAST8_MAX not defined
+#endif
+
+#ifndef UINT_FAST16_MAX
+#error UINT_FAST16_MAX not defined
+#endif
+
+#ifndef UINT_FAST32_MAX
+#error UINT_FAST32_MAX not defined
+#endif
+
+#ifndef UINT_FAST64_MAX
+#error UINT_FAST64_MAX not defined
+#endif
+
+#ifndef INTPTR_MIN
+#error INTPTR_MIN not defined
+#endif
+
+#ifndef INTPTR_MAX
+#error INTPTR_MAX not defined
+#endif
+
+#ifndef UINTPTR_MAX
+#error UINTPTR_MAX not defined
+#endif
+
+#ifndef INTMAX_MIN
+#error INTMAX_MIN not defined
+#endif
+
+#ifndef INTMAX_MAX
+#error INTMAX_MAX not defined
+#endif
+
+#ifndef UINTMAX_MAX
+#error UINTMAX_MAX not defined
+#endif
+
+#ifndef PTRDIFF_MIN
+#error PTRDIFF_MIN not defined
+#endif
+
+#ifndef PTRDIFF_MAX
+#error PTRDIFF_MAX not defined
+#endif
+
+#ifndef SIG_ATOMIC_MIN
+#error SIG_ATOMIC_MIN not defined
+#endif
+
+#ifndef SIG_ATOMIC_MAX
+#error SIG_ATOMIC_MAX not defined
+#endif
+
+#ifndef SIZE_MAX
+#error SIZE_MAX not defined
+#endif
+
+#ifndef WCHAR_MIN
+#error WCHAR_MIN not defined
+#endif
+
+#ifndef WCHAR_MAX
+#error WCHAR_MAX not defined
+#endif
+
+#ifndef WINT_MIN
+#error WINT_MIN not defined
+#endif
+
+#ifndef WINT_MAX
+#error WINT_MAX not defined
+#endif
+
+#ifndef INT8_C
+#error INT8_C not defined
+#endif
+
+#ifndef INT16_C
+#error INT16_C not defined
+#endif
+
+#ifndef INT32_C
+#error INT32_C not defined
+#endif
+
+#ifndef INT64_C
+#error INT64_C not defined
+#endif
+
+#ifndef UINT8_C
+#error UINT8_C not defined
+#endif
+
+#ifndef UINT16_C
+#error UINT16_C not defined
+#endif
+
+#ifndef UINT32_C
+#error UINT32_C not defined
+#endif
+
+#ifndef UINT64_C
+#error UINT64_C not defined
+#endif
+
+#ifndef INTMAX_C
+#error INTMAX_C not defined
+#endif
+
+#ifndef UINTMAX_C
+#error UINTMAX_C not defined
+#endif
+
 #ifndef PRId8
 #error PRId8 not defined
 #endif
@@ -631,8 +875,49 @@
 int main()
 {
     {
-      imaxdiv_t  i1 = {0};
-      ((void)i1);
+    int8_t  i1 = 0;
+    int16_t i2 = 0;
+    int32_t i3 = 0;
+    int64_t i4 = 0;
+    }
+    {
+    uint8_t  i1 = 0;
+    uint16_t i2 = 0;
+    uint32_t i3 = 0;
+    uint64_t i4 = 0;
+    }
+    {
+    int_least8_t  i1 = 0;
+    int_least16_t i2 = 0;
+    int_least32_t i3 = 0;
+    int_least64_t i4 = 0;
+    }
+    {
+    uint_least8_t  i1 = 0;
+    uint_least16_t i2 = 0;
+    uint_least32_t i3 = 0;
+    uint_least64_t i4 = 0;
+    }
+    {
+    int_fast8_t  i1 = 0;
+    int_fast16_t i2 = 0;
+    int_fast32_t i3 = 0;
+    int_fast64_t i4 = 0;
+    }
+    {
+    uint_fast8_t  i1 = 0;
+    uint_fast16_t i2 = 0;
+    uint_fast32_t i3 = 0;
+    uint_fast64_t i4 = 0;
+    }
+    {
+    intptr_t  i1 = 0;
+    uintptr_t i2 = 0;
+    intmax_t  i3 = 0;
+    uintmax_t i4 = 0;
+    }
+    {
+    imaxdiv_t  i1 = {0};
     }
     intmax_t i = 0;
     static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");




More information about the cfe-commits mailing list