Date: Mon, 17 Feb 2014 19:04:31 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Julio Merino <jmmv@outlook.com> Cc: Garrett Cooper <yanegomi@gmail.com>, freebsd-testing@FreeBSD.org, David Chisnall <theraven@FreeBSD.org> Subject: Re: Compile error with gcc Message-ID: <EB8398A1-4FF4-4DA4-9B8B-FF4D27A7E9A6@FreeBSD.org> In-Reply-To: <BLU0-SMTP3338CC4EB901473B7FC4A23C0990@phx.gbl> References: <695E42A3-2009-4DD7-B10E-BF8465C89D39@gmail.com> <A8EF2DCC-5F11-4405-88D1-05A193AB7BAF@gmail.com> <D10C2EBB-36EC-4292-A944-4356EA5657F2@FreeBSD.org> <BLU0-SMTP284F6428835416F4D9E3727C09E0@phx.gbl> <849648F5-7834-45DD-8BDF-6385BF4F82DB@FreeBSD.org> <BLU0-SMTP35FABDADF1BB4D66F59E02C09E0@phx.gbl> <2281FB5D-2BF0-4763-AC24-67EC3864D39B@gmail.com> <BLU0-SMTP3338CC4EB901473B7FC4A23C0990@phx.gbl>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_E7E9F002-0DC8-4E3E-8CE6-67C871F511D2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On 17 Feb 2014, at 14:55, Julio Merino <jmmv@outlook.com> wrote: ... > I'm not sure it's going to work. I think Dimitry mentioned that our = libstdc++ should already provide std::vsnprintf, but due to the flags = it's built with, it doesn't. I'm not sure if, due to this, the version = check above would do the right thing. Our libstdc++ config.h is configured that way, because if you run its = configure script, it notices that a few long double maths functions are = missing. Then it disables *all* C99 support in libstdc++, including all = the stuff we do have, like vsnprintf(). I'm not sure what would be broken if we overrode its automatic = detection, and forced libstdc++ to expose C99 functions. Maybe some = other programs would then complain about missing math functions... >> etc, and if so, what c++ standard was vsnprintf incorporated into? It = looks like <some-date> should be 201103L (c++11) = (http://en.cppreference.com/w/cpp/io/c/vfprintf ). If so, then the = configure.ac tests should instead set the appropriate -std variable (or = setting), then test for c++=92s existence. >=20 > The point of tests in configure.ac scripts is to _not_ do the above = style of checks. If you are going to use those, then you don't need = configure because you can stick those into the code: configure should be = checking what the compiler actually does, not what it claims to support. = This way the checks are future-proof and are going to work even for = compilers you have not tried yet. >=20 > Note that the check in configure.ac is working just fine and that's = not the problem. The problem is in FreeBSD, where we have a single = bconfig.h for the two compilers and the two compilers behave differently = in at least one of the detected settings. It's not the compilers that behave differently, it is the C++ standard = library. If you compile with clang, but use -stdlib=3Dlibstdc++, you = will encounter the same issue, e.g. std::vsnprintf() will not be = available. > So... we could generate two bconfig.h files, one for each compiler, = and use them accordingly... or we could try to eliminate the divergence = altogether. To do the latter, I think it's enough to remove the = conditional and leave the code doing: >=20 > namespace std { > using ::vsnprintf; > } >=20 > in all cases. It works in clang but I don't know what the standard = has to say in this regard! You would simply be using the non-std version of vsnprintf(). I don't = think this should cause any trouble. Having said all this, I guess it would be simpler to just patch up our = libstdc++ to expose the functions we do have for C99, and not care about = what its configure script outputs. -Dimitry --Apple-Mail=_E7E9F002-0DC8-4E3E-8CE6-67C871F511D2 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iEYEARECAAYFAlMCTzsACgkQsF6jCi4glqMlogCgy7NanLOdqiErh9XUYNeXtFd4 x/cAoIr9KGAXJ9Ig000iVjKUeozbIqtF =bwVo -----END PGP SIGNATURE----- --Apple-Mail=_E7E9F002-0DC8-4E3E-8CE6-67C871F511D2--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EB8398A1-4FF4-4DA4-9B8B-FF4D27A7E9A6>