Opened 10 years ago

Closed 10 years ago

#6854 closed Bugs (fixed)

boost/random/detail/integer_log2.hpp:71:35: warning: always_inline function might not be inlinable

Reported by: peter@… Owned by: No-Maintainer
Milestone: To Be Determined Component: random
Version: Boost 1.53.0 Severity: Regression
Keywords: Cc: mika.fischer@…

Description

When compiled with GCC 4.7.0, boost/random/detail/integer_log2.hpp triggers a warning:

#include <boost/random/mersenne_twister.hpp>

int main() { return 0; }
In file included from boost_1_49_0/include/boost/random/detail/large_arithmetic.hpp:19:0,
                 from boost_1_49_0/include/boost/random/detail/const_mod.hpp:23,
                 from boost_1_49_0/include/boost/random/detail/seed_impl.hpp:27,
                 from boost_1_49_0/include/boost/random/mersenne_twister.hpp:29,
                 from /tmp/always_inline.cpp:1:
boost_1_49_0/include/boost/random/detail/integer_log2.hpp:71:35: warning: always_inline function might not be inlinable [-Wattributes]

This warning is due to the missing inline keyword:

--- boost_1_49_0.orig/boost/random/detail/integer_log2.hpp
+++ boost_1_49_0/boost/random/detail/integer_log2.hpp
@@ -27,7 +27,7 @@
 #elif defined(BOOST_MSVC)
 #define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline
 #elif defined(__GNUC__) && __GNUC__ >= 4
-#define BOOST_RANDOM_DETAIL_CONSTEXPR __attribute__((const)) __attribute__((always_inline))
+#define BOOST_RANDOM_DETAIL_CONSTEXPR inline __attribute__((const)) __attribute__((always_inline))
 #else
 #define BOOST_RANDOM_DETAIL_CONSTEXPR inline
 #endif

Change History (8)

comment:1 by Steven Watanabe, 10 years ago

Resolution: fixed
Status: newclosed

(In [78513]) Add missing inline. Fixes #6854.

comment:2 by Mika Fischer <mika.fischer@…>, 10 years ago

Cc: mika.fischer@… added

comment:3 by anonymous, 10 years ago

Why has this not landed in 1.50.0?

in reply to:  3 ; comment:4 by benjamin.mahler@…, 10 years ago

Replying to anonymous:

Why has this not landed in 1.50.0?

Does not appear to be in 1.51.0 either..

in reply to:  4 comment:5 by gromer@…, 10 years ago

Replying to benjamin.mahler@…:

Replying to anonymous:

Why has this not landed in 1.50.0?

Does not appear to be in 1.51.0 either..

Nor in 1.52.0. What gives?

comment:6 by anonymous, 10 years ago

Resolution: fixed
Severity: CosmeticRegression
Status: closedreopened
Version: Boost 1.49.0Boost 1.52.0

Indeed, still not fixed in 1.52, reopening this ticket.

Adding the suggested inline keyword to integer_log2.hpp fixes this.

/tmp/boost_1_52_0$ /usr/bin/g++-4.7 -I./ -Werror main.cpp               
In file included from ./boost/random/detail/large_arithmetic.hpp:19:0,
                 from ./boost/random/detail/const_mod.hpp:23,
                 from ./boost/random/detail/seed_impl.hpp:27,
                 from ./boost/random/mersenne_twister.hpp:29,
                 from main.cpp:1:
./boost/random/detail/integer_log2.hpp:71:35: error: always_inline function
might not be inlinable [-Werror=attributes]
cc1plus: all warnings being treated as errors

comment:7 by tdmackey@…, 10 years ago

Version: Boost 1.52.0Boost 1.53.0

This is still not fixed in 1.53.0 beta 1.

comment:8 by Marshall Clow, 10 years ago

Resolution: fixed
Status: reopenedclosed

(In [82609]) Merge bug fix to release; Fixes #6854

Note: See TracTickets for help on using tickets.