Opened 13 years ago

Last modified 11 years ago

#4068 new Patches

Borland also needs private/public workaround in boost::exception

Reported by: niels_dekker Owned by: niels_dekker
Milestone: Boost 1.43.0 Component: exception
Version: Boost 1.42.0 Severity: Problem
Keywords: Cc:

Description

Borland/CodeGear currently won't compile boost::exception, because it cannot deal with the friend declarations of exception_detail::set_info, inside the boost::exception class definition. So please consider applying the attached patch. It leaves the data of boost::exception public, when __BORLANDC__<=0x621, just like you did for other compilers.

Note: I have no idea whether the workaround is still needed when __BORLANDC__>0x621. It's just that I only tested Embarcadero/CodeGear C++ 6.21. But older Borland versions certainly have the same problem. For example, http://www.boost.org/development/tests/trunk/output/siliconman-boost-bin-v2-libs-exception-test-all_hpp_test-test-borland-5-9-3-debug.html says:

..\libs\exception\test\all_hpp_test.cpp:
Error E2401 ..\boost/exception/exception.hpp 228: Invalid template argument list
Error E2401 ..\boost/exception/exception.hpp 231: Invalid template argument list
Error E2401 ..\boost/exception/exception.hpp 234: Invalid template argument list
Error E2401 ..\boost/exception/exception.hpp 237: Invalid template argument list
Error E2109 ..\boost/exception/exception.hpp 337: Not an allowed type
Error E2228 ..\boost/exception/exception.hpp 337: Too many error or warning messages
*** 6 errors in Compile ***

Attachments (1)

exception_for Borland.patch (613 bytes ) - added by niels_dekker 13 years ago.
private/public-patch for Borland/CodeGear, tested on CodeGear 2010. Update: now using BOOST_WORKAROUND.

Download all attachments as: .zip

Change History (18)

comment:1 by Emil Dotchevski, 13 years ago

Resolution: wontfix
Status: newclosed

Thanks for the patch however I am not applying it because most tests will fail on Borland anyway. The only tests that must pass on *all* compilers are the top 4 in the test matrix, numbered 1-4; these verify that Boost Exception is turned off on non-conformant compilers so that boost::throw_exception works.

I will provide support to anyone wanting to produce and support a Borland implementation of Boost Exception. Personally, I gave up on Borland long time ago. :)

comment:2 by niels_dekker, 13 years ago

Excuse me? The patch is extremely simple. You already added the same very workaround to MSVC 7.1 and Metroworks. Just add "|| defined(__BORLANDC__)" to the #if at line 222 of exception.hpp and it's ready.

Personally I feel I have a responsibility for utility/value_init_test.cpp, which does not use boost::exception in any way, but still gets the compile errors: http://www.boost.org/development/tests/trunk/developer/output/siliconman-boost-bin-v2-libs-utility-test-value_init_test-test-borland-6-2-1-debug.html

http://www.boost.org/development/tests/trunk/output/siliconman-boost-bin-v2-libs-utility-test-value_init_test-test-borland-6-2-1-debug.html

What should I do to fix them?

Would it be okay to you if I commit the little patch to exception.hpp?

by niels_dekker, 13 years ago

Attachment: exception_for Borland.patch added

private/public-patch for Borland/CodeGear, tested on CodeGear 2010. Update: now using BOOST_WORKAROUND.

comment:3 by peter.myerscough-jackopson@…, 12 years ago

As a step towards the affore mentioned goal of assisting those with the Codegear compiler, could you add this patch, and slowly more and more support can be added for this compiler, which some of us must work with, and would also like to work with Boost as much as possible too, it appears the only reason for blocking ths patch is ideological, rather than technical.

Please reconsider,

Peter Myerscough-Jackopson

comment:4 by Emil Dotchevski, 12 years ago

Are you willing to port Boost Exception to Codegear so at least some of the tests at http://www.boost.org/development/tests/trunk/developer/exception.html pass? For example, try to get adding error_info and getting error_info to work. Otherwise, the patch is pointless, IMHO.

comment:5 by niels_dekker, 12 years ago

