Skip to content

Commit dc60954

Browse files
committed
fix ticket:5999, escape the string returned by getErrorString()
1 parent dc8ddfa commit dc60954

File tree

333 files changed

+1104
-1100
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+1104
-1100
lines changed

OMCompiler/Compiler/Script/Interactive.mo

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ protected
928928
Absyn.Class cls;
929929
Absyn.Modification mod;
930930
Boolean finalPrefix, flowPrefix, streamPrefix, protected_, repl, dref1, dref2, evalParamAnn;
931-
Boolean addFunctions, graphicsExpMode;
931+
Boolean addFunctions, graphicsExpMode, warningsAsErrors;
932932
FCore.Graph env;
933933
GraphicEnvCache genv;
934934
Absyn.Exp exp;
@@ -1605,12 +1605,16 @@ algorithm
16051605
then
16061606
InteractiveUtil.getLocalVariables(cls, useQuotes(nargs), genv);
16071607

1608-
// adrpo added 2006-10-16
1609-
// - i think this function is needed here!
1608+
// adrpo added 2006-10-16 - i think this function is needed here!
1609+
// 2020-06-11 - remove this after 1.16 to use the one in Ceval*
16101610
case "getErrorString"
16111611
algorithm
1612-
{} := args;
1613-
outResult := Error.printMessagesStr(false);
1612+
warningsAsErrors := match args
1613+
case {Absyn.BOOL(warningsAsErrors)} then warningsAsErrors;
1614+
else false;
1615+
end match;
1616+
outResult := Error.printMessagesStr(warningsAsErrors);
1617+
outResult := System.escapedString(outResult,false);
16141618
then
16151619
stringAppendList({"\"", outResult, "\""});
16161620

testsuite/fix-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ else
1313
fi
1414
echo Switched to directory: $(pwd)
1515
echo Baselining files from $FILE in parallel ...
16-
perl ./runtests.pl -b -file=$FILE
16+
perl ./runtests.pl -b -file=$FILE $2
1717
cd $CD
1818

testsuite/flattening/modelica/arrays/TypeTest.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,6 @@ instantiateModel(TypeTestArrayBug); getErrorString();
546546
// Real a[5,4,10,2](quantity = \"SomeQ\", unit = \"m\", nominal = 5.0);
547547
// end TypeTestArrayBug;
548548
// "
549-
// "[flattening/modelica/arrays/TypeTestArrayBug.mo:3:24-3:34:writable] Warning: Non-array modification '"m"' for array component, possibly due to missing 'each'.
549+
// "[flattening/modelica/arrays/TypeTestArrayBug.mo:3:24-3:34:writable] Warning: Non-array modification '\"m\"' for array component, possibly due to missing 'each'.
550550
// "
551551
// endResult

testsuite/flattening/modelica/mosfiles/FinalTests.mos

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ getErrorString();
2222
// "
2323
// ""
2424
// "[flattening/modelica/mosfiles/FinalTests.mo:25:51-25:62:writable] Notification: From here:
25-
// [flattening/modelica/mosfiles/FinalTests.mo:27:12-27:22:writable] Error: Trying to override final element unit with modifier ' = "deg"'.
25+
// [flattening/modelica/mosfiles/FinalTests.mo:27:12-27:22:writable] Error: Trying to override final element unit with modifier ' = \"deg\"'.
2626
// Error: Error occurred while flattening model test2
2727
// "
2828
// ""
@@ -32,7 +32,7 @@ getErrorString();
3232
// "
3333
// ""
3434
// "[flattening/modelica/mosfiles/FinalTests.mo:48:31-48:39:writable] Notification: From here:
35-
// [flattening/modelica/mosfiles/FinalTests.mo:49:26-49:35:writable] Error: Trying to override final element unit with modifier ' = "mm"'.
35+
// [flattening/modelica/mosfiles/FinalTests.mo:49:26-49:35:writable] Error: Trying to override final element unit with modifier ' = \"mm\"'.
3636
// Error: Error occurred while flattening model test4
3737
// "
3838
// endResult

testsuite/flattening/modelica/mosfiles/FunctionDefaultArg.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ f(r=1.3,y=2.5);getErrorString();
3737
// 4.5
3838
// ""
3939
//
40-
// "[flattening/modelica/mosfiles/FunctionDefaultArg.mos:20:1-20:13:writable] Error: Failed to elaborate expression: f(4.5, "abc").
40+
// "[flattening/modelica/mosfiles/FunctionDefaultArg.mos:20:1-20:13:writable] Error: Failed to elaborate expression: f(4.5, \"abc\").
4141
// "
4242
//
4343
// "[flattening/modelica/mosfiles/FunctionDefaultArg.mos:21:1-21:13:writable] Error: Function f has no parameter named x.

