summaryrefslogtreecommitdiff
path: root/svl/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-16 21:00:53 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-17 00:28:17 +0100
commit314f15bff08b76bf96acf99141776ef64d2f1355 (patch)
tree842f7b109d9c4a57fa47fc5089f5818b2610368b /svl/source
parent46920005f74edcb70acfb8dd1a0ffb9553e5c2b2 (diff)
Extend loplugin:external to warn about enums
To mitigate the dangers of silently breaking ADL when moving enums into unnamed namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79 "New loplugin:external"), note all functions that are affected. (The plan is to extend loplugin:external further to also warn about classes and class templates, and the code to identify affected functions already takes that into account, so some parts of that code are not actually relevant for enums.) But it appears that none of the functions that are actually affected by the changes in this commit relied on being found through ADL, so no adaptions were necessary for them. (clang::DeclContext::collectAllContexts is non-const, which recursively means that External's Visit... functions must take non-const Decl*. Which required compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support such Visit... functions with non-const Decl* parameters.) Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd Reviewed-on: https://gerrit.libreoffice.org/83001 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svl/source')
-rw-r--r--svl/source/numbers/zforfind.cxx3
-rw-r--r--svl/source/numbers/zformat.cxx8
-rw-r--r--svl/source/numbers/zforscan.cxx4
3 files changed, 15 insertions, 0 deletions
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index cd889ce4d9d6..e56a5cef8502 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -182,6 +182,7 @@ double ImpSvNumberInputScan::StringToDouble( const OUString& rStr, bool bForceFr
return fNum;
}
+namespace {
/**
* Splits up the input into numbers and strings for further processing
@@ -209,6 +210,8 @@ enum ScanState // States of the Turing machine
SsGetString = 3
};
+}
+
bool ImpSvNumberInputScan::NextNumberStringSymbol( const sal_Unicode*& pStr,
OUString& rSymbol )
{
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index ce04f095c68f..0ba7c9b02f73 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -348,6 +348,8 @@ bool ImpSvNumFor::GetNewCurrencySymbol( OUString& rSymbol,
* SvNumberformat
*/
+namespace {
+
enum BracketFormatSymbolType
{
BRACKET_SYMBOLTYPE_FORMAT = -1, // subformat string
@@ -385,6 +387,8 @@ enum BracketFormatSymbolType
BRACKET_SYMBOLTYPE_NATNUM19 = -33
};
+}
+
void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat )
{
sFormatstring = rFormat.sFormatstring;
@@ -1408,6 +1412,8 @@ SvNumberformat::~SvNumberformat()
* ---------------+-------------------+----------------------------+---------------
*/
+namespace {
+
enum ScanState
{
SsStop,
@@ -1420,6 +1426,8 @@ enum ScanState
SsGetQuoted // quoted text
};
+}
+
// read a string until ']' and delete spaces in input
// static
sal_Int32 SvNumberformat::ImpGetNumber(OUStringBuffer& rString,
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 04e86ea2ca5b..1216ae6756a7 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -757,6 +757,8 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos
* we write back the rest of the characters!
*/
+namespace {
+
enum ScanState
{
SsStop = 0,
@@ -768,6 +770,8 @@ enum ScanState
SsGetBlank = 6
};
+}
+
short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr,
sal_Int32& nPos,
OUString& sSymbol ) const