mailing list of musl libc
 help / color / mirror / code / Atom feed
* Using libcxx with musl's math.h
@ 2016-03-10 18:46 Jeroen Ketema
  2016-03-10 19:13 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Jeroen Ketema @ 2016-03-10 18:46 UTC (permalink / raw)
  To: musl

Hello,

I'm trying to use libcxx's cmath header together with musl's math.h. 
However this currently fails, because libcxx expects certain symbols to 
be functions, while musl defines them as macros. For example (compiling 
with clang):

cmath:309:9: error: no member named 'signbit' in the global
       namespace; did you mean '__signbit'?
using ::signbit;
       ~~^

where signbit is a macro in musl, but where libcxx expects it to be a 
function.

My question is: what would be the proper way to fix this? The main issue 
being of course that I cannot simply define signbit to be a function, 
because it requires a form of overloading.

Thanks,

  Jeroen



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

* Re: Using libcxx with musl's math.h
  2016-03-10 18:46 Using libcxx with musl's math.h Jeroen Ketema
@ 2016-03-10 19:13 ` Rich Felker
  2016-03-10 20:01   ` Jeroen Ketema
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2016-03-10 19:13 UTC (permalink / raw)
  To: musl

On Thu, Mar 10, 2016 at 06:46:12PM +0000, Jeroen Ketema wrote:
> Hello,
> 
> I'm trying to use libcxx's cmath header together with musl's math.h.
> However this currently fails, because libcxx expects certain symbols
> to be functions, while musl defines them as macros. For example
> (compiling with clang):
> 
> cmath:309:9: error: no member named 'signbit' in the global
>       namespace; did you mean '__signbit'?
> using ::signbit;
>       ~~^
> 
> where signbit is a macro in musl, but where libcxx expects it to be
> a function.
> 
> My question is: what would be the proper way to fix this? The main
> issue being of course that I cannot simply define signbit to be a
> function, because it requires a form of overloading.

I think this is a libcxx bug. C requires signbit to be a macro. If C++
has different requirements then the C++ implementation should be
providing an overlay header that satisfies them.

Rich


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

* Re: Using libcxx with musl's math.h
  2016-03-10 19:13 ` Rich Felker
@ 2016-03-10 20:01   ` Jeroen Ketema
  0 siblings, 0 replies; 3+ messages in thread
From: Jeroen Ketema @ 2016-03-10 20:01 UTC (permalink / raw)
  To: musl


Hi Rich,

Thanks for your quick answer.

Digging a bit deeper, it turns out that libcxx comes with it’s own math.h, which uses #include_next to include the C library's math.h. I totally missed this the first time through libcxx’s headers. Sorry for the noise.

Best,

 Jeroen

> On 10 Mar 2016, at 19:13, Rich Felker <dalias@libc.org> wrote:
> 
> On Thu, Mar 10, 2016 at 06:46:12PM +0000, Jeroen Ketema wrote:
>> Hello,
>> 
>> I'm trying to use libcxx's cmath header together with musl's math.h.
>> However this currently fails, because libcxx expects certain symbols
>> to be functions, while musl defines them as macros. For example
>> (compiling with clang):
>> 
>> cmath:309:9: error: no member named 'signbit' in the global
>>      namespace; did you mean '__signbit'?
>> using ::signbit;
>>      ~~^
>> 
>> where signbit is a macro in musl, but where libcxx expects it to be
>> a function.
>> 
>> My question is: what would be the proper way to fix this? The main
>> issue being of course that I cannot simply define signbit to be a
>> function, because it requires a form of overloading.
> 
> I think this is a libcxx bug. C requires signbit to be a macro. If C++
> has different requirements then the C++ implementation should be
> providing an overlay header that satisfies them.
> 
> Rich



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

end of thread, other threads:[~2016-03-10 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 18:46 Using libcxx with musl's math.h Jeroen Ketema
2016-03-10 19:13 ` Rich Felker
2016-03-10 20:01   ` Jeroen Ketema

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).