mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: the prototype decl of  memcpy/memcmp/calloc/free shouldnot in sched.h
Date: Sat, 1 Nov 2014 13:02:36 -0400	[thread overview]
Message-ID: <20141101170236.GJ22465@brightrain.aerifal.cx> (raw)
In-Reply-To: <20141101162230.GH10829@port70.net>

On Sat, Nov 01, 2014 at 05:22:30PM +0100, Szabolcs Nagy wrote:
> * ????????? <jianzhong.huang@i-soft.com.cn> [2014-10-31 11:42:35 +0800]:
> > 
> > In firefox, there is a system_wrapper header include sched.h, but in hunspell codes, calloc and free was redefined, so there is a conflicts here.
> > for example, in "extensions/spellcheck/hunspell/src/hunspell_alloc_hooks.h"
> > #define calloc(count, size) HunspellAllocator::CountingCalloc(count, size)
> > 
> 
> a simple fix for that in musl is
> 
> 	void *(calloc)(size_t, size_t);
> 
> or
> 
> 	#define CPU_ALLOC(n) __cpu_alloc(n)
> 	static __inline cpu_set_t *__cpu_alloc(size_t _n)
> 	{
> 		extern void *(calloc)(size_t,size_t);
> 		return (calloc)(1,CPU_ALLOC_SIZE(_n));
> 	}
> 
> which almost gets the namespace right: only a non-function like
> calloc macro defined before sched.h would be an issue

Yes, I like moving the declarations to non-file-scope better.

> getting the namespace completely right would need a new extern
> identifier in musl that aliases or wraps calloc
> 
> but _GNU_SOURCE has no well defined namespace requirement
> so it is hard to justify workarounds that spill over into
> other parts of the libc

I think the problem may be that GCC activates _GNU_SOURCE by default
for C++. Am I right about this? If so, perhaps we should look for
things that could cause excessive breakage under this behavior and try
to fix them. Or (easier) we can just wait until somebody finds a
problem and address them on a per-case basis.

Rich


  reply	other threads:[~2014-11-01 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-31  3:03 the prototype decl of memcpy/memcmp/calloc/free should not " 黄建忠
2014-10-31  3:24 ` Rich Felker
2014-10-31  3:42   ` the prototype decl of memcpy/memcmp/calloc/free shouldnot " 黄建忠
2014-11-01 16:22     ` Szabolcs Nagy
2014-11-01 17:02       ` Rich Felker [this message]
2014-11-01 20:49         ` Alexander Monakov
2014-11-02  4:48         ` 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=20141101170236.GJ22465@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).