From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-musl+bounces-120-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 10F401382B5
	for <garchives@archives.gentoo.org>; Wed, 15 Jun 2016 01:45:25 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 39912E0903;
	Wed, 15 Jun 2016 01:45:21 +0000 (UTC)
Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C931EE0903
	for <gentoo-musl@lists.gentoo.org>; Wed, 15 Jun 2016 01:45:20 +0000 (UTC)
Received: by mail-oi0-f67.google.com with SMTP id u201so1380004oie.2
        for <gentoo-musl@lists.gentoo.org>; Tue, 14 Jun 2016 18:45:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc;
        bh=ldAy6XvTNqMy3+oK7bpJplWLGEl0s8iEvY9wX+z7urk=;
        b=MtimsZVKbMVGbPzzc90fT0e3h/9GfOCT69SBFwJs2/pKj7AUhC79ZieQsg2gJ5QIcM
         1H3YgZ6F4rU1pTrv14WRH0HlbnPwoTxntnYqxRTS/RTbBG/jgugF9Uc0Lgo412PwSExU
         /myjXxW66kEVfk+BPHJX7yTrwxokOPaxw6OcVmQLwgiOZw3cIsiL5CbicWVOkEBH7yFD
         u6aUA900gNM3l9Yl0Fk9N3sVGH1W6y+tK8VYIcbxx3sD7wg9QEtyrWzEA9oTP08JDAlJ
         oGo5GtJGlt6O3zpvjaczNQJ/vjsdLw+ckW77ESNi/vAbKcqX/zgj8T7YY2Re2ZhwI85I
         mWLQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc;
        bh=ldAy6XvTNqMy3+oK7bpJplWLGEl0s8iEvY9wX+z7urk=;
        b=ZMEXShZUADunaDP4mbxduNZmAgkrs45Tm4Xd+37LjSE1lk69AUjnVWwG6dHFUQHC9o
         0Ny9kU/qdrXZEDQbt2sgJ/0h7wSaw2pVQKLgno/R7aUH7t8o0pS2Sc/AAlFDYXPDobX7
         hg6OnkH9MNkHfvJOM0hsuum2p3Up9PaprhIAOzN5nL2mdzo2Pe8Y1eZXHC1eBeQ5n2zt
         jjItFilq07to3YHrhZ+mRO51Q9rlb4HpB0Fo8DX/1UCeiJhvMUWNCyQiJ4zIJIjcgoYr
         zUpwN94wdbvPMaGRDT7hTwNc3/nOPMeejTmBecIjByvaICKySGARdsBpw5AZQFIiviKu
         DHVg==
X-Gm-Message-State: ALyK8tI9srlvFiaMeav8XE0BcbTuMLvG9iVYkbwUvyk5UT3rAfH9550bjbREMlQ0RvNEKW7DQUDPdvAR9Ux0Cw==
X-Received: by 10.202.219.86 with SMTP id s83mr12408584oig.167.1465955119981;
 Tue, 14 Jun 2016 18:45:19 -0700 (PDT)
Precedence: bulk
List-Post: <mailto:gentoo-musl@lists.gentoo.org>
List-Help: <mailto:gentoo-musl+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-musl+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-musl+subscribe@lists.gentoo.org>
List-Id: Gentoo musl list <gentoo-musl.gentoo.org>
X-BeenThere: gentoo-musl@gentoo.org
X-BeenThere: gentoo-musl@lists.gentoo.org
MIME-Version: 1.0
Received: by 10.202.63.212 with HTTP; Tue, 14 Jun 2016 18:45:19 -0700 (PDT)
In-Reply-To: <e1f362ee-7755-9a54-78e3-19e0733ebd3b@gentoo.org>
References: <CAOYuCc2iavSmy2Pqy5pv8TOxguSYNMPk7wZCG10_9QghfK6TSA@mail.gmail.com>
 <20160614081043.GA364@nyan> <CAOYuCc1zBZDNJhgXSG0ehaasJ6t5GhuaFHPbrKdvx7Ft11=LAw@mail.gmail.com>
 <4228046b-02f1-1b65-f56d-6e79347e4390@gentoo.org> <CAOYuCc2b2v2wBLGjBzkGRNdKe1gV8uSqnCLFxnxyodZuQ9Ym5g@mail.gmail.com>
 <20302d1d-92ff-1c4b-8939-08894c3589ca@gentoo.org> <CAOYuCc1JqdQg3eshzPvTYjo-8jHP0Z_NW+e6P2G2OT5gyQGW1w@mail.gmail.com>
 <8e7cafd9-97c7-6ca1-ad3f-95bdb0060ce0@gentoo.org> <CAOYuCc1_-vV3pXmsxmuC+9y2TDTGdi3S7NU=mAJ3SkU4z2Y_Aw@mail.gmail.com>
 <e1f362ee-7755-9a54-78e3-19e0733ebd3b@gentoo.org>
From: Lei Zhang <zhanglei.april@gmail.com>
Date: Wed, 15 Jun 2016 09:45:19 +0800
Message-ID: <CAOYuCc3ZyA0SS1EUpVMGYmNrTUSX3k69d4Jz7dz2iYW1fQkF_A@mail.gmail.com>
Subject: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++
To: Luca Barbato <lu_zero@gentoo.org>
Cc: gentoo-musl@lists.gentoo.org
Content-Type: text/plain; charset=UTF-8
X-Archives-Salt: da2d873c-a5d4-4497-b1bd-c977d9ee6550
X-Archives-Hash: 855ce19bb5b41a104e4e7c6c6f9d0f73

This issue is probably not as simple as I thought. Supposing C++
header iostream depends on some non-standard functions from stdio.h,
it may look like:

// iostream
#define _BSD_SOURCE
#include <stdio.h>
#undef _BSD_SOURCE
...

But if a user writes some code like:

// user code
#include <stdio.h>
#include <iostream> // stdio.h already expanded before this point
...

then iostream never has the chance to get those non-standard symbols,
*unless* the compiler predefines _BSD_SOURCE for it. So simply
patching libc++/libstdc++ doesn't work; you have to carefully choose
which visibility macros to predefine in the compiler. And predefining
_GNU_SOURCE is just the safest bet.

I don't see any easy fix for this at the moment :(


Lei

2016-06-14 20:03 GMT+08:00 Luca Barbato <lu_zero@gentoo.org>:
> On 14/06/16 13:48, Lei Zhang wrote:
>> 2016-06-14 19:18 GMT+08:00 Luca Barbato <lu_zero@gentoo.org>:
>>> On 14/06/16 11:35, Lei Zhang wrote:
>>>> I agree. It seems libstdc++ is also taking the lazy route, and someone
>>>> intended to fix it:
>>>>
>>>> https://lwn.net/Articles/590504/
>>>>
>>>> but I see no progress so far.
>>>>
>>>
>>> make -k and let's try to extract the list of missing symbols from it.
>>
>> A quick test with libc++:
>>
>> aligned_alloc
>
> aligned_alloc(): _ISOC11_SOURCE
>
>> atoll
>
> atoll():
>            _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
> _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
>
>> _Exit
>
> _Exit():
>            _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE >=
> 200112L;
>
>> fwide
>
> fwide():
>            _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE ||
>            _POSIX_C_SOURCE >= 200112L;
>
> etc etc etc
>
> try to figure out which defines correctly enable those and send patches
> to be precise =)
>
> lu
>
>
>