diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-20 12:52:09 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-20 16:10:53 +0200 |
commit | 0bc89aac4c64bb833e387657f680e194c26aef97 (patch) | |
tree | 7cf8313e66b7dbf221cb736636ab2c6074d0bfa9 /codemaker | |
parent | eb37196aa773369555a36318e7aeaa2ed437d423 (diff) |
cppumaker: Allow UNO interface functions to throw std::exception
...so that exceptions like std::bad_alloc need not be treated in C++
implementations of UNO interfaces to not cause std::unexpected. Of course, this
requires implementations to be adapted and actually mention std::exception in
their exception specifications.
Change-Id: Ie7f91e7ca47d8a81e3d0ba817e65d83c7823af75
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 4 | ||||
-rw-r--r-- | codemaker/source/cppumaker/includes.cxx | 14 | ||||
-rw-r--r-- | codemaker/source/cppumaker/includes.hxx | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 8d8d31427d18..0a710a88e4df 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -465,6 +465,7 @@ void CppuType::addDefaultHIncludes(codemaker::cppumaker::Includes & includes) if (m_typeMgr->getSort(name_) == codemaker::UnoType::SORT_INTERFACE_TYPE) { + includes.addException(); includes.addReference(); } } @@ -479,6 +480,7 @@ void CppuType::addDefaultHxxIncludes(codemaker::cppumaker::Includes & includes) if (m_typeMgr->getSort(name_) == codemaker::UnoType::SORT_INTERFACE_TYPE) { + includes.addException(); includes.addReference(); } } @@ -1582,7 +1584,7 @@ void InterfaceType::dumpExceptionSpecification( if (!first) { out << ", "; } - out << "::css::uno::RuntimeException"; + out << "::css::uno::RuntimeException, ::std::exception"; } out << ")"; #if !defined DBG_UTIL diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index c6516745a5d2..4c47c7e5be86 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -41,8 +41,8 @@ Includes::Includes( rtl::Reference< TypeManager > const & manager, codemaker::cppumaker::Dependencies const & dependencies, bool hpp): m_manager(manager), m_map(dependencies.getMap()), m_hpp(hpp), - m_includeCassert(false), m_includeAny(dependencies.hasAnyDependency()), - m_includeReference(false), + m_includeCassert(false), m_includeException(false), + m_includeAny(dependencies.hasAnyDependency()), m_includeReference(false), m_includeSequence(dependencies.hasSequenceDependency()), m_includeType(dependencies.hasTypeDependency()), m_includeCppuMacrosHxx(false), m_includeCppuUnotypeHxx(false), @@ -147,8 +147,14 @@ void Includes::dump(FileStream & out, OUString const * companionHdl) { } } out << "#include \"sal/config.h\"\n"; - if (m_includeCassert) { - out << "\n#include <cassert>\n"; + if (m_includeCassert || m_includeException) { + out << "\n"; + if (m_includeCassert) { + out << "#include <cassert>\n"; + } + if (m_includeException) { + out << "#include <exception>\n"; + } } if (companionHdl) { out << "\n"; diff --git a/codemaker/source/cppumaker/includes.hxx b/codemaker/source/cppumaker/includes.hxx index a70aa9b06b38..a149dc568f89 100644 --- a/codemaker/source/cppumaker/includes.hxx +++ b/codemaker/source/cppumaker/includes.hxx @@ -40,6 +40,7 @@ public: void add(OString const & entityName); void addCassert() { m_includeCassert = true; } + void addException() { m_includeException = true; } void addAny() { m_includeAny = true; } void addReference() { m_includeReference = true; } void addSequence() { m_includeSequence = true; } @@ -75,6 +76,7 @@ private: Dependencies::Map m_map; bool m_hpp; bool m_includeCassert; + bool m_includeException; bool m_includeAny; bool m_includeReference; bool m_includeSequence; |