Opened 7 years ago

Last modified 5 years ago

#11552 assigned Feature Requests

Warning from chrono that could helpfully be suppressed

Reported by: Paul A. Bristow Owned by: viboes
Milestone: Boost 1.60.0 Component: ratio
Version: Boost 1.59.0 Severity: Cosmetic
Keywords: warning chrono Cc:

Description (last modified by viboes)

Boost.Chrono is emitting warnings with GCC (5.1.0) that cannot be suppressed even using the following cxxflags in the user jamfile

      <toolset>gcc:<cxxflags>-Wno-deprecated-declarations
      <toolset>gcc:<cxxflags>-Wno-long-long
      <toolset>gcc:<cxxflags>-ftrack-macro-expansion=0 # Suppress note: in expansion of macro

and they are repeated on every compilation which is quite annoying when reading the log file.

For example:

gcc.compile.c++ ..\..\..\bin.v2\libs\timer\build\gcc-mingw-5.1.0\debug\link-static\auto_timers_construction.o
In file included from C:/Program Files/mingw-w64/x86_64-5.1.0-win32-seh-rt_v4-rev0/mingw64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/stdint.h:9:0,
                 from ..\..\../boost/cstdint.hpp:60,
                 from ..\..\../boost/ratio/config.hpp:13,
                 from ..\..\../boost/ratio/ratio.hpp:35,
                 from ..\..\../boost/chrono/duration.hpp:41,
                 from ..\..\../boost/chrono/chrono.hpp:11,
                 from ..\..\../boost/timer/timer.hpp:14,
                 from ..\..\..\libs\timer\src\auto_timers_construction.cpp:23:
..\..\../boost/chrono/system_clocks.hpp:77:111: warning: use of C++11 long long integer constant [-Wlong-long]
 # define BOOST_SYSTEM_CLOCK_DURATION

boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> >
                                                                                                               ^
..\..\../boost/chrono/system_clocks.hpp:77:90: note: in expansion of macro 'BOOST_RATIO_INTMAX_C'
 # define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> >

and more...

It would be nice if the user would not see these (spurious?) warnings.

Change History (6)

comment:1 by viboes, 6 years ago

Description: modified (diff)

comment:2 by viboes, 6 years ago

Component: date_timeratio
Status: newassigned

comment:3 by viboes, 6 years ago

Please, could you check why INTMAX_C is not defined in your env. I'm using it as follows

#ifdef INTMAX_C
#define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a)
#else
#define BOOST_RATIO_INTMAX_C(a) a##LL
#endif

and I home that

#include <boost/cstdint.hpp>

will define it.

comment:4 by viboes, 6 years ago

Maybe I could define it conditionally to C++11 use.

comment:5 by Paul A. Bristow, 6 years ago

As I recall, I was just trying to build all the standard libraries using b2 in the normal way.

--toolset=gcc-510 address-model=64 architecture=x86 build-type=complete (I think)

boost/cstdint.hpp has been run, but the labrythine code within it makes my brain hurt, so I don't see where BOOST_RATIO_INTMAX_C is being called and how, but it is providing a bigger value than is expected?

Doubt if this helps but ...

comment:6 by viboes, 5 years ago

It is called from your trace

boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> >
Note: See TracTickets for help on using tickets.