Opened 10 years ago

Closed 6 years ago

#7166 closed Bugs (fixed)

Phoenix unconditionally sets BOOST_PROTO_MAX_ARITY

Reported by: m.champlon@… Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:

Description

Hi,

The following :

#define BOOST_PROTO_MAX_ARITY 20
#include <boost/phoenix.hpp>

exhibits the following warning with msvc 2010 and boost 1.50 :

1>C:\dev\include\boost/phoenix/core/limits.hpp(19): warning C4005: 'BOOST_PROTO_MAX_ARITY' : macro redefinition

This is rather inconvenient for the user of several libraries. I suggest to modify limits.hpp to change :

#if defined(BOOST_PHOENIX_LIMIT)
#define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT

to :

 #if defined(BOOST_PHOENIX_LIMIT)
# if !defined( BOOST_PROTO_MAX_ARITY )
#  define BOOST_PROTO_MAX_ARITY BOOST_PHOENIX_LIMIT
# elif (BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_LIMIT)
#  error "BOOST_PROTO_MAX_ARITY is set too low"
# endif

or see the attached patch.

Thanks, MAT.

Attachments (2)

boost_phoenix_limits.hpp.patch (606 bytes ) - added by m.champlon@… 10 years ago.
boost_phoenix_7166.patch (1.2 KB ) - added by Mathieu Champlon <m.champlon@…> 9 years ago.

Download all attachments as: .zip

Change History (6)

by m.champlon@…, 10 years ago

comment:1 by Mathieu Champlon <m.champlon@…>, 9 years ago

I added a test case to verify that the following code fails to compile

#define BOOST_PROTO_MAX_ARITY 10
#define BOOST_PHOENIX_LIMIT 20
#include <boost/phoenix.hpp>

because in case BOOST_PROTO_MAX_ARITY has been previously defined (for instance by including another boost library) there isn't much that can be done but #error'ing to the user.

boost_phoenix_7166.patch includes both the test case and the fix already included in the previous patch.

Cheers,

MAT.

by Mathieu Champlon <m.champlon@…>, 9 years ago

Attachment: boost_phoenix_7166.patch added

comment:2 by Mathieu Champlon <m.champlon@…>, 9 years ago

I forgot to mention that this solution was also suggested in this thread : http://boost.2283326.n4.nabble.com/phoenix-not-playing-nice-with-other-libs-td3489758.html

comment:3 by John Fletcher <J.P.Fletcher@…>, 9 years ago

This patch and test are now released on develop for testing.

comment:4 by Kohei Takahashi, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.