Kaydet (Commit) 6e67c03d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Enable -Wnon-virtual-dtor for GCC 4.6

...which has the necessary features to support it.

Change a lot of classes to either contain a protected non-virtual dtor
(which is backwards compatible, so even works for cppumaker-generated
UNO headers) or a public virtual one.

cppuhelper/propertysetmixin.hxx still needs to disable the warning, as
the relevant class has a non-virtual dtor but friends, which would still
cause GCC to warn.

Includes a patch for libcmis, intended to be upstreamed.
üst fe4be504
......@@ -62,6 +62,9 @@ namespace basctl { namespace docs {
{
public:
virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
protected:
~IDocumentDescriptorFilter() {}
};
//====================================================================
......
......@@ -147,6 +147,8 @@ namespace basctl
public:
FilterDocuments( bool _bFilterInvisible ) : m_bFilterInvisible( _bFilterInvisible ) { }
virtual ~FilterDocuments() {}
virtual bool includeDocument( const docs::DocumentDescriptor& _rDocument ) const;
private:
......
......@@ -67,6 +67,9 @@ struct IBitmapDeviceDamageTracker
{
/// gets called when said region is clobbered
virtual void damaged(const basegfx::B2IBox& rDamageRect) const = 0;
protected:
~IBitmapDeviceDamageTracker() {}
};
/** Definition of BitmapDevice interface
......
......@@ -65,6 +65,9 @@ namespace basic
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxForDocument,
BasicManager& _rBasicManager
) = 0;
protected:
~BasicManagerCreationListener() {}
};
//====================================================================
......
......@@ -87,6 +87,9 @@ public:
virtual String getLibraryPassword( const String& rLibraryName ) = 0;
virtual void clearLibraryPassword( const String& rLibraryName ) = 0;
virtual sal_Bool hasLibraryPassword( const String& rLibraryName ) = 0;
protected:
~OldBasicPassword() {}
};
struct LibraryContainerInfo
......
......@@ -99,6 +99,9 @@ namespace canvas
/** Query sprite priority
*/
virtual double getPriority() const = 0;
protected:
~Sprite() {}
};
/** Functor providing a StrictWeakOrdering for sprite references
......
......@@ -68,6 +68,9 @@ namespace canvas
virtual void updateSprite( const Sprite::Reference& rSprite,
const ::basegfx::B2DPoint& rPos,
const ::basegfx::B2DRange& rUpdateArea ) = 0;
protected:
~SpriteSurface() {}
};
}
......
......@@ -66,6 +66,9 @@ namespace cairocanvas
virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
const ::basegfx::B2DPoint& rOrigOutputPos,
bool bBufferedUpdate ) const = 0;
protected:
~Sprite() {}
};
}
......
......@@ -42,6 +42,9 @@ namespace nullcanvas
/** Redraw sprite
*/
virtual void redraw() const = 0;
protected:
~Sprite() {}
};
}
......
......@@ -66,6 +66,9 @@ namespace vclcanvas
virtual void redraw( OutputDevice& rOutDev,
const ::basegfx::B2DPoint& rPos,
bool bBufferedUpdate ) const = 0;
protected:
~Sprite() {}
};
}
......
......@@ -40,6 +40,9 @@ public:
virtual void updateReferenceSize() = 0;
virtual ::com::sun::star::uno::Any getReferenceSize() = 0;
virtual ::com::sun::star::awt::Size getCurrentSizeForReference() = 0;
protected:
~ReferenceSizePropertyProvider() {}
};
} // namespace wrapper
......
......@@ -49,6 +49,9 @@ class MarkHandleProvider
public:
virtual bool getMarkHandles( SdrHdlList& rHdlList ) =0;
virtual bool getFrameDragSingles() =0;
protected:
~MarkHandleProvider() {}
};
class DrawViewWrapper : public E3dView
......
......@@ -41,6 +41,9 @@ class RangeSelectionListenerParent
public:
virtual void listeningFinished( const ::rtl::OUString & rNewRange ) = 0;
virtual void disposingRangeSelection() = 0;
protected:
~RangeSelectionListenerParent() {}
};
// ----------------------------------------
......
......@@ -44,6 +44,9 @@ class TabPageNotifiable
public:
virtual void setInvalidPage( TabPage * pTabPage ) = 0;
virtual void setValidPage( TabPage * pTabPage ) = 0;
protected:
~TabPageNotifiable() {}
};
} // namespace chart
......
......@@ -38,6 +38,9 @@ class OOO_DLLPUBLIC_CHARTTOOLS ConfigItemListener
{
public:
virtual void notify( const ::rtl::OUString & rPropertyName ) = 0;
protected:
~ConfigItemListener() {}
};
} // namespace chart
......
......@@ -109,6 +109,9 @@ public:
static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp
, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier );
protected:
~ExplicitValueProvider() {}
};
//.............................................................................
......
......@@ -192,6 +192,7 @@ namespace chart
class DummyMutex : public ::framework::IMutex
{
public:
virtual ~DummyMutex() {}
virtual void acquire() { }
virtual void release() { }
};
......
......@@ -89,6 +89,9 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >& xContext
) = 0;
protected:
~LegendEntryProvider() {}
};
} // namespace chart
......
......@@ -65,6 +65,9 @@ public:
//return a constant out of ::com::sun::star::chart::TimeUnit that allows to display the smallest distance between occuring dates
virtual long calculateTimeResolutionOnXAxis() = 0;
virtual void setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate ) = 0;
protected:
~MinimumAndMaximumSupplier() {}
};
class MergedMinimumAndMaximumSupplier : public MinimumAndMaximumSupplier
......
......@@ -1412,8 +1412,13 @@ void InterfaceType::dumpDeclaration(FileStream& o)
o << "\n" << indent()
<< ("static inline ::com::sun::star::uno::Type const & SAL_CALL"
" static_type(void * = 0);\n");
" static_type(void * = 0);\n\n");
dec();
o << "protected:\n";
inc();
o << indent() << "~" << m_name
<< ("() throw () {} // avoid warnings about virtual members and"
" non-virtual dtor\n");
dec();
o << "};\n\n";
}
......
......@@ -77,7 +77,10 @@ namespace comphelper
struct OAccessibleComponentHelper_Base :
public ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleComponent >
{};
{
protected:
~OAccessibleComponentHelper_Base() {}
};
/** a helper class for implementing an AccessibleContext which at the same time
supports an XAccessibleComponent interface.
......
......@@ -56,6 +56,8 @@ namespace comphelper
OCommonAccessibleSelection();
~OCommonAccessibleSelection();
protected:
// access to context - still waiting to be overwritten
......
......@@ -61,7 +61,10 @@ namespace comphelper
struct OAccessibleWrapper_Base :
public ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible >
{};
{
protected:
~OAccessibleWrapper_Base() {}
};
/** a class which aggregates a proxy for an XAccessible, and wrapping the context returned by this
XAccessible.
......
......@@ -87,6 +87,9 @@ namespace comphelper
virtual void SAL_CALL acquire() = 0;
virtual void SAL_CALL release() = 0;
protected:
~IEventProcessor() {}
};
//====================================================================
......
......@@ -71,6 +71,8 @@ namespace comphelper
{
}
~ComponentBase() {}
/** marks the instance as initialized
Subsequent instantiations of a ComponentMethodGuard won't throw the NotInitializedException now.
......
......@@ -52,6 +52,9 @@ namespace comphelper
virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const = 0;
virtual bool isEnableSetModified() const = 0;
protected:
~IEmbeddedHelper() {}
};
struct EmbedImpl;
......
......@@ -83,6 +83,9 @@ public:
preferences for the given property
*/
virtual sal_Int32 getPreferedPropertyId(const ::rtl::OUString& _rName) = 0;
protected:
~IPropertyInfoService() {}
};
/**
......
......@@ -51,6 +51,9 @@ public:
// helper
static void addToSequence( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rSeq, sal_uInt16 nServices, /* sal_Char* */... ) throw();
static sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& SupportedServices ) throw();
protected:
~ServiceInfoHelper() {}
};
}
......
......@@ -46,6 +46,8 @@ namespace comphelper
{
}
OCommonAccessibleSelection::~OCommonAccessibleSelection() {}
//--------------------------------------------------------------------
void SAL_CALL OCommonAccessibleSelection::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
......
......@@ -102,6 +102,9 @@ namespace connectivity
<p>if this is not overridden by derived classes, it returns the static default locale.</p>
*/
virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const = 0;
protected:
~IParseContext() {}
};
}
......
......@@ -42,6 +42,9 @@ namespace dbtools
{
public:
virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,::rtl::OUStringBuffer& _rOut) = 0;
protected:
~ISQLStatementHelper() {}
};
//.........................................................................
......
......@@ -39,18 +39,27 @@ namespace connectivity
{
public:
virtual void refreshGroups() = 0;
protected:
~IRefreshableGroups() {}
};
class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers
{
public:
virtual void refreshUsers() = 0;
protected:
~IRefreshableUsers() {}
};
class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns
{
public:
virtual void refreshColumns() = 0;
protected:
~IRefreshableColumns() {}
};
}
}
......
......@@ -73,6 +73,7 @@ namespace connectivity
class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection
{
public:
virtual ~IObjectCollection();
virtual void reserve(size_t nLength) = 0;
virtual bool exists(const ::rtl::OUString& _sName ) = 0;
virtual bool empty() = 0;
......
......@@ -226,6 +226,9 @@ namespace connectivity
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
) = 0;
protected:
~IDataAccessTools() {}
};
//================================================================
......@@ -244,6 +247,9 @@ namespace connectivity
virtual sal_Int32 getSupportedTextEncodings(
::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
) const = 0;
protected:
~IDataAccessCharSet() {}
};
//================================================================
......@@ -272,6 +278,9 @@ namespace connectivity
const ::com::sun::star::lang::Locale& _rLocale,
const ::com::sun::star::util::Date& _rNullDate
) const = 0;
protected:
~IDataAccessTypeConversion() {}
};
//================================================================
......@@ -295,6 +304,9 @@ namespace connectivity
const sal_Char _cDecSeparator,
const IParseContext* _pContext
) const = 0;
protected:
~ISQLParseNode() {}
};
//================================================================
......@@ -313,6 +325,9 @@ namespace connectivity
) const = 0;
virtual const IParseContext& getContext() const = 0;
protected:
~ISQLParser() {}
};
//================================================================
......@@ -344,6 +359,9 @@ namespace connectivity
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
) = 0;
protected:
~IDataAccessToolsFactory() {}
};
//....................................................................
......
......@@ -50,6 +50,9 @@ namespace dbtools
virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) = 0;
virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) = 0;
virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) = 0;
protected:
~IWarningsContainer() {}
};
//====================================================================
......
......@@ -601,8 +601,10 @@ nsProfile::CreateInstance(nsISupports* aOuter, const nsID& aIID,
}
//Register profile manager
#include "pre_include_mozilla.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "post_include_mozilla.h"
static const nsCID kProfileManagerCID = NS_PROFILE_CID;
......
......@@ -66,9 +66,10 @@
#include <rmsdef.h>
#endif
#include "pre_include_mozilla.h"
#include "nsICharsetConverterManager.h"
#include "nsIPlatformCharset.h"
#include "post_include_mozilla.h"
#if defined (XP_UNIX)
# define USER_ENVIRONMENT_VARIABLE "USER"
......
......@@ -40,7 +40,10 @@
#include <osl/mutex.hxx>
#include <osl/conditn.hxx>
#include "pre_include_mozilla.h"
#include <nsIAbDirFactoryService.h>
#include "post_include_mozilla.h"
#include <MNSInit.hxx>
#include <MNameMapper.hxx>
#include "MNSMozabProxy.hxx"
......
......@@ -26,7 +26,9 @@
*
************************************************************************/
#if defined __SUNPRO_CC
#if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#elif defined __SUNPRO_CC
#pragma enable_warn
#elif defined _MSC_VER
#pragma warning(pop)
......
......@@ -55,8 +55,9 @@
#endif
#endif
#if defined __GNUC__
#pragma GCC system_header
#if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#elif defined __SUNPRO_CC
#pragma disable_warn
#elif defined _MSC_VER
......
......@@ -52,6 +52,9 @@ namespace connectivity
virtual sal_Int32 getDriverPos() const = 0;
virtual sal_Bool deletedVisible() const = 0;
virtual sal_Bool isRowDeleted() const = 0;
protected:
~IResultSetHelper() {}
};
}
......
......@@ -52,6 +52,9 @@ namespace connectivity
public:
virtual ::osl::Mutex& getMutex() const = 0;
virtual void checkDisposed() const = 0;
protected:
~IMethodGuardAccess() {}
};
//==========================================================================
......
......@@ -231,7 +231,8 @@ namespace
// -----------------------------------------------------------------------------
};
}
// -----------------------------------------------------------------------------
IObjectCollection::~IObjectCollection() {}
IMPLEMENT_SERVICE_INFO(OCollection,"com.sun.star.sdbcx.VContainer" , "com.sun.star.sdbcx.Container")
......
......@@ -26,11 +26,11 @@
# instead of those above.
gb_PARTIALBUILD:=T
include $(GBUILDDIR)/gbuild_simple.mk
include $(GBUILDDIR)/gbuild.mk
all: qa/cppumaker.flag qa/cppumaker/cppumaker.flag
%/cppumaker.flag: %/cppumaker.rdb
%/cppumaker.flag: %/cppumaker.rdb $(gb_UnoApiTarget_CPPUMAKERTARGET)
$(call gb_Helper_abbreviate_dirs_native, \
$(call gb_Helper_execute,cppumaker) -O. -BUCR -C $< $(OUTDIR_FOR_BUILD)/bin/udkapi.rdb)
touch $@
......
......@@ -74,9 +74,17 @@ struct DerivedException1: css::uno::Exception {};
struct DerivedException2: css::uno::RuntimeException {};
struct DerivedInterface1: css::uno::XInterface {};
struct DerivedInterface1: css::uno::XInterface {
private:
~DerivedInterface1() {}
// avoid warnings about virtual members and non-virtual dtor
};
struct DerivedInterface2: css::uno::XComponentContext {};
struct DerivedInterface2: css::uno::XComponentContext {
private:
~DerivedInterface2() {}
// avoid warnings about virtual members and non-virtual dtor
};
class Test: public ::CppUnit::TestFixture {
public:
......
......@@ -54,6 +54,9 @@ public:
virtual void SAL_CALL slot_queryInterface() = 0;
virtual void SAL_CALL acquire() throw () = 0;
virtual void SAL_CALL release() throw () = 0;
protected:
~XInterface() {}
// avoid warnings about virtual members and non-virtual dtor
};
//--------------------------------------------------------------------------------------------------
static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
......
......@@ -186,6 +186,7 @@ class SAL_NO_VTABLE SAL_DLLPUBLIC_TEMPLATE ImplHelperBase##N \
, __PUBLIC_IFC##N \
{ \
protected: \
~ImplHelperBase##N() throw () {} \
ClassData & SAL_CALL getClassData( ClassDataBase & s_aCD ) SAL_THROW(()) \
{ \
ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \
......@@ -221,6 +222,8 @@ public: \
{ return this->getClassData( s_aCD ).getTypes(); } \
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) \
{ return this->getClassData( s_aCD ).getImplementationId(); } \