mailing list of musl libc
 help / color / mirror / code / Atom feed
* Missing include of <string.h> in sched.h?
@ 2017-09-08  7:43 Jörg Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Jörg Krause @ 2017-09-08  7:43 UTC (permalink / raw)
  To: musl

Hi,

latest Boost 1.65.1 fails to compile with a musl toolchain [1].

The issue is that Boost uses the `CPU_ZERO` macro which expands to
`memset()` [2].

The Linux Programmer's Manual state that memset() is defined in
string.h [3].

Therefore, shouldn't shed.h include string.h?

[1] https://github.com/boostorg/fiber/pull/142
[2] https://git.musl-libc.org/cgit/musl/tree/include/sched.h#n110
[3] http://man7.org/linux/man-pages/man3/memset.3.html

Best regards,
Jörg Krause


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

* Re: Missing include of <string.h> in sched.h?
  2017-09-08  8:49 ` Szabolcs Nagy
@ 2017-09-08  9:44   ` Jörg Krause
  0 siblings, 0 replies; 5+ messages in thread
From: Jörg Krause @ 2017-09-08  9:44 UTC (permalink / raw)
  To: musl

On Fri, 2017-09-08 at 10:49 +0200, Szabolcs Nagy wrote:
> * Jörg Krause <joerg.krause@embedded.rocks> [2017-09-08 09:46:56 +0200]:
> > latest Boost 1.65.1 fails to compile with a musl toolchain [1].
> > 
> > The issue is that Boost uses the `CPU_ZERO` macro which expands to
> > `memset()` [2].
> > 
> > The Linux Programmer's Manual state that memset() is defined in
> > string.h [3].
> > 
> > Therefore, shouldn't shed.h include string.h?
> > 
> 
> it should probably include string.h and
> stdlib.h under _GNU_SOURCE
> 
> but note that would mean lot of namespace
> pollution for c++ which always defines
> _GNU_SOURCE

I proposed a patch [4] to add a forward declaration of memset() in
sched.h which indeed fixes the build issue.

> > [1] https://github.com/boostorg/fiber/pull/142
> > [2] https://git.musl-libc.org/cgit/musl/tree/include/sched.h#n110
> > [3] http://man7.org/linux/man-pages/man3/memset.3.html
> > 

[4] http://www.openwall.com/lists/musl/2017/09/08/4

Jörg Krause


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

* Re: Missing include of <string.h> in sched.h?
  2017-09-08  7:46 Jörg Krause
  2017-09-08  8:49 ` Szabolcs Nagy
@ 2017-09-08  9:26 ` Jörg Krause
  1 sibling, 0 replies; 5+ messages in thread
From: Jörg Krause @ 2017-09-08  9:26 UTC (permalink / raw)
  To: musl

On Fri, 2017-09-08 at 09:46 +0200, Jörg Krause wrote:
> Hi,
> 
> latest Boost 1.65.1 fails to compile with a musl toolchain [1].
> 
> The issue is that Boost uses the `CPU_ZERO` macro which expands to
> `memset()` [2].
> 
> The Linux Programmer's Manual state that memset() is defined in
> string.h [3].
> 
> Therefore, shouldn't shed.h include string.h?
> 
> [1] https://github.com/boostorg/fiber/pull/142
> [2] https://git.musl-libc.org/cgit/musl/tree/include/sched.h#n110
> [3] http://man7.org/linux/man-pages/man3/memset.3.html

On second thought, the forward declaration for memset() is missing [4].
Note, that there is a forward declaration for memcpy(), but it is never
used in sched.h.

[4] https://github.com/boostorg/fiber/pull/142#issuecomment-328043778

Best regards,
Jörg Krause


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

* Re: Missing include of <string.h> in sched.h?
  2017-09-08  7:46 Jörg Krause
@ 2017-09-08  8:49 ` Szabolcs Nagy
  2017-09-08  9:44   ` Jörg Krause
  2017-09-08  9:26 ` Jörg Krause
  1 sibling, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2017-09-08  8:49 UTC (permalink / raw)
  To: musl

* Jörg Krause <joerg.krause@embedded.rocks> [2017-09-08 09:46:56 +0200]:
> latest Boost 1.65.1 fails to compile with a musl toolchain [1].
> 
> The issue is that Boost uses the `CPU_ZERO` macro which expands to
> `memset()` [2].
> 
> The Linux Programmer's Manual state that memset() is defined in
> string.h [3].
> 
> Therefore, shouldn't shed.h include string.h?
> 

it should probably include string.h and
stdlib.h under _GNU_SOURCE

but note that would mean lot of namespace
pollution for c++ which always defines
_GNU_SOURCE

> [1] https://github.com/boostorg/fiber/pull/142
> [2] https://git.musl-libc.org/cgit/musl/tree/include/sched.h#n110
> [3] http://man7.org/linux/man-pages/man3/memset.3.html
> 
> Best regards,
> Jörg Krause


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

* Missing include of <string.h> in sched.h?
@ 2017-09-08  7:46 Jörg Krause
  2017-09-08  8:49 ` Szabolcs Nagy
  2017-09-08  9:26 ` Jörg Krause
  0 siblings, 2 replies; 5+ messages in thread
From: Jörg Krause @ 2017-09-08  7:46 UTC (permalink / raw)
  To: musl

Hi,

latest Boost 1.65.1 fails to compile with a musl toolchain [1].

The issue is that Boost uses the `CPU_ZERO` macro which expands to
`memset()` [2].

The Linux Programmer's Manual state that memset() is defined in
string.h [3].

Therefore, shouldn't shed.h include string.h?

[1] https://github.com/boostorg/fiber/pull/142
[2] https://git.musl-libc.org/cgit/musl/tree/include/sched.h#n110
[3] http://man7.org/linux/man-pages/man3/memset.3.html

Best regards,
Jörg Krause


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

end of thread, other threads:[~2017-09-08  9:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-08  7:43 Missing include of <string.h> in sched.h? Jörg Krause
2017-09-08  7:46 Jörg Krause
2017-09-08  8:49 ` Szabolcs Nagy
2017-09-08  9:44   ` Jörg Krause
2017-09-08  9:26 ` Jörg Krause

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