[llvm-branch-commits] [libcxx] 344c7a1 - Add basic C++ library support.

Konstantin Schwarz via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 3 04:46:27 PDT 2021


Author: Konstantin Schwarz
Date: 2019-01-17T12:24:02+01:00
New Revision: 344c7a13c1e0d48c89165365d9637dc0bef408a2

URL: https://github.com/llvm/llvm-project/commit/344c7a13c1e0d48c89165365d9637dc0bef408a2
DIFF: https://github.com/llvm/llvm-project/commit/344c7a13c1e0d48c89165365d9637dc0bef408a2.diff

LOG: Add basic C++ library support.

Added: 
    libcxx/include/support/hightec/locale_htc.h

Modified: 
    libcxx/include/CMakeLists.txt
    libcxx/include/__config
    libcxx/include/__locale
    libcxx/include/math.h
    libcxx/src/locale.cpp
    libcxx/src/random.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index d9def18d725c4..80663b1631232 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -168,6 +168,7 @@ if(LIBCXX_INSTALL_SUPPORT_HEADERS)
     ${files}
     support/android/locale_bionic.h
     support/fuchsia/xlocale.h
+    support/hightec/locale_htc.h
     support/ibm/limits.h
     support/ibm/locale_mgmt_aix.h
     support/ibm/support.h

diff  --git a/libcxx/include/__config b/libcxx/include/__config
index 639d06c9f5d70..840da61978a36 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -307,6 +307,8 @@
 #  define _LIBCPP_USING_NACL_RANDOM
 #elif defined(_LIBCPP_WIN32API)
 #  define _LIBCPP_USING_WIN32_RANDOM
+#elif defined(__HIGHTEC__)
+// Do not define anything here for HighTec
 #else
 #  define _LIBCPP_USING_DEV_RANDOM
 #endif
@@ -979,6 +981,10 @@ template <unsigned> struct __static_assert_check {};
 #define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
 #endif
 
+#if defined(__HIGHTEC__)
+#define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#endif
+
 #if defined(__APPLE__)
 #  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
       defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)

diff  --git a/libcxx/include/__locale b/libcxx/include/__locale
index f43e7b4303d34..2a71c7d279e9a 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -37,6 +37,8 @@
 # include <support/fuchsia/xlocale.h>
 #elif defined(_LIBCPP_HAS_MUSL_LIBC)
 # include <support/musl/xlocale.h>
+#elif defined(__HIGHTEC__)
+# include <support/hightec/locale_htc.h>
 #endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/math.h b/libcxx/include/math.h
index 3cc72aa2791e3..d28194c2992a9 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -298,6 +298,8 @@ long double    truncl(long double x);
 #pragma GCC system_header
 #endif
 
+#include <type_traits>
+
 #include_next <math.h>
 
 #ifdef __cplusplus
@@ -306,7 +308,7 @@ long double    truncl(long double x);
 // back to C++ linkage before including these C++ headers.
 extern "C++" {
 
-#include <type_traits>
+
 #include <limits>
 
 // signbit

diff  --git a/libcxx/include/support/hightec/locale_htc.h b/libcxx/include/support/hightec/locale_htc.h
new file mode 100644
index 0000000000000..7f06f8e243633
--- /dev/null
+++ b/libcxx/include/support/hightec/locale_htc.h
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//===------------  support/hightec/locale_htc.h -----------------===//
+//
+//                     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.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_HIGHTEC_LOCALE_HTC_H
+#define _LIBCPP_SUPPORT_HIGHTEC_LOCALE_HTC_H
+
+#include <clocale>
+
+// Add definition for isascii function, which is not part of ISO C
+static inline int isascii(int c) {
+  return c == (c & 0x7f);
+}
+
+// Patch over lack of extended locale support
+typedef void *locale_t;
+
+static inline locale_t duplocale(locale_t) {
+  return NULL;
+}
+
+static inline void freelocale(locale_t) {
+}
+
+static inline locale_t newlocale(int, const char *, locale_t) {
+  return NULL;
+}
+
+static inline locale_t uselocale(locale_t) {
+  return NULL;
+}
+
+#define LC_COLLATE_MASK  (LC_COLLATE)
+#define LC_CTYPE_MASK    (LC_CTYPE)
+#define LC_MESSAGES_MASK (LC_MESSAGES)
+#define LC_MONETARY_MASK (LC_MONETARY)
+#define LC_NUMERIC_MASK  (LC_NUMERIC)
+#define LC_TIME_MASK     (LC_TIME)
+#define LC_ALL_MASK (LC_COLLATE_MASK|\
+                     LC_CTYPE_MASK|\
+                     LC_MONETARY_MASK|\
+                     LC_NUMERIC_MASK|\
+                     LC_TIME_MASK|\
+                     LC_MESSAGES_MASK)
+
+#include <support/xlocale/__posix_l_fallback.h>
+#include <support/xlocale/__strtonum_fallback.h>
+
+
+#endif // _LIBCPP_SUPPORT_HIGHTEC_LOCALE_HTC_H

diff  --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index b9c701137df2d..0a23aba354697 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -31,6 +31,8 @@
 #include "__sso_allocator"
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include "support/win32/locale_win32.h"
+#elif defined(__HIGHTEC__)
+
 #elif !defined(__BIONIC__)
 #include <langinfo.h>
 #endif

diff  --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp
index 4a2468368d065..90a822d9a247c 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -166,6 +166,8 @@ random_device::operator()()
     return r;
 }
 
+#elif defined(__HIGHTEC__)
+#warning TODO: implement random device for this architecture
 #else
 #error "Random device not implemented for this architecture"
 #endif


        


More information about the llvm-branch-commits mailing list