Opened 10 years ago

Closed 10 years ago

#7070 closed Bugs (fixed)

bcp misses some cases and does not create namespace aliases for non-boost namespaces

Reported by: Mike Liang <mtliang@…> Owned by: John Maddock
Milestone: To Be Determined Component: bcp
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Running all Boost 1.48.0 regressions and comparing between original and bcp'd code shows extra compile errors addressed by the enclosed patch.

Also, the namespace alias option only creates aliases for the boost namespace but omits the top level phoenix namespace. This patch includes adstl and rapidxml even though they don't appear to be affected. The patch also preserves whitespace, which was blindly replaced by spaces in the original code.

Attachments (1)

copy_path.cpp.patch (2.0 KB ) - added by Mike Liang <mtliang@…> 10 years ago.

Download all attachments as: .zip

Change History (7)

by Mike Liang <mtliang@…>, 10 years ago

Attachment: copy_path.cpp.patch added

comment:1 by lukester_null@…, 10 years ago

I hope I'm not thread jacking but I'd just like to say this is great - fixes something I was just about to create a ticket for. It was converting:

namespace boost{ namespace phoenix

->

namespace MyBoost { namespace MyBoostphoenix

But missing things like:

BOOST_PHOENIX_DEFINE_EXPRESSION(
    (boost)(phoenix)(do_while)

which ended up as

    (MyBoost)(phoenix)(do_while)

which your patch makes (MyBoost)(MyBoostphoenix)(do_while)

I'm not sure I understand why it prefixes the new top-level namespace on the phoenix namespace at all, though I guess it's intentional?

Regards

Luke.

comment:2 by Mike Liang <mtliang@…>, 10 years ago

I wondered that too until I found the header files under boost/spirit/home/classic/phoenix .

comment:3 by lukester_null@…, 10 years ago

Ah right, so the classic phoenix namespace gets renamed because it's not nested inside the boost namespace to avoid any potential clashes, and the new phoenix(es) namespace which are nested in boost get caught in the crossfire... or something.

If so, I wonder if that was the desired effect? Most of the new boost::phoenix namespace declarations I've seen are all on one line so it's presumably possible to catch them.

comment:4 by Mike Liang <mtliang@…>, 10 years ago

I can see why each namespace declaration is renamed independently of any others, since extra code can show up before the embedded phoenix namespace declaration, and so you don't want to write more complicated patterns in an attempt to catch this situation. This then leads to the forced rename of the embedded phoenix namespace during namespace resolution.

In any case, the patch to catch the other renamed namespaces should make this annoyance go away.

comment:5 by John Maddock, 10 years ago

Thanks for the patch, currently testing it out.

comment:6 by John Maddock, 10 years ago

Resolution: fixed
Status: newclosed

(In [79403]) Apply patch from #7070 to fix namespace renaming. Fixes #7070.

Note: See TracTickets for help on using tickets.