Boost logo

Boost Users :

Subject: Re: [Boost-users] [format] warning...warning...warning
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2017-03-23 19:51:26


On 2017-03-23 16:43, Steven Watanabe via Boost-users wrote:
> AMDG
>
> On 03/23/2017 02:45 AM, Arnaud RICHARD via Boost-users wrote:
>> Hello,
>> I'm a complete Boost newbie. I've been told very often that boost is
>> the way to go for serious C++ coding, and I was not surprised to see
>> such emphasis on the home page:
>> "We aim to establish "existing practice" and provide reference
>> implementations so that Boost libraries are suitable for eventual
>> standardization"
>>
>> So when I used the format library on my existing (non-trivial) project
>> and first compiled... I was very very surprised to get my neat
>> compilation console flooded with hundreds of warnings !
>>
>> I acknowledge I activate many many warnings:
>> CXXFLAGS+=-Wall -Wextra -Wcast-qual -Wctor-dtor-privacy
>> -Wdisabled-optimization \
>> -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs \
>> -Wnoexcept -Woverloaded-virtual -Wredundant-decls -Wshadow \
>> -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel
>> -Wstrict-overflow=5 \
>> -Wswitch-default -Wundef -Wunused
>>
>> The warnings were as trivial as (for example):
>> ../ext/boost/boost/type_traits/is_default_constructible.hpp:16:22:
>> warning: "BOOST_GCC_VERSION_WORKAROUND_GUARD" is not defined [-Wundef]
>> #if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
>>
>
> If you compile with higher-than-default warning settings,
> it's simplest to include Boost with -isystem instead of -I.
> - At high warning settings, most additional warnings are spurious.
> Fixing them is a lot of effort for little gain.
> - Every compiler warns about different issues. Just because
> the code compiles without warnings on one compiler doesn't
> mean that other compilers will be equally happy. There have
> even been cases in the past where compiler A warned if
> you did X, while compiler B warned if you /didn't/ do X.
> - Sometimes "fixing" spurious warnings can create new bugs.
>
> With that being said, I personally try to explicitly suppress
> (with #pragma's) any known warnings that I don't care about.

Hi,

in this specific case the warning is not a false positive, or useless,
at elast as far as i udnerstand it. BOOST_GCC_VERSION_WORKAROUND_GUARD
is really not defined anywhere in boost, so this #ifdef block will never
be used.
>
>> ../ext/boost/boost/format/parsing.hpp:435:67: warning: conversion to
>> 'std::vector<boost::io::detail::format_item<char,
>> std::char_traits<char>, std::allocator<char> >,
>> std::allocator<boost::io::detail::format_item<char,
>> std::char_traits<char>, std::allocator<char> > > >::size_type {aka
>> unsigned int}' from 'int' may change the sign of the result
>> [-Wsign-conversion]
>> string_type & piece = (cur_item==0) ? prefix_ :
>> items_[cur_item-1].appendix_;
>>
>> I understand they are only warning and the code is functionally
>> correct and standard-wise correct.
>> Personally when I face such false warnings in my code, I change the
>> code to remove the warning so that if a warning does make sense, I can
>> notice it.
>>
>> I thought a reference implementation would be written with such
>> policy.
>
> You really shouldn't expect even those who are pedantic about
> warnings to enable more than -Wall -Wextra.
>
>> There's no way I'm gonna read each of the hundreds of messages to
>> understand if it is a mistake in my source code or a "shortcut" in
>> boost library.
>>
>> So this is my first user experience. Not impressed at all. Boost will
>> not be my reference.
>>
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net