1704 [any] 4512 warning from VC8/9 on warning level 4

Hi, I'm wondering if we care about level 4 MSVC warnings. As far as I remember default warning level is lower and I don't see why boost sources should have MSVC-specific pragmas just to disable level 4 warnings. I'd rather resolved the bug as invalid. As an alternative, we could // Beginning of file #include <boost/config/warnings_off.hpp> ... // end of file #include <boost/config/warnings_on.hpp> and have an option BOOST_CONFIG_TURN_WARNINGS_OFF. Though, I don't know whether it's doable for other compilers. -- Alexander

Alexander Nasonov <alnsn <at> yandex.ru> writes:
Hi, I'm wondering if we care about level 4 MSVC warnings. As far as I remember default warning level is lower and I don't see why boost sources should have MSVC-specific pragmas just to disable level 4 warnings.
The default is level 3. I build at level 4 though, and the large numbers of warnings are annoying.
I'd rather resolved the bug as invalid. As an alternative, we could
// Beginning of file #include <boost/config/warnings_off.hpp> ... // end of file #include <boost/config/warnings_on.hpp>
and have an option BOOST_CONFIG_TURN_WARNINGS_OFF.
That's been suggested a couple of times before (e.g. http://article.gmane.org/gmane.comp.lib.boost.devel/168903). There's a lack of consensus about how (or if) these sort of warnings should be handled though. Thanks, Richard Webb

Alexander Nasonov wrote:
I'm wondering if we care about level 4 MSVC warnings. I certainly do. I always try to use level 4 (with some of the less useful warnings pragma'd off globally), and find any library that doesn't compile warning free intensly annoying. (Some legacy software has to be compiled at level 3, because it generates too many warnings itself). -- Martin Bonner

________________________________ From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Martin Bonner Sent: 25 March 2008 17:06 To: boost@lists.boost.org Subject: Re: [boost] 1704 [any] 4512 warning from VC8/9 on warning level 4 Alexander Nasonov wrote: > I'm wondering if we care about level 4 MSVC warnings. I certainly do. I always try to use level 4 (with some of the less useful warnings pragma'd off globally), and find any library that doesn't compile warning free intensly annoying. (Some legacy software has to be compiled at level 3, because it generates too many warnings itself). Agree very strongly. Any remaining warnings should be supressed by pragma push'n'pop. An important function of this process is to document that this warning has been noted, heeded, and assessed as being OK. And to stop the immensely annoying blizzard of warnings that confuse, and indeed alarm, new users who reasonably expect Boost code to compile warning free. So I am strongly in favor of continuing to try to quiet warnings. IMO, it really isn't that much trouble. Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com

FWIW, yes, I also build my applications at MSVC warning level 4. But in this particular case, I don't think that this specific warning needs to be pragma'd off! The warning reported by ticket #1704 says: "boost/any.hpp(130) : warning C4512: 'boost::any::holder<ValueType>' : assignment operator could not be generated" <http://svn.boost.org/trac/boost/ticket/1704> Wouldn't it be preferable to explicitly disallow the assignment of any::holder? Just by adding a private and unimplemented copy assignment operator? When doing so, we'll get rid of the warning automatically. I don't think any::holder needs to be CopyAssignable. any::holder is only accessible by boost::any, and its friends unsafe_any_cast, and unsafe_any_cast. Neither of them uses the assignment of any::holder. Kind regards, Niels -- Niels Dekker http://www.xs4all.nl/~nd/dekkerware Scientific programmer at LKEB, Leiden University Medical Center

(Sorry, Outlook webmail forces crappy indendation) ________________________________ From: boost-bounces@lists.boost.org on behalf of Niels Dekker - mail address until 2008-12-31 Sent: Tue 25/03/2008 20:44 To: boost@lists.boost.org Subject: Re: [boost] 1704 [any] 4512 warning from VC8/9 on warning level 4 FWIW, yes, I also build my applications at MSVC warning level 4. But in this particular case, I don't think that this specific warning needs to be pragma'd off! The warning reported by ticket #1704 says: "boost/any.hpp(130) : warning C4512: 'boost::any::holder<ValueType>' : assignment operator could not be generated" <http://svn.boost.org/trac/boost/ticket/1704> MJB>> This is one of the warning that I tend to pragma off globally. Wouldn't it be preferable to explicitly disallow the assignment of any::holder? MJB>> I bet it already is Just by adding a private and unimplemented copy assignment operator? When doing so, we'll get rid of the warning automatically. MJB>> But that's not the way to explicitly disallow assignment. Instead you derive from boost::non_copyable (sp?). And that causes the warning -- Martin Bonner

Niels Dekker - mail address until 2008-12-31 <nd_mail_address_valid_until_2008-12-31 <at> xs4all.nl> writes:
Wouldn't it be preferable to explicitly disallow the assignment of any::holder?
This makes sense. Can you please attach a patch on the bug page as I don't MSVC at the moment to make the patch myself. PS: I don't know if this patch can be approved for 1.35. -- Alexander

Wouldn't it be preferable to explicitly disallow the assignment of any::holder?
Alexander Nasonov replied:
This makes sense. Can you please attach a patch on the bug page as I don't MSVC at the moment to make the patch myself.
Done! (And added a short note to the ticket as well.)
PS: I don't know if this patch can be approved for 1.35.
But I guess it can still be patched onto the trunk...
Just by adding a private and unimplemented copy assignment operator? [...]
Martin Bonner wrote:
MJB>> But that's not the way to explicitly disallow assignment.
Surely it is a proper way to do so! Albeit the "traditional way" :-) http://www.boost.org/libs/utility/utility.htm#Class_noncopyable
MJB>> Instead you derive from boost::non_copyable (sp?).
It appears that for MSVC 2008 and MSVC 2005, the issue could indeed be solved by deriving boost::any::placeholder from boost::noncopyable. Unfortunately this wouldn't stop MSVC 2003 from complaining, "assignment operator could not be generated". (And yes, I still use MSVC 2003!) Kind regards, Niels
participants (5)
-
Alexander Nasonov
-
Martin Bonner
-
Niels Dekker - mail address until 2008-12-31
-
Paul A Bristow
-
Richard Webb