mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Richard Gorton <rcgorton@cognitive-electronics.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: the case for __MUSL__
Date: Mon, 29 Dec 2014 11:27:20 -0500	[thread overview]
Message-ID: <F4BC7730-8BE9-48C0-BE2A-56351E4D795C@cognitive-electronics.com> (raw)


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



             reply	other threads:[~2014-12-29 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 16:27 Richard Gorton [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F4BC7730-8BE9-48C0-BE2A-56351E4D795C@cognitive-electronics.com \
    --to=rcgorton@cognitive-electronics.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).