codemaker/source/cppumaker/cpputype.cxx | 35 +++++++++++++++++++++++++++++--- codemaker/source/cppumaker/cpputype.hxx | 1 cppuhelper/inc/cppuhelper/weakagg.hxx | 1 idlc/inc/idlc/idlc.hxx | 2 - idlc/source/astdeclaration.cxx | 3 -- idlc/source/idlc.cxx | 16 ++++++++++---- solenv/bin/concat-deps.c | 4 --- solenv/gbuild/UnoApiTarget.mk | 2 - 8 files changed, 48 insertions(+), 16 deletions(-)
New commits: commit 44ea5d14140cccdc77a5fd8e2473804e879880df Author: Stephan Bergmann <[email protected]> Date: Fri Nov 23 13:41:15 2012 +0100 Adding SAL_DEPRECATED_INTERNAL to an implementation function is pointless ...as there are typically no direct calls to it anyway. What is apparently needed is to decorate the cppumaker-generated headers instead: * cppumaker obtains deprecation-information from the documentation strings in .rdb files. As these are normally generated by idlc without documentation included (no -C), idlc got changed to nevertheless contain documentation consisting of just "@deprecated" in this case, to allow to easily tunnel this information to cppumaker always. * The mechanism of parsing for "@deprecated" in documentation strings is somewhat crude, of course. * For now, cppumaker only decorates C++ functions that correspond to UNOIDL interface attributes and methods. More should be possible (but, e.g., being able to decorate a complete C++ class corresponding to a deprecated UNOIDL interface type depends on whether all platforms would accept SAL_DEPRECATED_INTERNAL at the same position in a C++ class declaration. * This could also be extended to other languages than C++/cppumaker. * Always using SAL_DEPRECATED_INERNAL instead of SAL_DEPRECATED for decoration is to keep things simple and our codebase working. Improvements are possible here, too, of course. Change-Id: Ia2917892f780d477652e4cd9f286588a6898c3f5 diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index eca0143..149653f 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -1354,6 +1354,22 @@ OString CppuType::indent() const //************************************************************************* // InterfaceType //************************************************************************* + +namespace { + +bool isDocumentedDeprecated(OUString const & documentation) { + return documentation.indexOf("@deprecated") != -1; + //TODO: this check is somewhat crude +} + +void dumpDeprecation(FileStream & o, bool deprecated) { + if (deprecated) { + o << "SAL_DEPRECATED_INTERNAL(\"marked @deprecated in UNOIDL\") "; + } +} + +} + InterfaceType::InterfaceType(typereg::Reader& typeReader, const OString& typeName, const TypeManager& typeMgr) @@ -1362,6 +1378,7 @@ InterfaceType::InterfaceType(typereg::Reader& typeReader, m_inheritedMemberCount = 0; m_hasAttributes = false; m_hasMethods = false; + m_isDeprecated = isDocumentedDeprecated(m_reader.getDocumentation()); } InterfaceType::~InterfaceType() @@ -1465,13 +1482,18 @@ void InterfaceType::dumpAttributes(FileStream& o) fieldType = rtl::OUStringToOString( m_reader.getFieldTypeName(i), RTL_TEXTENCODING_UTF8); + bool depr = m_isDeprecated + || isDocumentedDeprecated(m_reader.getFieldDocumentation(i)); + if (first) { first = sal_False; o << "\n" << indent() << "// Attributes\n"; } - o << indent() << "virtual "; + o << indent(); + dumpDeprecation(o, depr); + o << "virtual "; dumpType(o, fieldType); o << " SAL_CALL get" << fieldName << "()"; dumpAttributeExceptionSpecification(o, name, RT_MODE_ATTRIBUTE_GET); @@ -1480,7 +1502,9 @@ void InterfaceType::dumpAttributes(FileStream& o) if ((access & RT_ACCESS_READONLY) == 0) { bool byRef = passByReference(fieldType); - o << indent() << "virtual void SAL_CALL set" << fieldName << "( "; + o << indent(); + dumpDeprecation(o, depr); + o << "virtual void SAL_CALL set" << fieldName << "( "; dumpType(o, fieldType, byRef, byRef); o << " _" << fieldName.toAsciiLowerCase() << " )"; dumpAttributeExceptionSpecification(o, name, RT_MODE_ATTRIBUTE_SET); @@ -1529,7 +1553,12 @@ void InterfaceType::dumpMethods(FileStream& o) o << "\n" << indent() << "// Methods\n"; } - o << indent() << "virtual "; + o << indent(); + dumpDeprecation( + o, + (m_isDeprecated + || isDocumentedDeprecated(m_reader.getMethodDocumentation(i)))); + o << "virtual "; dumpType(o, returnType); o << " SAL_CALL " << methodName << "( "; for (sal_uInt16 j=0; j < paramCount; j++) diff --git a/codemaker/source/cppumaker/cpputype.hxx b/codemaker/source/cppumaker/cpputype.hxx index a2781cb..12abd54 100644 --- a/codemaker/source/cppumaker/cpputype.hxx +++ b/codemaker/source/cppumaker/cpputype.hxx @@ -191,6 +191,7 @@ protected: sal_uInt32 m_inheritedMemberCount; bool m_hasAttributes; bool m_hasMethods; + bool m_isDeprecated; private: void dumpExceptionSpecification( diff --git a/cppuhelper/inc/cppuhelper/weakagg.hxx b/cppuhelper/inc/cppuhelper/weakagg.hxx index f4ae380..094e178 100644 --- a/cppuhelper/inc/cppuhelper/weakagg.hxx +++ b/cppuhelper/inc/cppuhelper/weakagg.hxx @@ -79,7 +79,6 @@ public: @param Delegator the object that delegate its queryInterface to this aggregate. */ - SAL_DEPRECATED_INTERNAL("do not use XAggregation") virtual void SAL_CALL setDelegator( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Delegator ) throw(::com::sun::star::uno::RuntimeException); /** Called by the delegator or queryInterface. Re-implement this method instead of diff --git a/idlc/inc/idlc/idlc.hxx b/idlc/inc/idlc/idlc.hxx index df11060..30f5436 100644 --- a/idlc/inc/idlc/idlc.hxx +++ b/idlc/inc/idlc/idlc.hxx @@ -78,7 +78,7 @@ public: m_documentation = documentation; m_bIsDocValid = sal_True; } - sal_Bool isDocValid(); + OUString processDocumentation(); sal_Bool isInMainFile() { return m_bIsInMainfile; } void setInMainfile(sal_Bool bInMainfile) diff --git a/idlc/source/astdeclaration.cxx b/idlc/source/astdeclaration.cxx index 7a1bf31..ef09963 100644 --- a/idlc/source/astdeclaration.cxx +++ b/idlc/source/astdeclaration.cxx @@ -76,8 +76,7 @@ AstDeclaration::AstDeclaration(NodeType type, const OString& name, AstScope* pSc m_bImported = sal_True; } - if ( idlc()->isDocValid() ) - m_documentation = OStringToOUString(idlc()->getDocumentation(), RTL_TEXTENCODING_UTF8); + m_documentation = idlc()->processDocumentation(); m_bPublished = idlc()->isPublished(); } diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx index a064e7b..895a545 100644 --- a/idlc/source/idlc.cxx +++ b/idlc/source/idlc.cxx @@ -274,11 +274,19 @@ void Idlc::reset() m_includes.clear(); } -sal_Bool Idlc::isDocValid() +OUString Idlc::processDocumentation() { - if ( m_bGenerateDoc ) - return m_bIsDocValid; - return sal_False;; + OUString doc; + if (m_bIsDocValid) { + OString raw(getDocumentation()); + if (m_bGenerateDoc) { + doc = OStringToOUString(raw, RTL_TEXTENCODING_UTF8); + } else if (raw.indexOf("@deprecated") != -1) { + //TODO: this check is somewhat crude + doc = "@deprecated"; + } + } + return doc; } static void lcl_writeString(::osl::File & rFile, ::osl::FileBase::RC & o_rRC, commit ae41f950425f8f832e4a41e47c788b45fdbf243b Author: Stephan Bergmann <[email protected]> Date: Fri Nov 23 13:39:54 2012 +0100 Ignoring dependencies on .hdl files is unsound when cppumaker changes ...as it will do in one of the following commits. Change-Id: Ic13c0d398943d34dffbc1a87efcac213d6699ca9 diff --git a/solenv/bin/concat-deps.c b/solenv/bin/concat-deps.c index 813c39d..19e4c9a 100644 --- a/solenv/bin/concat-deps.c +++ b/solenv/bin/concat-deps.c @@ -731,10 +731,6 @@ elide_dependency(const char* key, int key_len, } #endif - /* .hdl files are always matched by .hpp */ - if (key_len > 4 && !PATHNCMP(key + key_len - 4, ".hdl", 4)) - return 1; - /* boost brings a plague of header files */ int i; int boost = 0; commit 800f388206b15db545d8b96d5546b766a4fc7b32 Author: Stephan Bergmann <[email protected]> Date: Fri Nov 23 13:37:40 2012 +0100 Only rebuilding .urd for newer .idl is unsound when idlc changes ...as it will do in one of the following commits. Change-Id: Ie243504db965e3a4803c593b9c09f12d2cb0fcfc diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk index d5da154..9bd5d1e 100644 --- a/solenv/gbuild/UnoApiTarget.mk +++ b/solenv/gbuild/UnoApiTarget.mk @@ -70,7 +70,7 @@ endef $(call gb_UnoApiPartTarget_get_target,%.done) : \ $(gb_UnoApiPartTarget_IDLCTARGET) \ | $(gb_UCPPTARGET) - $(call gb_UnoApiPartTarget__command,$@,$*,$(filter-out $(gb_UnoApiPartTarget_IDLCTARGET),$?)) + $(call gb_UnoApiPartTarget__command,$@,$*,$(filter-out $(gb_UnoApiPartTarget_IDLCTARGET),$^)) ifeq ($(gb_FULLDEPS),$(true)) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
