From owner-freebsd-toolchain@FreeBSD.ORG Sat Nov 24 07:18:15 2012 Return-Path: Delivered-To: toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 790CAF20; Sat, 24 Nov 2012 07:18:15 +0000 (UTC) (envelope-from yamayan@kbh.biglobe.ne.jp) Received: from rcpt-expgw.biglobe.ne.jp (rcpt-expgw.biglobe.ne.jp [IPv6:2001:260:401:16::4]) by mx1.freebsd.org (Postfix) with ESMTP id 66F9A8FC08; Sat, 24 Nov 2012 07:18:14 +0000 (UTC) Received: from vc-gw.biglobe.ne.jp by rcpt-expgw.biglobe.ne.jp (shby/5910021009) with SMTP id qAO7ICHK032615; Sat, 24 Nov 2012 16:18:12 +0900 Received: from smtp-gw.biglobe.ne.jp ([172.21.175.156]) by vc-gw.biglobe.ne.jp (kbkr/0716090908) with ESMTP id qAO7IC3K018560; Sat, 24 Nov 2012 16:18:12 +0900 X-Biglobe-Sender: Received: from [192.168.0.100] (KD027083060020.ppp-bb.dion.ne.jp [27.83.60.20]) by smtp-gw.biglobe.ne.jp id QABZAC15AFDC; Sat, 24 Nov 2012 16:18:12 +0900 (JST) Message-ID: <50B074C9.6060402@kbh.biglobe.ne.jp> Date: Sat, 24 Nov 2012 16:18:33 +0900 From: Yamaya Takashi User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Dimitry Andric Subject: Re: [patch][libc++]using some undeclared functions with -std=c++98, -std=c++03 or -ansi References: <50AEB0A1.3090803@kbh.biglobe.ne.jp> <50AFEA5D.2020607@FreeBSD.org> In-Reply-To: <50AFEA5D.2020607@FreeBSD.org> Content-Type: multipart/mixed; boundary="------------070908090902020303000109" Cc: toolchain@freebsd.org X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 07:18:15 -0000 This is a multi-part message in MIME format. --------------070908090902020303000109 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 2012/11/24 06:27, Dimitry Andric wrote: > On 2012-11-23 00:09, Yamaya Takashi wrote: >> With -std=c++98, -std=c++03 or -ansi, __LONG_LONG_SUPPORTED is not >> defined. >> So some functions((lldiv_t, )atoll, strtoll, strtoull, llabs, lldiv, >> wcstoll, wcstoull) are undeclared. >> But libc++ headers(cstdlib and cwchar) use them. > > The general idea of your patch is good, but we need to check it with > upstream first. For example, __LONG_LONG_SUPPORTED is a FreeBSD > specific define, so for the general case the solution might be more > complicated. > __LONG_LONG_SUPPORTED is controlled by __STRICT_ANSI__ and __cplusplus in sys/cdefs.h. defined(__LONG_LONG_SUPPORTED) is equal to !defined(__STRICT_ANSI__) || __cplusplus >= 201103L with clang++. > Note there are also other problems when compiling libc++ with -std=c++98 > and -std=c++03, such as complaints about namespacing and such. I am not > entirely sure libc++ is fully supported yet under those restrictions. :) > What are complaints about namespacing? --------------070908090902020303000109 Content-Type: text/plain; charset=UTF-8; name="libcxx.patch.20121124" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libcxx.patch.20121124" Index: contrib/libc++/include/cstdlib =================================================================== --- contrib/libc++/include/cstdlib (revision 243468) +++ contrib/libc++/include/cstdlib (working copy) @@ -97,18 +97,26 @@ using ::size_t; using ::div_t; using ::ldiv_t; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::lldiv_t; +#endif using ::atof; using ::atoi; using ::atol; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::atoll; +#endif using ::strtod; using ::strtof; using ::strtold; using ::strtol; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::strtoll; +#endif using ::strtoul; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::strtoull; +#endif using ::rand; using ::srand; using ::calloc; @@ -125,10 +133,14 @@ using ::qsort; using ::abs; using ::labs; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::llabs; +#endif using ::div; using ::ldiv; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::lldiv; +#endif using ::mblen; using ::mbtowc; using ::wctomb; @@ -145,10 +157,14 @@ // MSVC already has the correct prototype in #ifdef __cplusplus #if !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} +#endif inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} +#endif #endif // _MSC_VER _LIBCPP_END_NAMESPACE_STD Index: contrib/libc++/include/cwchar =================================================================== --- contrib/libc++/include/cwchar (revision 243468) +++ contrib/libc++/include/cwchar (working copy) @@ -151,9 +151,13 @@ using ::wcstold; #endif // _MSC_VER using ::wcstol; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::wcstoll; +#endif using ::wcstoul; +#if !defined(__STRICT_ANSI__) || __cplusplus >= 201103L using ::wcstoull; +#endif using ::wcscpy; using ::wcsncpy; using ::wcscat; --------------070908090902020303000109--