Opened 11 years ago

Closed 11 years ago

#6029 closed Bugs (fixed)

Boost.Regex incompatible with G++'s Profile features

Reported by: Akim Demaille <akim.demaille@…> Owned by: Daniel James
Milestone: To Be Determined Component: None
Version: Boost 1.47.0 Severity: Problem
Keywords: profile g++ Cc:

Description

Using a recent G++ (say 4.6), it is possible to enable libstc++ features to profile the use of STL features (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/profile_mode.html). Boost.Regex (and maybe other libraries, I don't know yet) is not compilable with it:

$ g++-mp-4.6 -c -Wall /opt/local/include/boost/regex.hpp -o /tmp/f.o

$ g++-mp-4.6 -c -D_GLIBCXX_PROFILE -Wall /opt/local/include/boost/regex.hpp -o /tmp/f.o |& sed 20q
In file included from /opt/local/include/boost/functional/hash/hash.hpp:535:0,
                 from /opt/local/include/boost/functional/hash.hpp:6,
                 from /opt/local/include/boost/regex/v4/basic_regex.hpp:23,
                 from /opt/local/include/boost/regex/v4/regex.hpp:67,
                 from /opt/local/include/boost/regex.hpp:31:
/opt/local/include/boost/functional/hash/extensions.hpp:36:33: error: template declaration of 'std::size_t boost::hash_value'
/opt/local/include/boost/functional/hash/extensions.hpp:36:28: error: reference to 'vector' is ambiguous
/opt/local/include/boost/detail/container_fwd.hpp:87:47: error: candidates are: template<class T, class Allocator> struct std::vector
/opt/local/include/gcc46/c++/profile/vector:48:11: error:                 template<class _Tp, class _Allocator> class std::__profile::vector
/opt/local/include/boost/functional/hash/extensions.hpp:36:41: error: expected primary-expression before ',' token
/opt/local/include/boost/functional/hash/extensions.hpp:36:44: error: expected primary-expression before '>' token
/opt/local/include/boost/functional/hash/extensions.hpp:36:46: error: expected primary-expression before 'const'
/opt/local/include/boost/functional/hash/extensions.hpp:38:33: error: template declaration of 'std::size_t boost::hash_value'
/opt/local/include/boost/functional/hash/extensions.hpp:38:28: error: reference to 'list' is ambiguous
/opt/local/include/boost/detail/container_fwd.hpp:86:47: error: candidates are: template<class T, class Allocator> struct std::list
/opt/local/include/gcc46/c++/profile/list:42:11: error:                 template<class _Tp, class _Allocator> class std::__profile::list
/opt/local/include/boost/functional/hash/extensions.hpp:38:39: error: expected primary-expression before ',' token
/opt/local/include/boost/functional/hash/extensions.hpp:38:42: error: expected primary-expression before '>' token
/opt/local/include/boost/functional/hash/extensions.hpp:38:44: error: expected primary-expression before 'const'
/opt/local/include/boost/functional/hash/extensions.hpp:46:33: error: template declaration of 'std::size_t boost::hash_value'

Change History (5)

comment:1 by John Maddock, 11 years ago

Component: regexhash
Owner: changed from John Maddock to Daniel James

Reassigning: this is a Boost.Hash issue.

comment:2 by Akim Demaille <akim.demaille@…>, 11 years ago

FWIW, what was recommended here: http://lists.boost.org/Archives/boost/2010/05/167108.php (the diff is backwards) does fix the issue for me:

--- /tmp/container_fwd.hpp	2011-10-17 14:21:46.000000000 +0200
+++ /opt/local/include/boost/detail/container_fwd.hpp	2011-10-17 14:23:02.000000000 +0200
@@ -15,7 +15,9 @@
 
 #if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \
     || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \
-        && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \
+        && (defined(_GLIBCXX_DEBUG) \
+	    || defined(_GLIBCXX_PARALLEL) \
+            || defined(_GLIBCXX_PROFILE))) \
     || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
     || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
     || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) \

I have other issues (with boost/tr1/type_traits.hpp colliding tr1/type_traits), but that should probably be another ticket.

comment:3 by Daniel James, 11 years ago

(In [75016]) Detail: Don't forward declare containers for gcc in profile mode. Refs #6029.

Also a big clear comment about BOOST_DETAIL_NO_CONTAINER_FWD and a fixed typo.

comment:4 by Daniel James, 11 years ago

Component: hashNone
Status: newassigned

Sorry, I didn't notice that the patch in that mail had an extra macro. If possible, can you check that trunk now works for you?

comment:5 by anonymous, 11 years ago

Resolution: fixed
Status: assignedclosed

I think this was fixed in [75293].

Note: See TracTickets for help on using tickets.