I can certainly have a look and see if Codegear compatibility can be further increased. (But I don't commit myself to solving all remaining Codegear issues.)

The very little patch I proposed here already fixes the Codegear compile error triggered by merely doing #include <boost/exception/exception.hpp>

exception.hpp is included by Boost Test, even while a lot of unit tests don't actually use boost::exception at runtime. So I think the patch could help to get more unit tests at the Boost regression page compiling on Codegear.

comment:6 by Emil Dotchevski, 12 years ago

Resolution: wontfix
Status: closedreopened

The reason why boost/excption/exception.hpp doesn't have Codegear-specific support is that currently none of the tests would work on Codegear anyway. If you get at least some tests working, I'll accept the patch.

Thanks, Emil

comment:7 by Emil Dotchevski, 12 years ago

Owner: changed from Emil Dotchevski to niels_dekker
Status: reopenednew

comment:8 by niels_dekker, 12 years ago

(In [62819]) Added Borland/Codegear workaround to avoid compile error when doing #include <boost/exception/exception.hpp> -- see #4068

comment:9 by niels_dekker, 12 years ago

Resolution: fixed
Status: newclosed

Thanks Emil and Peter. FYI, on my computer, commit [62819] fixes the Codegear 2010 compile errors of many header tests, including all_hpp_test, diagnostic_information_hpp_test, errinfo_errno_hpp_test, exception_ptr_hpp_test, get_error_info_hpp_test, info_hpp_test, and info_tuple_hpp_test.

Hereby resolved as fixed.

comment:10 by Emil Dotchevski, 12 years ago

Resolution: fixed
Status: closedreopened

comment:11 by Emil Dotchevski, 12 years ago

Status: reopenednew

The fact that header files compile doesn't mean that any tests are working. Did you run the tests? Which ones work now?

Also, please don't include any headers in boost/exception/exception.hpp, not even boost/detail/workaround.hpp (it is OK to include workaround.hpp in other Boost Exception headers, just not this one.)

comment:12 by niels_dekker, 12 years ago

(In [62824]) Removed #include <boost/detail/workaround.hpp> from exception.hpp, requested by Emil, see #4068.

in reply to:  11 comment:13 by niels_dekker, 12 years ago

Replying to emildotchevski:

The fact that header files compile doesn't mean that any tests are working. Did you run the tests? Which ones work now?

On my computer, exception_test and refcount_ptr_test now run successfully, while they had Codegear 2010 compile errors before commit [62819].

Note: I'm offline in a few minutes.

comment:14 by Emil Dotchevski, 12 years ago

The refcount_ptr_test doesn't check any "official" Boost Exception functionality, that is, it is a critical test but only if adding and removing error info works.

The exception_test verifies that the boost::exception class compiles. The boost::exception class does not implement any functionality, it serves as an abstract interface for things implemented in other headers.

At some point boost/exception/exception.hpp had similar ifdefs for Codegear to the ones you introduced. I removed them because they don't do any good beyond making that header compile. I would suggest reverting the patch until at least *some* subset of Boost Exception functionality is available on Codegear.

Please let me know if you need any help understanding the Boost Exception code, I'll be more than happy to help in supporting Codegear as well.

Thanks, Emil

comment:15 by niels_dekker, 12 years ago

For your information, I have just reported the Borland / Codegear compiler bug to Embarcadero: C++Builder Report 85387, "Friend function template in namespace triggers error E2401", http://qc.embarcadero.com/wc/qcmain.aspx?d=85387

comment:16 by anonymous, 11 years ago

Probably a better fix would be to #include <boost/config.hpp> and check for BOOST_NO_MEMBER_TEMPLATE_FRIENDS.

comment:17 by Emil Dotchevski, 11 years ago

Borland is not a supported platform for Boost Exception. The functionality for unsupported platforms is limited to the the classical boost::throw_exception behavior. Formally this is checked by the first 4 tests in http://www.boost.org/development/tests/trunk/developer/exception.html. AFAIK, they work for Borland and all other platforms.

Note: See TracTickets for help on using tickets.