Kaydet (Commit) 191f85df authored tarafından Noel Grandin's avatar Noel Grandin

re-land "new loplugin typedefparam""

This reverts commit c9bb4838,
and adds a bunch more fixes.

Change-Id: Ib584d302a73125528eba85fa1e722cb6fc41538a
Reviewed-on: https://gerrit.libreoffice.org/68680
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 98356611
......@@ -211,9 +211,9 @@ private:
virtual void SAL_CALL grabFocus() override;
virtual css::util::Color SAL_CALL getForeground() override;
virtual sal_Int32 SAL_CALL getForeground() override;
virtual css::util::Color SAL_CALL getBackground() override;
virtual sal_Int32 SAL_CALL getBackground() override;
virtual ::sal_Int32 SAL_CALL getCaretPosition() override;
......
......@@ -275,13 +275,13 @@ void SAL_CALL Paragraph::grabFocus()
}
// virtual
css::util::Color SAL_CALL Paragraph::getForeground()
sal_Int32 SAL_CALL Paragraph::getForeground()
{
return 0; // TODO
}
// virtual
css::util::Color SAL_CALL Paragraph::getBackground()
sal_Int32 SAL_CALL Paragraph::getBackground()
{
return 0; // TODO
}
......
......@@ -26,8 +26,8 @@ namespace oglcanvas
void renderComplexPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
void setupState( const ::basegfx::B2DHomMatrix& rTransform,
unsigned int eSrcBlend,
unsigned int eDstBlend,
GLenum eSrcBlend,
GLenum eDstBlend,
const com::sun::star::rendering::ARGBColor& rColor );
void renderOSD( const std::vector<double>& rNumbers, double scale );
......
......@@ -87,7 +87,7 @@ namespace canvas
bool drawRectangularArea(
double fAlpha,
const ::basegfx::B2DPoint& rPos,
const ::basegfx::B2DRange& rArea,
const ::basegfx::B2DRectangle& rArea,
const ::basegfx::B2DHomMatrix& rTransform );
/** Render the surface content to screen.
......
......@@ -472,7 +472,7 @@ void InternalData::deleteRow( sal_Int32 nAtIndex )
dump();
}
void InternalData::setComplexRowLabels( const vector< vector< uno::Any > >& rNewRowLabels )
void InternalData::setComplexRowLabels( const tVecVecAny& rNewRowLabels )
{
m_aRowLabels = rNewRowLabels;
sal_Int32 nNewRowCount = static_cast< sal_Int32 >( m_aRowLabels.size() );
......@@ -487,7 +487,7 @@ const InternalData::tVecVecAny& InternalData::getComplexRowLabels() const
return m_aRowLabels;
}
void InternalData::setComplexColumnLabels( const vector< vector< uno::Any > >& rNewColumnLabels )
void InternalData::setComplexColumnLabels( const tVecVecAny& rNewColumnLabels )
{
m_aColumnLabels = rNewColumnLabels;
sal_Int32 nNewColumnCount = static_cast< sal_Int32 >( m_aColumnLabels.size() );
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "tools/solar.h"
namespace test1
{
class Foo
{
void bar(sal_uIntPtr x); // expected-note {{declaration site here [loplugin:typedefparam]}}
sal_uIntPtr bar(); // expected-note {{declaration site here [loplugin:typedefparam]}}
};
void Foo::bar(sal_uLong)
// expected-error@-1 {{function param 0 at definition site does not match function param at declaration site, 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
{
}
sal_uLong Foo::bar()
// expected-error@-1 {{function return type at definition site does not match function param at declaration site, 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
{
return 1;
}
};
// Carve out an exception for the "typedef struct S {...} T" idiom we use in the UNO code
namespace test2
{
typedef struct Foo
{
int x;
} FooT;
void bar(struct Foo*);
void bar(FooT*){
// no warning expected
};
};
namespace test3
{
typedef struct Foo
{
int x;
} FooT;
void bar(Foo*);
void bar(FooT*){
// no warning expected
};
};
// check method overrides
namespace test4
{
struct Struct1
{
virtual sal_uIntPtr foo1();
// expected-note@-1 {{super-class method here [loplugin:typedefparam]}}
virtual void foo2(sal_uIntPtr);
// expected-note@-1 {{super-class method here [loplugin:typedefparam]}}
virtual ~Struct1();
};
struct Struct2 : public Struct1
{
virtual sal_uLong foo1() override;
// expected-error@-1 {{method return type does not match overridden method 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
virtual void foo2(sal_uLong) override;
// expected-error@-1 {{method param 0 does not match overridden method param 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
This diff is collapsed.
......@@ -88,7 +88,7 @@ private:
virtual sal_Bool SAL_CALL hasPendingChanges() override
{ return getRoot()->hasPendingChanges(); }
virtual css::util::ChangesSet SAL_CALL getPendingChanges() override
virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override
{ return getRoot()->getPendingChanges(); }
css::beans::Property SAL_CALL getPropertyByHierarchicalName(
......
......@@ -180,7 +180,7 @@ sal_Bool RootAccess::hasPendingChanges() {
return !changes.empty();
}
css::util::ChangesSet RootAccess::getPendingChanges()
css::uno::Sequence< ::css::util::ElementChange > RootAccess::getPendingChanges()
{
assert(thisIs(IS_UPDATE));
osl::MutexGuard g(*lock_);
......
......@@ -90,7 +90,7 @@ public:
virtual sal_Bool SAL_CALL hasPendingChanges() override;
virtual css::util::ChangesSet SAL_CALL getPendingChanges() override;
virtual css::uno::Sequence< ::css::util::ElementChange > SAL_CALL getPendingChanges() override;
private:
virtual ~RootAccess() override;
......
......@@ -60,7 +60,6 @@ namespace mysqlc
using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::sdbc::SQLWarning;
using ::com::sun::star::uno::RuntimeException;
typedef css::uno::Reference<css::container::XNameAccess> my_XNameAccessRef;
typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XConnection, css::sdbc::XWarningsSupplier,
css::lang::XServiceInfo>
......@@ -161,9 +160,10 @@ public:
sal_Int32 SAL_CALL getTransactionIsolation() override;
my_XNameAccessRef SAL_CALL getTypeMap() override;
css::uno::Reference<css::container::XNameAccess> SAL_CALL getTypeMap() override;
void SAL_CALL setTypeMap(const my_XNameAccessRef& typeMap) override;
void SAL_CALL
setTypeMap(const css::uno::Reference<css::container::XNameAccess>& typeMap) override;
// XCloseable
void SAL_CALL close() override;
// XWarningsSupplier
......
......@@ -167,7 +167,8 @@ public:
css::uno::Reference<css::io::XInputStream>
SAL_CALL getCharacterStream(sal_Int32 column) override;
Any SAL_CALL getObject(sal_Int32 column, const my_XNameAccessRef& typeMap) override;
Any SAL_CALL getObject(
sal_Int32 column, const css::uno::Reference<css::container::XNameAccess>& typeMap) override;
css::uno::Reference<css::sdbc::XRef> SAL_CALL getRef(sal_Int32 column) override;
css::uno::Reference<css::sdbc::XBlob> SAL_CALL getBlob(sal_Int32 column) override;
......
......@@ -199,7 +199,8 @@ public:
css::uno::Reference<css::io::XInputStream>
SAL_CALL getCharacterStream(sal_Int32 column) override;
Any SAL_CALL getObject(sal_Int32 column, const my_XNameAccessRef& typeMap) override;
Any SAL_CALL getObject(
sal_Int32 column, const css::uno::Reference<css::container::XNameAccess>& typeMap) override;
css::uno::Reference<css::sdbc::XRef> SAL_CALL getRef(sal_Int32 column) override;
css::uno::Reference<css::sdbc::XBlob> SAL_CALL getBlob(sal_Int32 column) override;
......
......@@ -31,7 +31,7 @@ namespace cppu {
sal_Bool component_writeInfoHelper(
SAL_UNUSED_PARAMETER void *, void * pRegistryKey,
ImplementationEntry const * entries)
const struct ImplementationEntry entries[])
{
bool bRet = false;
try
......@@ -61,8 +61,8 @@ sal_Bool component_writeInfoHelper(
void * component_getFactoryHelper(
char const * pImplName, SAL_UNUSED_PARAMETER void *,
SAL_UNUSED_PARAMETER void *, ImplementationEntry const * entries)
sal_Char const * pImplName, SAL_UNUSED_PARAMETER void *,
SAL_UNUSED_PARAMETER void *, const struct ImplementationEntry entries[])
{
void * pRet = nullptr;
......
......@@ -101,7 +101,7 @@ namespace svx
const OUString& getSecondaryText() const { return m_sSecondaryText; }
public:
void Paint( OutputDevice& _rDevice, const ::tools::Rectangle& _rRect, DrawTextFlags _nTextStyle,
void Paint( vcl::RenderContext& _rDevice, const ::tools::Rectangle& _rRect, DrawTextFlags _nTextStyle,
::tools::Rectangle* _pPrimaryLocation, ::tools::Rectangle* _pSecondaryLocation );
};
......
......@@ -48,7 +48,7 @@ void HsqlBinaryNode::readChildren(HsqlRowInputStream const& input)
}
std::vector<css::uno::Any> HsqlBinaryNode::readRow(HsqlRowInputStream& input,
const ColumnTypeVector& aColTypes,
const std::vector<ColumnDefinition>& aColTypes,
sal_Int32 nIndexCount)
{
// skip first 4 bytes (size), and index nodes, 16 bytes each
......
......@@ -48,12 +48,8 @@ using namespace css::io;
using namespace css::uno;
using namespace css::sdbc;
using ColumnTypeVector = std::vector<dbahsql::ColumnDefinition>;
using RowVector = std::vector<Any>;
using IndexVector = std::vector<sal_Int32>;
void lcl_setParams(const RowVector& row, Reference<XParameters> const& xParam,
const ColumnTypeVector& rColTypes)
void lcl_setParams(const std::vector<Any>& row, Reference<XParameters> const& xParam,
const std::vector<dbahsql::ColumnDefinition>& rColTypes)
{
assert(row.size() == rColTypes.size());
size_t nColIndex = 0;
......@@ -182,7 +178,8 @@ void lcl_setParams(const RowVector& row, Reference<XParameters> const& xParam,
}
}
OUString lcl_createInsertStatement(const OUString& sTableName, const ColumnTypeVector& rColTypes)
OUString lcl_createInsertStatement(const OUString& sTableName,
const std::vector<dbahsql::ColumnDefinition>& rColTypes)
{
assert(rColTypes.size() > 0);
OUStringBuffer sql("INSERT INTO ");
......@@ -221,8 +218,8 @@ HsqlImporter::HsqlImporter(Reference<XConnection>& rConnection, const Reference<
m_xStorage.set(rStorage);
}
void HsqlImporter::insertRow(const RowVector& xRows, const OUString& sTableName,
const ColumnTypeVector& rColTypes)
void HsqlImporter::insertRow(const std::vector<css::uno::Any>& xRows, const OUString& sTableName,
const std::vector<ColumnDefinition>& rColTypes)
{
OUString sStatement = lcl_createInsertStatement(sTableName, rColTypes);
Reference<XPreparedStatement> xStatement = m_rConnection->prepareStatement(sStatement);
......@@ -236,8 +233,8 @@ void HsqlImporter::insertRow(const RowVector& xRows, const OUString& sTableName,
}
void HsqlImporter::processTree(HsqlBinaryNode& rNode, HsqlRowInputStream& rStream,
const ColumnTypeVector& rColTypes, const OUString& sTableName,
sal_Int32 nIndexCount)
const std::vector<ColumnDefinition>& rColTypes,
const OUString& sTableName, sal_Int32 nIndexCount)
{
rNode.readChildren(rStream);
sal_Int32 nNext = rNode.getLeft();
......@@ -267,7 +264,7 @@ void HsqlImporter::processTree(HsqlBinaryNode& rNode, HsqlRowInputStream& rStrea
* Balance: ?
* Left/Right/Parent: File position of the Left/Right/Parent child
*/
void HsqlImporter::parseTableRows(const IndexVector& rIndexes,
void HsqlImporter::parseTableRows(const std::vector<sal_Int32>& rIndexes,
const std::vector<ColumnDefinition>& rColTypes,
const OUString& sTableName)
{
......
......@@ -167,7 +167,7 @@ void SchemaParser::parseSchema()
}
}
ColumnTypeVector SchemaParser::getTableColumnTypes(const OUString& sTableName) const
std::vector<ColumnDefinition> SchemaParser::getTableColumnTypes(const OUString& sTableName) const
{
return m_ColumnTypes.at(sTableName);
}
......
......@@ -134,8 +134,6 @@ using namespace css::io;
using namespace boost::posix_time;
using namespace boost::gregorian;
typedef std::vector<ColumnDefinition> ColumnTypeVector;
HsqlRowInputStream::HsqlRowInputStream() {}
void HsqlRowInputStream::setInputStream(Reference<XInputStream> const& rStream)
......@@ -239,7 +237,7 @@ bool HsqlRowInputStream::checkNull()
return nNull == 0;
}
std::vector<Any> HsqlRowInputStream::readOneRow(const ColumnTypeVector& nColTypes)
std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefinition>& nColTypes)
{
auto nLen = nColTypes.size();
std::vector<Any> aData;
......
......@@ -86,7 +86,7 @@ namespace dbaui
{
}
CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const CharsetDisplayDerefHelper_Base& _rBase, const OUString& _rDisplayName)
CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, const OUString& _rDisplayName)
:CharsetDisplayDerefHelper_Base(_rBase)
,m_sDisplayName(_rDisplayName)
{
......
......@@ -80,7 +80,7 @@ namespace drawinglayer
{
}
Primitive2DSequence SAL_CALL BasePrimitive2D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters )
css::uno::Sequence< ::css::uno::Reference< ::css::graphic::XPrimitive2D > > SAL_CALL BasePrimitive2D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters )
{
const geometry::ViewInformation2D aViewInformation(rViewParameters);
Primitive2DContainer aContainer;
......
......@@ -54,7 +54,7 @@ namespace drawinglayer
return Primitive3DContainer();
}
Primitive3DSequence SAL_CALL BasePrimitive3D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters )
css::uno::Sequence< ::css::uno::Reference< ::css::graphic::XPrimitive3D > > SAL_CALL BasePrimitive3D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters )
{
const geometry::ViewInformation3D aViewInformation(rViewParameters);
return comphelper::containerToSequence(get3DDecomposition(aViewInformation));
......
......@@ -99,7 +99,7 @@ public:
css::uno::Reference< css::linguistic2::XMeaning > > SAL_CALL
queryMeanings( const OUString& rTerm,
const css::lang::Locale& rLocale,
const css::beans::PropertyValues& rProperties ) override;
const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
};
......@@ -175,7 +175,7 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL
ThesDummy_Impl::queryMeanings(
const OUString& rTerm,
const lang::Locale& rLocale,
const beans::PropertyValues& rProperties )
const css::uno::Sequence< css::beans::PropertyValue >& rProperties )
{
GetThes_Impl();
uno::Sequence< uno::Reference< linguistic2::XMeaning > > aRes;
......@@ -207,10 +207,10 @@ public:
// XSpellChecker1 (same as XSpellChecker but sal_Int16 for language)
virtual sal_Bool SAL_CALL
isValid( const OUString& rWord, sal_Int16 nLanguage,
const css::beans::PropertyValues& rProperties ) override;
const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
virtual css::uno::Reference< css::linguistic2::XSpellAlternatives > SAL_CALL
spell( const OUString& rWord, sal_Int16 nLanguage,
const css::beans::PropertyValues& rProperties ) override;
const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
};
......@@ -248,7 +248,7 @@ sal_Bool SAL_CALL
sal_Bool SAL_CALL
SpellDummy_Impl::isValid( const OUString& rWord, sal_Int16 nLanguage,
const beans::PropertyValues& rProperties )
const css::uno::Sequence< css::beans::PropertyValue >& rProperties )
{
GetSpell_Impl();
bool bRes = true;
......@@ -260,7 +260,7 @@ sal_Bool SAL_CALL
uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL
SpellDummy_Impl::spell( const OUString& rWord, sal_Int16 nLanguage,
const beans::PropertyValues& rProperties )
const css::uno::Sequence< css::beans::PropertyValue >& rProperties )
{
GetSpell_Impl();
uno::Reference< linguistic2::XSpellAlternatives > xRes;
......@@ -295,19 +295,19 @@ public:
hyphenate( const OUString& rWord,
const css::lang::Locale& rLocale,
sal_Int16 nMaxLeading,
const css::beans::PropertyValues& rProperties ) override;
const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
virtual css::uno::Reference<
css::linguistic2::XHyphenatedWord > SAL_CALL
queryAlternativeSpelling( const OUString& rWord,
const css::lang::Locale& rLocale,
sal_Int16 nIndex,
const css::beans::PropertyValues& rProperties ) override;
const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override;
virtual css::uno::Reference<
css::linguistic2::XPossibleHyphens > SAL_CALL
createPossibleHyphens(