[Libreoffice-commits] core.git: 2 commits - compilerplugins/clang formula/source include/formula sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Feb 17 10:10:14 UTC 2017
compilerplugins/clang/unusedenumconstants.py | 2 +
formula/source/core/api/FormulaCompiler.cxx | 33 +++++++--------------------
include/formula/FormulaCompiler.hxx | 7 ++---
include/formula/token.hxx | 1
sc/source/core/opencl/formulagroupcl.cxx | 1
sc/source/core/tool/interpr4.cxx | 3 --
sc/source/core/tool/token.cxx | 1
7 files changed, 15 insertions(+), 33 deletions(-)
New commits:
commit 65227e9a405a61660d61871440727bbad70b5750
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Feb 17 10:51:28 2017 +0200
remove unused svSubroutine from StackVarEnum
Change-Id: I88603ce20dd152b600b2f30c81f091795b23169d
Reviewed-on: https://gerrit.libreoffice.org/34359
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 2405b66..9ba7728 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -74,7 +74,6 @@ enum StackVarEnum
svExternalName,
svSingleVectorRef,
svDoubleVectorRef,
- svSubroutine, // A token with a subroutine token array.
svError, // error token
svMissing = 0x70, // 0 or ""
svSep, // separator, ocSep, ocOpen, ocClose
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index b8ce346..bf91fcd 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -121,7 +121,6 @@ std::string StackVarEnumToString(StackVar const e)
case svExternalName: return "ExternalName";
case svSingleVectorRef: return "SingleVectorRef";
case svDoubleVectorRef: return "DoubleVectorRef";
- case svSubroutine: return "Subroutine";
case svError: return "Error";
case svMissing: return "Missing";
case svSep: return "Sep";
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 05e89da..36407d2 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4400,8 +4400,7 @@ StackVar ScInterpreter::Interpret()
// If the function pushed a subroutine as result, continue with
// execution of the subroutine.
- if (sp > nStackBase && pStack[sp-1]->GetOpCode() == ocCall
- /* && pStack[sp-1]->GetType() == svSubroutine */)
+ if (sp > nStackBase && pStack[sp-1]->GetOpCode() == ocCall)
{
Pop(); continue;
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index dcbde70..ae5cc3b 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1570,7 +1570,6 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
case svMissing:
case svRefList:
case svSep:
- case svSubroutine:
case svUnknown:
// We don't support vectorization on these.
SAL_INFO("sc.opencl", "opcode ocPush: variable type disables vectorisation for formula group");
commit 06f0d2d9f1ff0f6a8d1eddc693e4c4f65ec2b046
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Feb 17 10:25:09 2017 +0200
convert FormulaCompiler::SeparatorType to scoped enum
and drop unused COMMA_BASE enumerator
Change-Id: I5f35ba7453d5ca613ebd65d0853c7caaa210f3de
Reviewed-on: https://gerrit.libreoffice.org/34357
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/compilerplugins/clang/unusedenumconstants.py b/compilerplugins/clang/unusedenumconstants.py
index cb45db7..4a0c49c 100755
--- a/compilerplugins/clang/unusedenumconstants.py
+++ b/compilerplugins/clang/unusedenumconstants.py
@@ -145,6 +145,8 @@ for d in definitionSet:
"basic/source/inc/token.hxx", # SbiToken
"binaryurp/source/specialfunctionids.hxx", # binaryurp::SpecialFunctionIds
"connectivity/source/inc/odbc/OTools.hxx", # ODBC3SQLFunctionId
+ "include/formula/grammar.hxx", # FormulaGrammar::Grammar
+ "include/formula/opcode.hxx", # OpCode
# Windows or OSX only
"include/canvas/rendering/icolorbuffer.hxx",
"include/vcl/commandevent.hxx",
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index d837e2e..8f86ce5 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -147,7 +147,7 @@ class OpCodeList
public:
OpCodeList( sal_uInt16, FormulaCompiler::NonConstOpCodeMapPtr,
- FormulaCompiler::SeparatorType = FormulaCompiler::SEMICOLON_BASE );
+ FormulaCompiler::SeparatorType = FormulaCompiler::SeparatorType::SEMICOLON_BASE );
private:
bool getOpCodeString( OUString& rStr, sal_uInt16 nOp );
@@ -165,7 +165,7 @@ OpCodeList::OpCodeList( sal_uInt16 nRID, FormulaCompiler::NonConstOpCodeMapPtr x
{
SvtSysLocale aSysLocale;
const CharClass* pCharClass = (xMap->isEnglish() ? nullptr : aSysLocale.GetCharClassPtr());
- if (meSepType == FormulaCompiler::RESOURCE_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::RESOURCE_BASE)
{
for (sal_uInt16 i = 0; i <= SC_OPCODE_LAST_OPCODE_ID; ++i)
{
@@ -191,12 +191,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
{
case SC_OPCODE_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ",";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = ";";
return true;
@@ -205,12 +200,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
break;
case SC_OPCODE_ARRAY_COL_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ",";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = ";";
return true;
@@ -219,12 +209,7 @@ bool OpCodeList::getOpCodeString( OUString& rStr, sal_uInt16 nOp )
break;
case SC_OPCODE_ARRAY_ROW_SEP:
{
- if (meSepType == FormulaCompiler::COMMA_BASE)
- {
- rStr = ";";
- return true;
- }
- else if (meSepType == FormulaCompiler::SEMICOLON_BASE)
+ if (meSepType == FormulaCompiler::SeparatorType::SEMICOLON_BASE)
{
rStr = "|";
return true;
@@ -893,7 +878,7 @@ void FormulaCompiler::InitSymbolsPODF() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsPODF = aMap.mxSymbolMap;
}
@@ -903,7 +888,7 @@ void FormulaCompiler::InitSymbolsAPI() const
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
// XFunctionAccess API always used PODF grammar, keep it.
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_API, FormulaGrammar::GRAM_PODF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsAPI = aMap.mxSymbolMap;
}
@@ -912,7 +897,7 @@ void FormulaCompiler::InitSymbolsODFF() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF, FormulaGrammar::GRAM_ODFF, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF, FormulaGrammar::GRAM_ODFF, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsODFF = aMap.mxSymbolMap;
}
@@ -937,7 +922,7 @@ void FormulaCompiler::InitSymbolsOOXML() const
static OpCodeMapData aMap;
osl::MutexGuard aGuard(&aMap.maMtx);
if (!aMap.mxSymbolMap)
- loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_OOXML, aMap.mxSymbolMap, RESOURCE_BASE);
+ loadSymbols(RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML, FormulaGrammar::GRAM_OOXML, aMap.mxSymbolMap, SeparatorType::RESOURCE_BASE);
mxSymbolsOOXML = aMap.mxSymbolMap;
}
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 96d945f..f9ab53a 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -266,11 +266,10 @@ public:
than RESOURCE_BASE may override the resource strings. Used by OpCodeList
implementation via loadSymbols().
*/
- enum SeparatorType
+ enum class SeparatorType
{
RESOURCE_BASE,
- SEMICOLON_BASE,
- COMMA_BASE
+ SEMICOLON_BASE
};
protected:
@@ -359,7 +358,7 @@ private:
void InitSymbolsOOXML() const; /// only SymbolsOOXML, on demand
void loadSymbols( sal_uInt16 nSymbols, FormulaGrammar::Grammar eGrammar, NonConstOpCodeMapPtr& rxMap,
- SeparatorType eSepType = SEMICOLON_BASE ) const;
+ SeparatorType eSepType = SeparatorType::SEMICOLON_BASE ) const;
/** Check pCurrentFactorToken for nParam's (0-based) ForceArray types and
set ForceArray at rCurr if so. Set nParam+1 as 1-based
More information about the Libreoffice-commits
mailing list