Opened 12 years ago

Closed 12 years ago

#564 closed defect (fixed)

gcc complains about long long when compiling against Boost 1.40

Reported by: Peter Owned by: Peter
Priority: minor Milestone: yat 0.5.5
Component: build Version: 0.5.4
Keywords: Cc:

Description

I just upgraded to Boost 1.40 and I get these warnings:

In file included from /opt/local/include/boost/integer.hpp:20,
                 from /opt/local/include/boost/function/function_base.hpp:21,
                 from /opt/local/include/boost/function/detail/prologue.hpp:17,
                 from /opt/local/include/boost/function.hpp:24,
                 from /opt/local/include/boost/iterator/transform_iterator.hpp:10,
                 from ../../yat/utility/stl_utility.h:37,
                 from ConsensusInputRanker.cc:35:
/opt/local/include/boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
/opt/local/include/boost/integer_traits.hpp:164:77: warning: use of C99 long long integer constant
/opt/local/include/boost/integer_traits.hpp:170:70: warning: use of C99 long long integer constant

The same problem in trunk. The question is if we can do something about this (other than add -Wno-long-long) or if it is a bug in boost...

Change History (4)

comment:1 Changed 12 years ago by Peter

Owner: changed from Jari Häkkinen to Peter
Status: newassigned

It is the usage of ULLONG_MAX in integer_traits.hpp that causes the problem. The constant is defined in C header limits.h to the maximal number an unsigned long long int can hold. A bit surprising that they use that non-standard type here when they have put quite some effort into defining their own boost::ulong_long_type and even make that compile with gcc -pedantic. See this thread for example

http://lists.boost.org/Archives/boost/2004/08/70190.php

The only solution I can see is compiling with -Wno-long-long. I think we should add that flag and add it already in 0.5.5. Question: should we add it all the time or should we try to (con)figure out whether the boost header is problematic or not?

comment:2 in reply to:  1 ; Changed 12 years ago by Jari Häkkinen

Replying to peter:

Question: should we add it all the time or should we try to (con)figure out whether the boost header is problematic or not?

Is the problem expected to disappear with later boosts? I think we should test for it and only use the option when needed.

comment:3 in reply to:  2 Changed 12 years ago by Peter

Replying to jari:

Is the problem expected to disappear with later boosts?

Having searched the web I think the problem is likely to remain in future versions. The developer solved the issue partially a few years back (see thread above), but one of the core team member seemed to be reluctant to the issue, and asked what the problem is compiling with -Wno-long-long. Furthermore, long long will be included in the next standard so use of pedantic will sort of be outdated.

I think we should test for it and only use the option when needed.

Yes, I'm working on a test. I think one can use -Werror to make g++ barf rather than compile when long long is detected.

comment:4 Changed 12 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [2079]) fixes #564. Testing if boost is using long long. Testing to compile some code similar to the problematic one in and particuarly we include . The test is specific to GCC in the sense that -pedantic and -Werror are specific to GCC. In the case of using any other compiler the compilation test will still run and will likely run successfully. In any case the flags -pedantic -Werror and -Wno-long-long are added through YAT_CXX_ADD_FLAG, which implies the flags will only be added when the compiler supports it. I'm afraid the variable names (AM_CXXFLAGS) has changed in trunk, so the merge will need some massage.

Note: See TracTickets for help on using tickets.