mailing list of musl libc
 help / color / mirror / code / Atom feed
* the case for __MUSL__
@ 2014-12-29 16:27 Richard Gorton
  2014-12-29 17:15 ` Josiah Worcester
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Gorton @ 2014-12-29 16:27 UTC (permalink / raw)
  To: 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@cog-e.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-29 21:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-29 16:27 the case for __MUSL__ Richard Gorton
2014-12-29 17:15 ` Josiah Worcester
2014-12-29 17:17   ` Josiah Worcester
2014-12-29 17:37     ` Rich Felker
2014-12-29 17:51       ` Richard Gorton
2014-12-29 17:59         ` Josiah Worcester
2014-12-29 21:29           ` Justin Cormack
2014-12-29 21:55           ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).