Gentoo Archives: gentoo-musl

From: Lei Zhang <zhanglei.april@×××××.com>
To: Luca Barbato <lu_zero@g.o>
Cc: gentoo-musl@l.g.o
Subject: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++
Date: Wed, 22 Jun 2016 13:22:02
Message-Id: CAOYuCc1UFS+DetusxwgU0Sxz7J=5vgpkQ7N94t0ULW9a_XW26A@mail.gmail.com
In Reply to: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++ by Lei Zhang
1 2016-06-21 12:54 GMT+08:00 Lei Zhang <zhanglei.april@×××××.com>:
2 > 2016-06-17 20:44 GMT+08:00 Lei Zhang <zhanglei.april@×××××.com>:
3 >> After putting about eight "#define _GNU_SOURCE"s in various *.cpp
4 >> files, it seems to work now :)
5 >
6 > I was wrong; it doesn't work... I still can't figure out a good solution :(
7 >
8 > Take glibc's strtoll_l for example: it's hidden by _GNU_SOURCE in
9 > stdlib.h and used exclusively by libc++'s header <locale>; but
10 > defining _GNU_SOURCE in <locale> could be too late, since stdlib.h
11 > might be included prior to <locale>.
12 >
13 > Though glibc's stdlib.h is only explicitly included in <cstdlib>,
14 > defining _GNU_SOURCE in <cstdlib> doesn't work either. It turns out
15 > strtoll_l (and others) is not directly protected by _GNU_SOURCE, but
16 > by __USE_GNU, which is in turn defined in features.h according to
17 > _GNU_SOURCE. That means "#define _GNU_SOURCE" must appear before the
18 > inclusion of features.h, and it's not very clear where "#undef
19 > _GNU_SOURCE" should be put.
20 >
21 > Any suggestions?
22
23 The only feasible solution I can think of is to wrap every inclusion of C header