testsuite/flattening/modelica/mosfiles/ISO-8859-1.mos

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ getErrorString();
88
// "\"???\"
99
// "
1010
// "[flattening/modelica/mosfiles/ISO-8859-1.mox:2:1-2:4:writable] Warning: The file was not encoded in UTF-8:
11-
// "???".
11+
// \"???\".
1212
// Defaulting to 7-bit ASCII with unknown characters replaced by '?'.
13-
// To change encoding when loading a file: loadFile(encoding="ISO-XXXX-YY").
13+
// To change encoding when loading a file: loadFile(encoding=\"ISO-XXXX-YY\").
1414
// To change it in a package: add a file package.encoding at the top-level.
1515
// Note: The Modelica Language Specification only allows files encoded in UTF-8.
1616
// "

testsuite/openmodelica/cppruntime/fmu/modelExchange/1.0/Crane_FMU1_CPP.mos

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ val(prismatic_v, 1);
4242
// LOG_SUCCESS | info | The simulation finished successfully.
4343
// "
4444
// end SimulationResult;
45-
// "[openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:793:3-793:76:writable] Warning: Parameter world_label2 has no value, and is fixed during initialization (fixed=true), using available start value (start="y") as default value.
46-
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:792:3-792:78:writable] Warning: Parameter world_label1 has no value, and is fixed during initialization (fixed=true), using available start value (start="x") as default value.
47-
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:791:3-791:80:writable] Warning: Parameter fixedTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
48-
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:790:3-790:73:writable] Warning: Parameter bodyShape_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
49-
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:789:3-789:90:writable] Warning: Parameter bodyShape_frameTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start="cylinder") as default value.
45+
// "[openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:793:3-793:76:writable] Warning: Parameter world_label2 has no value, and is fixed during initialization (fixed=true), using available start value (start=\"y\") as default value.
46+
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:792:3-792:78:writable] Warning: Parameter world_label1 has no value, and is fixed during initialization (fixed=true), using available start value (start=\"x\") as default value.
47+
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:791:3-791:80:writable] Warning: Parameter fixedTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start=\"cylinder\") as default value.
48+
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:790:3-790:73:writable] Warning: Parameter bodyShape_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start=\"cylinder\") as default value.
49+
// [openmodelica/cppruntime/fmu/modelExchange/1.0/cranes_crane_me_FMU.mo:789:3-789:90:writable] Warning: Parameter bodyShape_frameTranslation_shapeType has no value, and is fixed during initialization (fixed=true), using available start value (start=\"cylinder\") as default value.
5050
// "
5151
// 0.9493545676148092
5252
// 0.3948240567431445

testsuite/openmodelica/cppruntime/testVectorizedBlocks.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ val(y[10], 1.0);
198198
// Notification: Automatically loaded package Modelica_Synchronous 0.93.0-dev due to uses annotation.
199199
// Warning: Requested package Modelica of version 3.2.3, but this package was already loaded with version 3.2.2. You might experience problems if these versions are incompatible.
200200
// Warning: Requested package ModelicaServices of version 3.2.3, but this package was already loaded with version 3.2.2. You might experience problems if these versions are incompatible.
201-
// Warning: The initial conditions are over specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
201+
// Warning: The initial conditions are over specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
202202
// "
203203
// 10.0
204204
// 20.0

testsuite/openmodelica/cruntime/optimization/basic/LV.mos

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ getErrorString();
211211
// LOG_SUCCESS | info | The simulation finished successfully.
212212
// "
213213
// end SimulationResult;
214-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
214+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
215215
// "
216216
// {"Files Equal!"}
217217
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
@@ -240,7 +240,7 @@ getErrorString();
240240
// LOG_SUCCESS | info | The simulation finished successfully.
241241
// "
242242
// end SimulationResult;
243-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
243+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
244244
// "
245245
// {"Files Equal!"}
246246
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
@@ -269,7 +269,7 @@ getErrorString();
269269
// LOG_SUCCESS | info | The simulation finished successfully.
270270
// "
271271
// end SimulationResult;
272-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
272+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
273273
// "
274274
// {"Files Equal!"}
275275
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
@@ -298,7 +298,7 @@ getErrorString();
298298
// LOG_SUCCESS | info | The simulation finished successfully.
299299
// "
300300
// end SimulationResult;
301-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
301+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
302302
// "
303303
// {"Files Equal!"}
304304
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.
@@ -327,7 +327,7 @@ getErrorString();
327327
// LOG_SUCCESS | info | The simulation finished successfully.
328328
// "
329329
// end SimulationResult;
330-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
330+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
331331
// "
332332
// {"Files Equal!"}
333333
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.

testsuite/openmodelica/cruntime/optimization/basic/TFC3.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ getErrorString();
6868
// LOG_SUCCESS | info | The simulation finished successfully.
6969
// "
7070
// end SimulationResult;
71-
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
71+
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions(\"-d=initialization\").
7272
// "
7373
// {"Files Equal!"}
7474
// "Warning: 'compareSimulationResults' is deprecated. It is recommended to use 'diffSimulationResults' instead.

0 commit comments

Comments
 (0)