summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-01-17 16:21:48 +0200
committerTor Lillqvist <tml@collabora.com>2014-01-17 17:47:42 +0200
commit92bede3900e84d4f08efb81757ec95c518c7fa76 (patch)
tree2e7de9d1dc1ba7817ed2d07d356dfdf610ff8422 /sc/source
parent04683f14883f4cd64febadd71b327639f1e7edcc (diff)
Avoid some global statics that drag in lots of code in the static linking case
When doing static linking, i.e. when building the single executable for an iOS app, or the single DSO for an Android app, we list all our libraries (which all are static archives) on the linker command line. Static initializers in any library always get linked in, so it is a good idea to avoid such in the cases where they drag in a large amount of code. Which was the case here. Change-Id: Idef9aec1c10686c86f517ad10cf540a313d9c829
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/tool/compiler.cxx37
1 files changed, 14 insertions, 23 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 7b9bced367e8..3730d24de83f 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -272,7 +272,7 @@ void ScCompiler::SetGrammarAndRefConvention(
if (pDoc)
SetRefConvention( pDoc->GetAddressConvention());
else
- SetRefConvention( pConvOOO_A1);
+ SetRefConvention( GetRefConvention( FormulaGrammar::CONV_OOO ) );
}
else
SetRefConvention( eConv );
@@ -922,9 +922,6 @@ struct ConventionOOO_A1 : public Convention_A1
}
};
-static const ConventionOOO_A1 ConvOOO_A1;
-const ScCompiler::Convention * const ScCompiler::pConvOOO_A1 = &ConvOOO_A1;
-
struct ConventionOOO_A1_ODF : public ConventionOOO_A1
{
ConventionOOO_A1_ODF() : ConventionOOO_A1 (FormulaGrammar::CONV_ODF) { }
@@ -983,9 +980,6 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
}
};
-static const ConventionOOO_A1_ODF ConvOOO_A1_ODF;
-const ScCompiler::Convention * const ScCompiler::pConvOOO_A1_ODF = &ConvOOO_A1_ODF;
-
struct ConventionXL
{
static void GetTab(
@@ -1307,17 +1301,11 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
}
};
-static const ConventionXL_A1 ConvXL_A1;
-const ScCompiler::Convention * const ScCompiler::pConvXL_A1 = &ConvXL_A1;
-
struct ConventionXL_OOX : public ConventionXL_A1
{
ConventionXL_OOX() : ConventionXL_A1( FormulaGrammar::CONV_XL_OOX ) { }
};
-static const ConventionXL_OOX ConvXL_OOX;
-const ScCompiler::Convention * const ScCompiler::pConvXL_OOX = &ConvXL_OOX;
-
static void
r1c1_add_col( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress& rAbsRef )
{
@@ -1526,9 +1514,6 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
}
};
-static const ConventionXL_R1C1 ConvXL_R1C1;
-const ScCompiler::Convention * const ScCompiler::pConvXL_R1C1 = &ConvXL_R1C1;
-
ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArray& rArr)
: FormulaCompiler(rArr),
pDoc( pDocument ),
@@ -1537,7 +1522,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
pCharClass( ScGlobal::pCharClass ),
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
- pConv( pConvOOO_A1 ),
+ pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
mbCloseBrackets( true ),
mbRewind( false )
@@ -1563,7 +1548,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
pCharClass( ScGlobal::pCharClass ),
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
- pConv( pConvOOO_A1 ),
+ pConv( GetRefConvention( FormulaGrammar::CONV_OOO ) ),
meExtendedErrorDetection( EXTENDED_ERROR_DETECTION_NONE ),
mbCloseBrackets( true ),
mbRewind( false )
@@ -1646,18 +1631,24 @@ void ScCompiler::SetRefConvention( FormulaGrammar::AddressConvention eConv )
const ScCompiler::Convention* ScCompiler::GetRefConvention( FormulaGrammar::AddressConvention eConv )
{
+ static const ConventionOOO_A1 ConvOOO_A1;
+ static const ConventionOOO_A1_ODF ConvOOO_A1_ODF;
+ static const ConventionXL_A1 ConvXL_A1;
+ static const ConventionXL_R1C1 ConvXL_R1C1;
+ static const ConventionXL_OOX ConvXL_OOX;
+
switch (eConv)
{
case FormulaGrammar::CONV_OOO:
- return pConvOOO_A1;
+ return &ConvOOO_A1;
case FormulaGrammar::CONV_ODF:
- return pConvOOO_A1_ODF;
+ return &ConvOOO_A1_ODF;
case FormulaGrammar::CONV_XL_A1:
- return pConvXL_A1;
+ return &ConvXL_A1;
case FormulaGrammar::CONV_XL_R1C1:
- return pConvXL_R1C1;
+ return &ConvXL_R1C1;
case FormulaGrammar::CONV_XL_OOX:
- return pConvXL_OOX;
+ return &ConvXL_OOX;
case FormulaGrammar::CONV_UNSPECIFIED:
default:
;