diff options
-rw-r--r-- | compilerplugins/clang/inlinevisible.cxx | 53 | ||||
-rw-r--r-- | include/basegfx/tuple/b2ituple.hxx | 16 | ||||
-rw-r--r-- | include/comphelper/string.hxx | 20 | ||||
-rw-r--r-- | include/sfx2/basedlgs.hxx | 2 | ||||
-rw-r--r-- | include/svtools/ctrlbox.hxx | 4 | ||||
-rw-r--r-- | include/tools/stream.hxx | 24 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 4 | ||||
-rw-r--r-- | include/vcl/strhelper.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 2 |
9 files changed, 92 insertions, 39 deletions
diff --git a/compilerplugins/clang/inlinevisible.cxx b/compilerplugins/clang/inlinevisible.cxx new file mode 100644 index 000000000000..a16187307b7d --- /dev/null +++ b/compilerplugins/clang/inlinevisible.cxx @@ -0,0 +1,53 @@ +/* -*- 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/. + */ + +#include <cassert> +#include <string> + +#include "clang/AST/Attr.h" +#include "clang/Sema/SemaInternal.h" // warn_unused_function + +#include "compat.hxx" +#include "plugin.hxx" + +namespace { + +class InlineVisible: + public RecursiveASTVisitor<InlineVisible>, public loplugin::Plugin +{ +public: + explicit InlineVisible(InstantiationData const & data): Plugin(data) {} + + void run() override + { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + + bool VisitFunctionDecl(FunctionDecl const * decl); +}; + +bool InlineVisible::VisitFunctionDecl(FunctionDecl const * decl) { + if (!ignoreLocation(decl) && decl->isInlineSpecified()) { + VisibilityAttr * attr = decl->getAttr<VisibilityAttr>(); + if (attr != nullptr && attr->getVisibility() == VisibilityAttr::Default) + { + report( + DiagnosticsEngine::Warning, + ("Function explicitly declared both inline and " + " visibility=default"), + decl->getLocation()) + << decl->getSourceRange(); + } + } + return true; +} + +loplugin::Plugin::Registration<InlineVisible> X("inlinevisible"); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx index 8713ac0367a0..d75e41cc504a 100644 --- a/include/basegfx/tuple/b2ituple.hxx +++ b/include/basegfx/tuple/b2ituple.hxx @@ -198,56 +198,56 @@ namespace basegfx - BASEGFX_DLLPUBLIC inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB) + inline B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB) { B2ITuple aSum(rTupA); aSum += rTupB; return aSum; } - BASEGFX_DLLPUBLIC inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB) + inline B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB) { B2ITuple aSub(rTupA); aSub -= rTupB; return aSub; } - BASEGFX_DLLPUBLIC inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) + inline B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB) { B2ITuple aDiv(rTupA); aDiv /= rTupB; return aDiv; } - BASEGFX_DLLPUBLIC inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) + inline B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB) { B2ITuple aMul(rTupA); aMul *= rTupB; return aMul; } - BASEGFX_DLLPUBLIC inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) + inline B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t) { B2ITuple aNew(rTup); aNew *= t; return aNew; } - BASEGFX_DLLPUBLIC inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) + inline B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup) { B2ITuple aNew(rTup); aNew *= t; return aNew; } - BASEGFX_DLLPUBLIC inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) + inline B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t) { B2ITuple aNew(rTup); aNew /= t; return aNew; } - BASEGFX_DLLPUBLIC inline B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) + inline B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup) { B2ITuple aNew(t, t); B2ITuple aTmp(rTup); diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx index 181ca8b92a6e..ca47fb560968 100644 --- a/include/comphelper/string.hxx +++ b/include/comphelper/string.hxx @@ -253,13 +253,13 @@ namespace detail @return rBuf; */ -COMPHELPER_DLLPUBLIC inline OStringBuffer& truncateToLength( +inline OStringBuffer& truncateToLength( OStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(()) { return detail::truncateToLength(rBuffer, nLength); } -COMPHELPER_DLLPUBLIC inline OUStringBuffer& truncateToLength( +inline OUStringBuffer& truncateToLength( OUStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(()) { return detail::truncateToLength(rBuffer, nLength); @@ -294,14 +294,14 @@ namespace detail @return rBuf; */ -COMPHELPER_DLLPUBLIC inline OStringBuffer& padToLength( +inline OStringBuffer& padToLength( OStringBuffer& rBuffer, sal_Int32 nLength, sal_Char cFill = '\0') SAL_THROW(()) { return detail::padToLength(rBuffer, nLength, cFill); } -COMPHELPER_DLLPUBLIC inline OUStringBuffer& padToLength( +inline OUStringBuffer& padToLength( OUStringBuffer& rBuffer, sal_Int32 nLength, sal_Unicode cFill = '\0') SAL_THROW(()) { @@ -433,32 +433,32 @@ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString); */ COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OUString &rString); -COMPHELPER_DLLPUBLIC inline bool isdigitAscii(sal_Unicode c) +inline bool isdigitAscii(sal_Unicode c) { return ((c >= '0') && (c <= '9')); } -COMPHELPER_DLLPUBLIC inline bool isxdigitAscii(sal_Unicode c) +inline bool isxdigitAscii(sal_Unicode c) { return isdigitAscii(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); } -COMPHELPER_DLLPUBLIC inline bool islowerAscii(sal_Unicode c) +inline bool islowerAscii(sal_Unicode c) { return ((c >= 'a') && (c <= 'z')); } -COMPHELPER_DLLPUBLIC inline bool isupperAscii(sal_Unicode c) +inline bool isupperAscii(sal_Unicode c) { return ((c >= 'A') && (c <= 'Z')); } -COMPHELPER_DLLPUBLIC inline bool isalphaAscii(sal_Unicode c) +inline bool isalphaAscii(sal_Unicode c) { return islowerAscii(c) || isupperAscii(c); } -COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c) +inline bool isalnumAscii(sal_Unicode c) { return isalphaAscii(c) || isdigitAscii(c); } diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 1432d2622899..67670bd50cf6 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -44,7 +44,7 @@ class FixedLine; //and SfxDockingWindow, where it is changed into a UniqueId and cleared //This reverses the clear of the HelpId -SFX2_DLLPUBLIC inline void reverseUniqueHelpIdHack(Window &rWindow) +inline void reverseUniqueHelpIdHack(Window &rWindow) { if (rWindow.GetHelpId().isEmpty()) rWindow.SetHelpId(rWindow.GetUniqueId()); diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index 78986bdae3ca..f8187d622b1b 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -274,12 +274,12 @@ public: bool IsDouble( ) const { return (0 != m_nRate1) && (0 != m_nRate2); } }; -SVT_DLLPUBLIC inline Color sameColor( Color rMain ) +inline Color sameColor( Color rMain ) { return rMain; } -SVT_DLLPUBLIC inline Color sameDistColor( Color /*rMain*/, Color rDefault ) +inline Color sameDistColor( Color /*rMain*/, Color rDefault ) { return rDefault; } diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index c823739670ae..181a9ce0982a 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -502,7 +502,7 @@ TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nUnits); /// Attempt to read nUnits 8bit units to an OUString -TOOLS_DLLPUBLIC inline OUString read_uInt8s_ToOUString(SvStream& rStrm, +inline OUString read_uInt8s_ToOUString(SvStream& rStrm, sal_Size nUnits, rtl_TextEncoding eEnc) { return OStringToOUString(read_uInt8s_ToOString(rStrm, nUnits), eEnc); @@ -516,14 +516,14 @@ TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream& rStrm, /// Attempt to read a pascal-style length (of type prefix) prefixed sequence of /// 16bit units to an OUString, returned OString's length is number of /// units successfully read. -TOOLS_DLLPUBLIC inline OUString read_uInt16_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm) +inline OUString read_uInt16_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm) { sal_uInt16 nUnits = 0; rStrm.ReadUInt16( nUnits ); return read_uInt16s_ToOUString(rStrm, nUnits); } -TOOLS_DLLPUBLIC inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm) +inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStream& rStrm) { sal_uInt32 nUnits = 0; rStrm.ReadUInt32( nUnits ); @@ -535,7 +535,7 @@ TOOLS_DLLPUBLIC inline OUString read_uInt32_lenPrefixed_uInt16s_ToOUString(SvStr TOOLS_DLLPUBLIC sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr, sal_Size nUnits); -TOOLS_DLLPUBLIC inline sal_Size write_uInt16s_FromOUString(SvStream& rStrm, +inline sal_Size write_uInt16s_FromOUString(SvStream& rStrm, const OUString& rStr) { return write_uInt16s_FromOUString(rStrm, rStr, rStr.getLength()); @@ -567,21 +567,21 @@ TOOLS_DLLPUBLIC OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, /// Attempt to read a pascal-style length (of type prefix) prefixed sequence of /// 8bit units to an OString, returned OString's length is number of units /// successfully read. -TOOLS_DLLPUBLIC inline OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) +inline OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) { sal_uInt16 nUnits = 0; rStrm.ReadUInt16( nUnits ); return read_uInt8s_ToOString(rStrm, nUnits); } -TOOLS_DLLPUBLIC inline OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) +inline OString read_uInt8_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) { sal_uInt8 nUnits = 0; rStrm.ReadUChar( nUnits ); return read_uInt8s_ToOString(rStrm, nUnits); } -TOOLS_DLLPUBLIC inline OString read_uInt32_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) +inline OString read_uInt32_lenPrefixed_uInt8s_ToOString(SvStream& rStrm) { sal_uInt32 nUnits = 0; rStrm.ReadUInt32( nUnits ); @@ -590,13 +590,13 @@ TOOLS_DLLPUBLIC inline OString read_uInt32_lenPrefixed_uInt8s_ToOString(SvStream /// Attempt to read a pascal-style length (of type prefix) prefixed sequence of /// 8bit units to an OUString -TOOLS_DLLPUBLIC inline OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, +inline OUString read_uInt16_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc) { return OStringToOUString(read_uInt16_lenPrefixed_uInt8s_ToOString(rStrm), eEnc); } -TOOLS_DLLPUBLIC inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, +inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc) { return OStringToOUString(read_uInt8_lenPrefixed_uInt8s_ToOString(rStrm), eEnc); @@ -604,13 +604,13 @@ TOOLS_DLLPUBLIC inline OUString read_uInt8_lenPrefixed_uInt8s_ToOUString(SvStrea /// Attempt to write a prefixed sequence of nUnits 8bit units from an OString, /// returned value is number of bytes written -TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr, +inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr, sal_Size nUnits) { return rStrm.Write(rStr.getStr(), nUnits); } -TOOLS_DLLPUBLIC inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr) +inline sal_Size write_uInt8s_FromOString(SvStream& rStrm, const OString& rStr) { return write_uInt8s_FromOString(rStrm, rStr, rStr.getLength()); } @@ -624,7 +624,7 @@ TOOLS_DLLPUBLIC sal_Size write_uInt16_lenPrefixed_uInt8s_FromOString(SvStream& r /// Attempt to write a pascal-style length (of type prefix) prefixed sequence /// of 8bit units from an OUString, returned value is number of bytes written /// (including byte-count of prefix) -TOOLS_DLLPUBLIC inline sal_Size write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, +inline sal_Size write_uInt16_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm, const OUString &rStr, rtl_TextEncoding eEnc) { diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index c69b44b08248..b05458361fb4 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -757,13 +757,13 @@ VCL_DLLPUBLIC Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild //Returns true is the Window has a single child which is a container VCL_DLLPUBLIC bool isLayoutEnabled(const Window *pWindow); -VCL_DLLPUBLIC inline bool isContainerWindow(const Window &rWindow) +inline bool isContainerWindow(const Window &rWindow) { WindowType eType = rWindow.GetType(); return (eType == WINDOW_CONTAINER || eType == WINDOW_SCROLLWINDOW); } -VCL_DLLPUBLIC inline bool isContainerWindow(const Window *pWindow) +inline bool isContainerWindow(const Window *pWindow) { return pWindow && isContainerWindow(*pWindow); } diff --git a/include/vcl/strhelper.hxx b/include/vcl/strhelper.hxx index ee4c629672b8..d8b9cff0baec 100644 --- a/include/vcl/strhelper.hxx +++ b/include/vcl/strhelper.hxx @@ -44,12 +44,12 @@ namespace psp // parses the first double in the string; decimal is '.' only - VCL_DLLPUBLIC inline double StringToDouble( const OUString& rStr ) + inline double StringToDouble( const OUString& rStr ) { return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0)); } - VCL_DLLPUBLIC inline double StringToDouble(const OString& rStr) + inline double StringToDouble(const OString& rStr) { return rtl::math::stringToDouble(rStr, '.', static_cast<sal_Char>(0)); } @@ -57,7 +57,7 @@ namespace psp // fills a character buffer with the string representation of a double // the buffer has to be long enough (e.g. 128 bytes) // returns the string len - VCL_DLLPUBLIC inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) + inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0) { OString aStr( rtl::math::doubleToString( f, rtl_math_StringFormat_G, nPrecision, '.', true ) ); int nLen = aStr.getLength(); diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 155346fbf00a..21e6c548c7cd 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -359,7 +359,7 @@ void ImplFreeEventHookData(); bool ImplCallPreNotify( NotifyEvent& rEvt ); extern VCL_PLUGIN_PUBLIC ImplSVData* pImplSVData; -inline VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData() { return pImplSVData; } +inline ImplSVData* ImplGetSVData() { return pImplSVData; } VCL_PLUGIN_PUBLIC void ImplHideSplash(); bool ImplInitAccessBridge(); |