diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-09-15 19:13:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-09-17 09:05:38 +0200 |
commit | 206b5b2661be37efdff3c6aedb6f248c4636be79 (patch) | |
tree | af385e5b4725dcfea23988d9113cced8e9ccaf3c /cui | |
parent | a85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff) |
New loplugin:external
...warning about (for now only) functions and variables with external linkage
that likely don't need it.
The problems with moving entities into unnamed namespacs and breaking ADL
(as alluded to in comments in compilerplugins/clang/external.cxx) are
illustrated by the fact that while
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
struct S2: S1 { int f() { return 1; } };
int f(S2 s) { return s.f(); }
}
int main() { return f(N::S2()); }
returns 1, both moving just the struct S2 into an nunnamed namespace,
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
namespace { struct S2: S1 { int f() { return 1; } }; }
int f(S2 s) { return s.f(); }
}
int main() { return f(N::S2()); }
as well as moving just the function f overload into an unnamed namespace,
struct S1 { int f() { return 0; } };
int f(S1 s) { return s.f(); }
namespace N {
struct S2: S1 { int f() { return 1; } };
namespace { int f(S2 s) { return s.f(); } }
}
int main() { return f(N::S2()); }
would each change the program to return 0 instead.
Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c
Reviewed-on: https://gerrit.libreoffice.org/60539
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/cfg.cxx | 10 | ||||
-rw-r--r-- | cui/source/dialogs/FontFeaturesDialog.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/scriptdlg.cxx | 2 | ||||
-rw-r--r-- | cui/source/factory/cuiexp.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/optpath.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/optsave.cxx | 2 | ||||
-rw-r--r-- | cui/source/options/treeopt.cxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/macroass.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/page.cxx | 10 | ||||
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/tabstpge.cxx | 2 |
14 files changed, 26 insertions, 26 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index fac9928510cc..d9d2f8dc9468 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -176,27 +176,27 @@ SvxConfigPage::CanConfig( const OUString& aModuleId ) return !(aModuleId == "com.sun.star.script.BasicIDE" || aModuleId == "com.sun.star.frame.Bibliography"); } -VclPtr<SfxTabPage> CreateSvxMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) +static VclPtr<SfxTabPage> CreateSvxMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) { return VclPtr<SvxMenuConfigPage>::Create( pParent.pParent, *rSet ); } -VclPtr<SfxTabPage> CreateSvxContextMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) +static VclPtr<SfxTabPage> CreateSvxContextMenuConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) { return VclPtr<SvxMenuConfigPage>::Create( pParent.pParent, *rSet, false ); } -VclPtr<SfxTabPage> CreateKeyboardConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) +static VclPtr<SfxTabPage> CreateKeyboardConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) { return VclPtr<SfxAcceleratorConfigPage>::Create( pParent.pParent, *rSet ); } -VclPtr<SfxTabPage> CreateSvxToolbarConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) +static VclPtr<SfxTabPage> CreateSvxToolbarConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) { return VclPtr<SvxToolbarConfigPage>::Create( pParent.pParent, *rSet ); } -VclPtr<SfxTabPage> CreateSvxEventConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) +static VclPtr<SfxTabPage> CreateSvxEventConfigPage( TabPageParent pParent, const SfxItemSet* rSet ) { return VclPtr<SvxEventConfigPage>::Create( pParent.pParent, *rSet, SvxEventConfigPage::EarlyInit() ); } diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx index 272031bc54a4..67f87b3410aa 100644 --- a/cui/source/dialogs/FontFeaturesDialog.cxx +++ b/cui/source/dialogs/FontFeaturesDialog.cxx @@ -28,8 +28,8 @@ FontFeaturesDialog::FontFeaturesDialog(weld::Window* pParent, OUString const& rF FontFeaturesDialog::~FontFeaturesDialog() {} -void makeEnumComboBox(weld::ComboBoxText& rNameBox, - vcl::font::FeatureDefinition const& rFeatureDefinition) +static void makeEnumComboBox(weld::ComboBoxText& rNameBox, + vcl::font::FeatureDefinition const& rFeatureDefinition) { for (vcl::font::FeatureParameter const& rParameter : rFeatureDefinition.getEnumParameters()) rNameBox.append_text(rParameter.getDescription()); diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx index 7e6d8ac97d0e..40e3cb890687 100644 --- a/cui/source/dialogs/scriptdlg.cxx +++ b/cui/source/dialogs/scriptdlg.cxx @@ -65,7 +65,7 @@ using namespace css::script; using namespace css::frame; using namespace css::document; -void ShowErrorDialog( const Any& aException ) +static void ShowErrorDialog( const Any& aException ) { ScopedVclPtrInstance<SvxScriptErrorDialog> pDlg( aException ); pDlg->Execute(); diff --git a/cui/source/factory/cuiexp.cxx b/cui/source/factory/cuiexp.cxx index c52f11f857be..09cddbf04044 100644 --- a/cui/source/factory/cuiexp.cxx +++ b/cui/source/factory/cuiexp.cxx @@ -56,7 +56,7 @@ namespace cui { static AbstractDialogFactory_Impl* pFactory=nullptr; - AbstractDialogFactory_Impl* GetFactory() + static AbstractDialogFactory_Impl* GetFactory() { if ( !pFactory ) pFactory = new AbstractDialogFactory_Impl; diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index afd2f4c5de2a..88dd159a9823 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -118,7 +118,7 @@ static sal_Int32 lcl_SeqGetEntryPos( return i < nLen ? i : -1; } -bool KillFile_Impl( const OUString& rURL ) +static bool KillFile_Impl( const OUString& rURL ) { bool bRet = true; try diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 24f167b94bba..7bfe1219d146 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -168,7 +168,7 @@ static OUString Convert_Impl( const OUString& rValue ) // functions ------------------------------------------------------------- -bool IsMultiPath_Impl( const sal_uInt16 nIndex ) +static bool IsMultiPath_Impl( const sal_uInt16 nIndex ) { #if OSL_DEBUG_LEVEL > 1 return ( SvtPathOptions::PATH_AUTOCORRECT == nIndex || diff --git a/cui/source/options/optsave.cxx b/cui/source/options/optsave.cxx index 55e3c4eef9da..1a80a97b1438 100644 --- a/cui/source/options/optsave.cxx +++ b/cui/source/options/optsave.cxx @@ -348,7 +348,7 @@ bool SvxSaveTabPage::FillItemSet( SfxItemSet* rSet ) return bModified; } -bool isODFFormat( const OUString& sFilter ) +static bool isODFFormat( const OUString& sFilter ) { static const char* aODFFormats[] = { diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 9452dae091aa..34f3a53aee09 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -280,7 +280,7 @@ void MailMergeCfg_Impl::Notify( const css::uno::Sequence< OUString >& ) } //typedef SfxTabPage* (*FNCreateTabPage)(TabPageParent pParent, const SfxItemSet &rAttrSet); -VclPtr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet) +static VclPtr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet) { CreateTabPage fnCreate = nullptr; switch(nId) @@ -1439,7 +1439,7 @@ void OfaTreeOptionsDialog::ApplyLanguageOptions(const SfxItemSet& rSet) } } -OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) +static OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame ) { OUString sIdentifier; Reference < XFrame > xCurrentFrame( _xFrame ); @@ -1739,7 +1739,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) } } -bool isNodeActive( OptionsNode const * pNode, Module* pModule ) +static bool isNodeActive( OptionsNode const * pNode, Module* pModule ) { if ( pNode ) { diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 28b67bd5bcfc..47da6b964256 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -118,7 +118,7 @@ static void lcl_setFillStyle(ListBox* pLbSelect, drawing::FillStyle eStyle) } } -sal_uInt16 GetItemId_Impl( ValueSet const & rValueSet, const Color& rCol ) +static sal_uInt16 GetItemId_Impl( ValueSet const & rValueSet, const Color& rCol ) { bool bFound = false; sal_uInt16 nCount = rValueSet.GetItemCount(); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 06d0137ce366..6358dee9f77a 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -138,7 +138,7 @@ const sal_uInt16 SvxCharTwoLinesPage::pTwoLinesRanges[] = // C-Function ------------------------------------------------------------ -inline bool StateToAttr( TriState aState ) +static inline bool StateToAttr( TriState aState ) { return ( TRISTATE_TRUE == aState ); } diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx index c164baff3f79..eb0dfa26c40a 100644 --- a/cui/source/tabpages/macroass.cxx +++ b/cui/source/tabpages/macroass.cxx @@ -90,7 +90,7 @@ static long const nTabs[] = #define LB_MACROS_ITEMPOS 2 -OUString ConvertToUIName_Impl( SvxMacro const *pMacro ) +static OUString ConvertToUIName_Impl( SvxMacro const *pMacro ) { OUString aName( pMacro->GetMacName() ); OUString aEntry; diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index 054bc8fb16ed..7776f0027df0 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -84,7 +84,7 @@ const SvxPageUsage aArr[] = }; -sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) +static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) { for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) if ( aArr[i] == nUsage ) @@ -93,7 +93,7 @@ sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) } -SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) +static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) { if ( nPos >= SAL_N_ELEMENTS(aArr) ) return SvxPageUsage::NONE; @@ -101,7 +101,7 @@ SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos ) } -Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) +static Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBox ) { Size aSz; aSz.setHeight( rShadow.CalcShadowSpace( SvxShadowItemSide::BOTTOM ) + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ) ); @@ -112,12 +112,12 @@ Size GetMinBorderSpace_Impl( const SvxShadowItem& rShadow, const SvxBoxItem& rBo } -long ConvertLong_Impl( const long nIn, MapUnit eUnit ) +static long ConvertLong_Impl( const long nIn, MapUnit eUnit ) { return OutputDevice::LogicToLogic( nIn, eUnit, MapUnit::MapTwip ); } -bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) +static bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) { if ( pSize ) { diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 5f3af968def6..3e0c7fb9e7a9 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -95,7 +95,7 @@ enum LineSpaceList LLINESPACE_FIX = 7 }; -void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); +static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 ); void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, int eSpace, long lValue ) @@ -145,7 +145,7 @@ void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, } } -sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet) +static sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet) { sal_uInt16 nHtmlMode = 0; const SfxPoolItem* pItem = nullptr; diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index e64ab07e82be..9133ad646b55 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -66,7 +66,7 @@ const sal_uInt16 SvxTabulatorTabPage::pRanges[] = 0 }; -void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs ) +static void FillUpWithDefTabs_Impl( long nDefDist, SvxTabStopItem& rTabs ) { if( rTabs.Count() ) return; |