diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-08 08:48:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-08 08:39:24 +0000 |
commit | 55717b14e0482c085595069d124ac9dd0c4e69c5 (patch) | |
tree | dd458e7cb4f1d90d01f58553980dad47326274c8 /codemaker/source/cppumaker/includes.cxx | |
parent | ad24a7c7f4deca8ee7755f68018884300fd861e0 (diff) |
Remove newly-unnecessary #includes from cppumaker-generated files
...after e57ca02849c3d87142ff5ff9099a212e72b8139c "Remove dynamic exception
specifications" dropped uses of UNO exception types from those generated files.
This needed first adapting client code that implicitly depended on those
#includes in the generated files it included ("Add missing #includes":
6dce9c6757823b9e89863716ae70ff4e8ddd4e60,
a34d9150b419ee7471b96599d877ff1091d6b567,
fed3783e77e00635e50622e7229b06c9e25451f1).
Change-Id: Ia1defda2d586b69092f53feef3644875192cbea4
Reviewed-on: https://gerrit.libreoffice.org/34014
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'codemaker/source/cppumaker/includes.cxx')
-rw-r--r-- | codemaker/source/cppumaker/includes.cxx | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/codemaker/source/cppumaker/includes.cxx b/codemaker/source/cppumaker/includes.cxx index d699996a0df3..7ab37166ec61 100644 --- a/codemaker/source/cppumaker/includes.cxx +++ b/codemaker/source/cppumaker/includes.cxx @@ -41,7 +41,7 @@ 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_includeException(false), + m_includeCassert(false), m_includeAny(dependencies.hasAnyDependency()), m_includeReference(false), m_includeSequence(dependencies.hasSequenceDependency()), m_includeType(dependencies.hasTypeDependency()), @@ -112,7 +112,7 @@ void Includes::add(OString const & entityName) { case codemaker::UnoType::Sort::Interface: case codemaker::UnoType::Sort::Typedef: m_map.insert( - Dependencies::Map::value_type(n, Dependencies::KIND_NO_BASE)); + Dependencies::Map::value_type(n, Dependencies::KIND_NORMAL)); break; default: throw CannotDumpException( @@ -133,7 +133,9 @@ void dumpEmptyLineBeforeFirst(FileStream & out, bool * first) { } -void Includes::dump(FileStream & out, OUString const * companionHdl) { +void Includes::dump( + FileStream & out, OUString const * companionHdl, bool exceptions) +{ OSL_ASSERT(companionHdl == nullptr || m_hpp); if (!m_includeReference) { for (const auto& pair : m_map) @@ -145,14 +147,8 @@ void Includes::dump(FileStream & out, OUString const * companionHdl) { } } out << "#include \"sal/config.h\"\n"; - if (m_includeCassert || m_includeException) { - out << "\n"; - if (m_includeCassert) { - out << "#include <cassert>\n"; - } - if (m_includeException) { - out << "#include <exception>\n"; - } + if (m_includeCassert) { + out << "\n#include <cassert>\n"; } if (companionHdl) { out << "\n"; @@ -161,24 +157,26 @@ void Includes::dump(FileStream & out, OUString const * companionHdl) { bool first = true; for (const auto& pair : m_map) { - dumpEmptyLineBeforeFirst(out, &first); - if (m_hpp || pair.second == Dependencies::KIND_BASE - || !isInterfaceType(u2b(pair.first))) - { - dumpInclude(out, u2b(pair.first), m_hpp); - } else { - bool ns = dumpNamespaceOpen(out, pair.first, false); - if (ns) { - out << " "; - } - out << "class "; - dumpTypeIdentifier(out, pair.first); - out << ";"; - if (ns) { - out << " "; + if (exceptions || pair.second != Dependencies::KIND_EXCEPTION) { + dumpEmptyLineBeforeFirst(out, &first); + if (m_hpp || pair.second == Dependencies::KIND_BASE + || !isInterfaceType(u2b(pair.first))) + { + dumpInclude(out, u2b(pair.first), m_hpp); + } else { + bool ns = dumpNamespaceOpen(out, pair.first, false); + if (ns) { + out << " "; + } + out << "class "; + dumpTypeIdentifier(out, pair.first); + out << ";"; + if (ns) { + out << " "; + } + dumpNamespaceClose(out, pair.first, false); + out << "\n"; } - dumpNamespaceClose(out, pair.first, false); - out << "\n"; } } static char const * hxxExtension[2] = { "h", "hxx" }; |