summaryrefslogtreecommitdiff
path: root/sc
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 /sc
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 'sc')
-rw-r--r--sc/source/core/opencl/op_statistical.cxx4
-rw-r--r--sc/source/core/tool/cellkeytranslator.cxx4
-rw-r--r--sc/source/core/tool/compiler.cxx4
-rw-r--r--sc/source/core/tool/detfunc.cxx4
-rw-r--r--sc/source/filter/oox/formulabase.cxx5
-rw-r--r--sc/source/filter/oox/pagesettings.cxx4
-rw-r--r--sc/source/ui/app/inputwin.cxx4
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx4
-rw-r--r--sc/source/ui/docshell/impex.cxx12
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx4
-rw-r--r--sc/source/ui/view/gridwin.cxx4
-rw-r--r--sc/source/ui/view/prevloc.cxx4
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
13 files changed, 61 insertions, 0 deletions
diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index ad0cf0358223..4a9bec3be0b1 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -7645,6 +7645,8 @@ void OpHypGeomDist::GenSlidingWindowFunction(std::stringstream &ss,
ss << "}\n";
}
+namespace {
+
enum MixDoubleString
{
svDoubleVectorRefDoubleString,
@@ -7658,6 +7660,8 @@ enum MixDoubleString
svDoubleDouble
};
+}
+
void OpMinA::GenSlidingWindowFunction(
std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments)
{
diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx
index 5999204b83bb..5ad71ca4c833 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -32,6 +32,8 @@ using ::com::sun::star::uno::Sequence;
using namespace ::com::sun::star;
+namespace {
+
enum LocaleMatch
{
LOCALE_MATCH_NONE = 0,
@@ -41,6 +43,8 @@ enum LocaleMatch
LOCALE_MATCH_ALL
};
+}
+
static LocaleMatch lclLocaleCompare(const lang::Locale& rLocale1, const LanguageTag& rLanguageTag2)
{
LocaleMatch eMatchLevel = LOCALE_MATCH_NONE;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f0c755fa1b8c..ac0390d4ee56 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -81,6 +81,8 @@ using ::std::vector;
CharClass* ScCompiler::pCharClassEnglish = nullptr;
const ScCompiler::Convention* ScCompiler::pConventions[ ] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
+namespace {
+
enum ScanState
{
ssGetChar,
@@ -97,6 +99,8 @@ enum ScanState
ssStop
};
+}
+
static const sal_Char* pInternal[2] = { "TTT", "__DEBUG_VAR" };
using namespace ::com::sun::star::i18n;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 740a4af583fd..3ea84ef59bbf 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -81,12 +81,16 @@ using namespace com::sun::star;
// The checkForUniqueItem method then finds a unique name for the item's value.
#define SC_LINEEND_NAME EMPTY_OUSTRING
+namespace {
+
enum DetInsertResult { // return-values for inserting in one level
DET_INS_CONTINUE,
DET_INS_INSERTED,
DET_INS_EMPTY,
DET_INS_CIRCULAR };
+}
+
class ScDetectiveData
{
private:
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 2e49ffd94447..9af3ad97048a 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -43,6 +43,8 @@
#include <oox/token/properties.hxx>
#include <o3tl/typed_flags_set.hxx>
+namespace {
+
enum class FuncFlags : sal_uInt16 {
NONE = 0x0000,
VOLATILE = 0x0001, /// Result is volatile (e.g. NOW() function).
@@ -64,6 +66,9 @@ enum class FuncFlags : sal_uInt16 {
INTERNAL = 0x2000, /// Function is internal in Calc.
EUROTOOL = 0x4000, /// function of euro tool lib, FUNCLIB_EUROTOOL
};
+
+}
+
namespace o3tl {
template<> struct typed_flags<FuncFlags> : is_typed_flags<FuncFlags, 0x77ff> {};
}
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index f52d4f638d74..14e4f9baaf82 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -343,6 +343,8 @@ void PageSettings::importPictureData( const Relations& rRelations, const OUStrin
}
}
+namespace {
+
enum HFPortionId
{
HF_LEFT,
@@ -351,6 +353,8 @@ enum HFPortionId
HF_COUNT
};
+}
+
struct HFPortionInfo
{
Reference<text::XText> mxText; /// XText interface of this portion.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 7d5695a63b9f..dae95abdd797 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -88,6 +88,8 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::frame::XLayoutManager;
using com::sun::star::beans::XPropertySet;
+namespace {
+
enum ScNameInputType
{
SC_NAME_INPUT_CELL,
@@ -102,6 +104,8 @@ enum ScNameInputType
SC_MANAGE_NAMES
};
+}
+
ScTextWndBase::ScTextWndBase( vcl::Window* pParent, WinBits nStyle )
: Window ( pParent, nStyle )
{
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 75d915438f44..2cc37704d7ac 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -42,6 +42,8 @@ const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT;
using namespace com::sun::star::uno;
+namespace {
+
// Defines - CSV Import Preserve Options
enum CSVImportOptionsIndex
{
@@ -59,6 +61,8 @@ enum CSVImportOptionsIndex
CSVIO_PasteSkipEmptyCells
};
+}
+
const ::std::vector<OUString> CSVImportOptionNames =
{
"MergeDelimiters",
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 7015c16a8fdc..317fc2e0d642 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -85,6 +85,8 @@ namespace
}
}
+namespace {
+
enum class SylkVersion
{
SCALC3, // Wrote wrongly quoted strings and unescaped semicolons.
@@ -93,6 +95,8 @@ enum class SylkVersion
OTHER // Assume that aliens wrote correct strings.
};
+}
+
// Whole document without Undo
ScImportExport::ScImportExport( ScDocument* p )
: pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ),
@@ -544,6 +548,8 @@ void ScImportExport::SetNoEndianSwap( SvStream& rStrm )
#endif
}
+namespace {
+
enum QuoteType
{
FIELDSTART_QUOTE,
@@ -553,6 +559,8 @@ enum QuoteType
DONTKNOW_QUOTE
};
+}
+
/** Determine if *p is a quote that ends a quoted field.
Precondition: we are parsing a quoted field already and *p is a quote.
@@ -638,12 +646,16 @@ static bool lcl_appendLineData( OUString& rField, const sal_Unicode* p1, const s
}
}
+namespace {
+
enum class DoubledQuoteMode
{
KEEP_ALL, // both are taken, additionally start and end quote are included in string
ESCAPE, // escaped quote, one is taken, one ignored
};
+}
+
static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rString,
const sal_Unicode* pSeps, sal_Unicode cStr, DoubledQuoteMode eMode, bool& rbOverflowCell )
{
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 61948b461c4f..4e6b6332be89 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -147,6 +147,8 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
SC_SIMPLE_SERVICE_INFO( ScCellFieldsObj, "ScCellFieldsObj", "com.sun.star.text.TextFields" )
SC_SIMPLE_SERVICE_INFO( ScHeaderFieldsObj, "ScHeaderFieldsObj", "com.sun.star.text.TextFields" )
+namespace {
+
enum ScUnoCollectMode
{
SC_UNO_COLLECT_NONE,
@@ -155,6 +157,8 @@ enum ScUnoCollectMode
SC_UNO_COLLECT_FINDPOS
};
+}
+
/**
* This class exists solely to allow searching through field items. TODO:
* Look into providing the same functionality directly in EditEngine, to
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 17c1bc503600..725937aac476 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -140,12 +140,16 @@
using namespace css;
using namespace css::uno;
+namespace {
+
enum class ScFilterBoxMode
{
DataSelect,
Scenario
};
+}
+
struct ScGridWindow::MouseEventState
{
bool mbActivatePart;
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 030f3c7d6436..2c00bf260cd1 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -23,6 +23,8 @@
#include <osl/diagnose.h>
#include <vcl/outdev.hxx>
+namespace {
+
enum ScPreviewLocationType
{
SC_PLOC_CELLRANGE,
@@ -36,6 +38,8 @@ enum ScPreviewLocationType
SC_PLOC_NOTETEXT
};
+}
+
struct ScPreviewLocationEntry
{
ScPreviewLocationType const eType;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 0ab2d088b0e7..1f6a66ab8db2 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -229,6 +229,8 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
return bChanged;
}
+namespace {
+
enum ScAutoSum
{
ScAutoSumNone = 0,
@@ -240,6 +242,8 @@ enum ScAutoSum
ScAutoSumCount
};
+}
+
static ScAutoSum lcl_IsAutoSumData( ScDocument* pDoc, SCCOL nCol, SCROW nRow,
SCTAB nTab, ScDirection eDir, SCCOLROW& nExtend )
{