Kaydet (Commit) 0bc89aac authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst eb37196a
......@@ -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
......
......@@ -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";
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment