|
Message-Id: <F4BC7730-8BE9-48C0-BE2A-56351E4D795C@cognitive-electronics.com> Date: Mon, 29 Dec 2014 11:27:20 -0500 From: Richard Gorton <rcgorton@...nitive-electronics.com> To: "musl@...ts.openwall.com" <musl@...ts.openwall.com> Subject: the case for __MUSL__ Hi, I'm working on getting C++ working for our target: we use clang, and libcxx/libcxxabi libraries from llvm.org it seems to me (as I'm doing this) that instead of doing things like // Our compiler defines __COGNITIVE__ #if defined(__COGNITIVE__) It would make more sense to use #if defined(__MUSL__) I'm not proposing/suggesting use of this within musl itself, but for use in other libraries (such as libcxx) which 'know' about the internal implementation of libc. Thoughts & Comments appreciated An example case is in libcxx/src/locale.cpp, where there are bits of code related to accessing the current locale: const ctype<char>::mask* ctype<char>::classic_table() _NOEXCEPT { #if defined(__APPLE__) || defined(__FreeBSD__) return _DefaultRuneLocale.__runetype; #elif defined(__NetBSD__) return _C_ctype_tab_ + 1; #elif defined(__GLIBC__) return __cloc()->__ctype_b; #elif __sun__ return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) return _ctype+1; // internal ctype mask table defined in msvcrt.dll // This is assumed to be safe, which is a nonsense assumption because we're // going to end up dereferencing it later... #elif defined(__EMSCRIPTEN__) || defined(__COGNITIVE__) return *__ctype_b_loc(); #elif defined(_AIX) return (const unsigned int *)__lc_ctype_ptr->obj->mask; #elif defined(__ANDROID__) return _ctype_; #else // Platform not supported: abort so the person doing the port knows what to // fix # warning ctype<char>::classic_table() is not implemented printf("ctype<char>::classic_table() is not implemented\n"); abort(); return NULL; #endif } Regards, Richard rcgorton@...-e.com
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.