[Libreoffice-commits] core.git: 4 commits - bridges/source compilerplugins/clang connectivity/source external/coinmp external/lpsolve sal/osl sw/source
Stephan Bergmann
sbergman at redhat.com
Thu Jan 29 13:21:30 PST 2015
bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx | 4
bridges/source/cpp_uno/shared/vtablefactory.cxx | 6 -
compilerplugins/clang/cstylecast.cxx | 28 ------
compilerplugins/clang/redundantcast.cxx | 84 ++++++++++++++++++
connectivity/source/drivers/macab/MacabRecords.cxx | 4
external/coinmp/ExternalProject_coinmp.mk | 11 ++
external/lpsolve/ExternalProject_lpsolve.mk | 1
sal/osl/unx/file.cxx | 2
sw/source/filter/html/htmlatr.cxx | 11 +-
9 files changed, 111 insertions(+), 40 deletions(-)
New commits:
commit 2f3a9a51bfd042e20fe995b3f7437033d85a8907
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jan 29 17:01:58 2015 +0100
tdf#88906: Only split new span if it does not enclose exisiting span
Change-Id: I4290659c506ab11825b4c2f36952214b6254252c
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 5705622..d94fcc7 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -1528,10 +1528,13 @@ void HTMLEndPosLst::InsertItem( const SfxPoolItem& rItem, sal_Int32 nStart,
}
else if( nTestEnd < nEnd )
{
- // das Test-Attribut endet, bevor das neue endet. Das
- // neue Attribut muss deshalb aufgesplittet werden
- _InsertItem( new HTMLSttEndPos( rItem, nStart, nTestEnd ), i );
- nStart = nTestEnd;
+ if( pTest->GetStart() < nStart )
+ {
+ // das Test-Attribut endet, bevor das neue endet. Das
+ // neue Attribut muss deshalb aufgesplittet werden
+ _InsertItem( new HTMLSttEndPos( rItem, nStart, nTestEnd ), i );
+ nStart = nTestEnd;
+ }
}
else
{
commit f694ab5198587dcacd8c40c9095e7bc9435cbff2
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jan 29 10:02:25 2015 +0100
tdf#80370: Fix Mac OS X install names of external/{coinmp,lpsolve}
Change-Id: I240c8c940d7d3e1310c4ee33911e8c7019e67060
diff --git a/external/coinmp/ExternalProject_coinmp.mk b/external/coinmp/ExternalProject_coinmp.mk
index 4a7122d..8405248 100644
--- a/external/coinmp/ExternalProject_coinmp.mk
+++ b/external/coinmp/ExternalProject_coinmp.mk
@@ -29,8 +29,19 @@ $(call gb_ExternalProject_get_state_target,coinmp,build) :
./configure COIN_SKIP_PROJECTS="Data/Sample" \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
$(if $(DISABLE_DYNLOADING),--disable-shared) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
--enable-dependency-linking F77=unavailable \
&& $(MAKE) \
+ $(if $(filter MACOSX,$(OS)),&& $(PERL) \
+ $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
+ $(gb_Package_SOURCEDIR_coinmp)/Cbc/src/.libs/libCbc.3.8.8.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/Cbc/src/.libs/libCbcSolver.3.8.8.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/Cgl/src/.libs/libCgl.1.8.5.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/Clp/src/.libs/libClp.1.12.6.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/Clp/src/OsiClp/.libs/libOsiClp.1.12.6.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/CoinMP/src/.libs/libCoinMP.1.7.6.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/CoinUtils/src/.libs/libCoinUtils.3.9.11.dylib \
+ $(gb_Package_SOURCEDIR_coinmp)/Osi/src/Osi/.libs/libOsi.1.11.5.dylib) \
)
endif
diff --git a/external/lpsolve/ExternalProject_lpsolve.mk b/external/lpsolve/ExternalProject_lpsolve.mk
index a40ada4..62c4a1b 100644
--- a/external/lpsolve/ExternalProject_lpsolve.mk
+++ b/external/lpsolve/ExternalProject_lpsolve.mk
@@ -33,6 +33,7 @@ else # $(OS)!=WNT
$(call gb_ExternalProject_get_state_target,lpsolve,build):
$(call gb_ExternalProject_run,build,\
CC="$(CC) $(if $(debug),$(gb_COMPILERNOOPTFLAGS) $(gb_DEBUG_CFLAGS),$(gb_COMPILEROPTFLAGS))" \
+ $(if $(filter MACOSX,$(OS)),EXTRA_LINKFLAGS='-install_name @__________________________________________________OOO/liblpsolve55.dylib') \
sh -e $(if $(filter MACOSX,$(OS)),ccc.osx, \
$(if $(filter TRUE,$(DISABLE_DYNLOADING)),ccc.static, \
$(if $(filter AIXGCC,$(OS)$(COM)),ccc.aix.gcc, \
commit 331faca18ebdd843c06fa2435ee1bf71457e76dc
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jan 29 08:16:13 2015 +0100
Extract loplugin:redundantcast from loplugin:cstylecast
Change-Id: I08f17dd9cc092206083ff41bbbc178e0322e86d0
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 226a994..474dfcd 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -91,9 +91,9 @@ extern "C" void * SAL_CALL allocExec(
if (p == MAP_FAILED) {
p = 0;
}
- else if (mprotect (static_cast<char*>(p), n, PROT_READ | PROT_WRITE | PROT_EXEC) == -1)
+ else if (mprotect (p, n, PROT_READ | PROT_WRITE | PROT_EXEC) == -1)
{
- munmap (static_cast<char*>(p), n);
+ munmap (p, n);
p = 0;
}
#elif defined SAL_W32
@@ -109,7 +109,7 @@ extern "C" void SAL_CALL freeExec(
SAL_UNUSED_PARAMETER rtl_arena_type *, void * address, sal_Size size)
{
#if defined SAL_UNX
- munmap(static_cast< char * >(address), size);
+ munmap(address, size);
#elif defined SAL_W32
(void) size; // unused
VirtualFree(address, 0, MEM_RELEASE);
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index b6bb453..9775a08 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -47,8 +47,6 @@ public:
bool VisitCStyleCastExpr(const CStyleCastExpr * expr);
- bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
-
private:
bool externCFunction;
};
@@ -135,32 +133,6 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
return true;
}
-bool CStyleCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
- if (ignoreLocation(expr) || expr->getCastKind() != CK_BitCast) {
- return true;
- }
- QualType t = expr->getType();
- if (!(t->isPointerType()
- && t->getAs<PointerType>()->getPointeeType()->isVoidType()
- && expr->getSubExpr()->getType()->isPointerType()))
- {
- return true;
- }
- Expr const * e = expr->getSubExpr()->IgnoreParenImpCasts();
- while (isa<CXXConstCastExpr>(e)) {
- e = dyn_cast<CXXConstCastExpr>(e)->getSubExpr()->IgnoreParenImpCasts();
- }
- if (isa<CXXReinterpretCastExpr>(e)) {
- report(
- DiagnosticsEngine::Warning,
- ("redundant reinterpret_cast, result is implicitly cast to void"
- " pointer"),
- e->getExprLoc())
- << e->getSourceRange();
- }
- return true;
-}
-
loplugin::Plugin::Registration< CStyleCast > X("cstylecast");
}
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
new file mode 100644
index 0000000..e2f6179
--- /dev/null
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+// Warn about certain redundant casts:
+//
+// * A reinterpret_cast<T*>(...) whose result is then implicitly cast to a void
+// pointer
+//
+// * A static_cast<T*>(e) where e is of void pointer type and whose result is
+// then implicitly cast to a void pointer
+//
+// C-style casts are ignored because it makes this plugin simpler, and they
+// should eventually be eliminated via loplugin:cstylecast and/or
+// -Wold-style-cast. That implies that this plugin is only relevant for C++
+// code.
+
+#include "plugin.hxx"
+
+namespace {
+
+bool isVoidPointer(QualType type) {
+ return type->isPointerType()
+ && type->getAs<PointerType>()->getPointeeType()->isVoidType();
+}
+
+class RedundantCast:
+ public RecursiveASTVisitor<RedundantCast>, public loplugin::Plugin
+{
+public:
+ explicit RedundantCast(InstantiationData const & data): Plugin(data) {}
+
+ virtual void run() override {
+ if (compiler.getLangOpts().CPlusPlus) {
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+ }
+
+ bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
+};
+
+bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
+ if (ignoreLocation(expr) || expr->getCastKind() != CK_BitCast
+ || !isVoidPointer(expr->getType())
+ || !expr->getSubExpr()->getType()->isPointerType())
+ {
+ return true;
+ }
+ Expr const * e = expr->getSubExpr()->IgnoreParenImpCasts();
+ while (isa<CXXConstCastExpr>(e)) {
+ e = dyn_cast<CXXConstCastExpr>(e)->getSubExpr()->IgnoreParenImpCasts();
+ }
+ if (isa<CXXReinterpretCastExpr>(e)) {
+ report(
+ DiagnosticsEngine::Warning,
+ ("redundant reinterpret_cast, result is implicitly cast to void"
+ " pointer"),
+ e->getExprLoc())
+ << e->getSourceRange();
+ } else if (isa<CXXStaticCastExpr>(e)
+ && isVoidPointer(
+ dyn_cast<CXXStaticCastExpr>(e)->getSubExpr()
+ ->IgnoreParenImpCasts()->getType()))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ ("redundant static_cast from void pointer, result is implicitly"
+ " cast to void pointer"),
+ e->getExprLoc())
+ << e->getSourceRange();
+ }
+ return true;
+}
+
+loplugin::Plugin::Registration<RedundantCast> X("redundantcast");
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 659526b..564784f 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1198,7 +1198,7 @@ unmapFile (void* pAddr, sal_uInt64 uLength)
return osl_File_E_OVERFLOW;
size_t const nLength = sal::static_int_cast< size_t >(uLength);
- if (-1 == munmap(static_cast<char*>(pAddr), nLength))
+ if (-1 == munmap(pAddr, nLength))
return oslTranslateFileError(OSL_FET_ERROR, errno);
return osl_File_E_None;
commit ab2d0ff4d7c0a3c76401b0f07b85dc2267d1eb7c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Jan 29 08:12:13 2015 +0100
loplugin:cstylecast (Mac OS X)
Change-Id: Ia8f2c9f1c1c284708a2cbde379197ec6ba58742f
diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
index e0e76ca..259aff7 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx
@@ -236,7 +236,7 @@ static typelib_TypeClass cpp2uno_call(
uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
}
// complex return ptr is set to return reg
- *(void **)pRegisterReturn = pCppReturn;
+ *reinterpret_cast<void **>(pRegisterReturn) = pCppReturn;
}
if ( pReturnTypeDescr )
{
@@ -346,7 +346,7 @@ typelib_TypeClass cpp_vtable_call(
XInterface * pInterface = 0;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
( pCppI->getBridge()->getCppEnv(),
- (void **)&pInterface,
+ reinterpret_cast<void **>(&pInterface),
pCppI->getOid().pData,
reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
diff --git a/connectivity/source/drivers/macab/MacabRecords.cxx b/connectivity/source/drivers/macab/MacabRecords.cxx
index 167965c..4e663ba 100644
--- a/connectivity/source/drivers/macab/MacabRecords.cxx
+++ b/connectivity/source/drivers/macab/MacabRecords.cxx
@@ -677,7 +677,7 @@ MacabHeader *MacabRecords::createHeaderForProperty(const ABPropertyType _propert
/* Get the keys and values */
dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords);
dictValues = (CFTypeRef *) malloc(sizeof(CFTypeRef)*numRecords);
- CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, (const void **) dictKeys, (const void **) dictValues);
+ CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, reinterpret_cast<const void **>(dictKeys), (const void **) dictValues);
propertyNameString = CFStringToOUString(_propertyName);
@@ -1020,7 +1020,7 @@ void MacabRecords::insertPropertyIntoMacabRecord(const ABPropertyType _propertyT
CFTypeRef *dictValues;
dictKeys = (CFStringRef *) malloc(sizeof(CFStringRef)*numRecords);
dictValues = (CFTypeRef *) malloc(sizeof(CFTypeRef)*numRecords);
- CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, (const void **) dictKeys, (const void **) dictValues);
+ CFDictionaryGetKeysAndValues((CFDictionaryRef) _propertyValue, reinterpret_cast<const void **>(dictKeys), (const void **) dictValues);
/* Going through each element... */
for(i = 0; i < numRecords; i++)
More information about the Libreoffice-commits
mailing list