Date: Mon, 17 Feb 2014 08:55:59 -0500 From: Julio Merino <jmmv@outlook.com> To: Garrett Cooper <yanegomi@gmail.com> Cc: freebsd-testing@FreeBSD.org, David Chisnall <theraven@FreeBSD.org>, Dimitry Andric <dim@FreeBSD.org> Subject: Re: Compile error with gcc Message-ID: <BLU0-SMTP3338CC4EB901473B7FC4A23C0990@phx.gbl> In-Reply-To: <2281FB5D-2BF0-4763-AC24-67EC3864D39B@gmail.com> 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>
index | next in thread | previous in thread | raw e-mail
On Feb 17, 2014, at 01:07 , Garrett Cooper <yanegomi@gmail.com> wrote: > > Thanks Dimitry for the input. > > Should this check be done with… > > #if defined(__cplusplus) && __cplusplus >= <some-date> 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. > 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++’s existence. 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. 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. 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: namespace std { using ::vsnprintf; } in all cases. It works in clang but I don't know what the standard has to say in this regard! (FYI: I fixed the immediate problem in HEAD by changing bconfig.h to #undef the setting -- just as we had been doing since the initial import of ATF.)help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BLU0-SMTP3338CC4EB901473B7FC4A23C0990>
