1
+ #pragma clang diagnostic push
2
+ #pragma ide diagnostic ignored "performance-for-range-copy"
3
+ #pragma ide diagnostic ignored "performance-unnecessary-value-param"
1
4
/* * \file
2
5
This TESTAR wrapper for interfacing to the SPOT library consists of a single C++ sourcecode file,
3
6
with imperative function calls to subroutines.
@@ -35,6 +38,8 @@ namespace fs = std::experimental::filesystem;
35
38
const std::string version = " 20201024" ; /* *< version of the application */ // NOLINT(cert-err58-cpp)
36
39
std::chrono::system_clock::time_point clock_start, clock_end; /* *< the clock variables are used to measure the runtime of specified actions */ // NOLINT(cert-err58-cpp)
37
40
41
+ #pragma clang diagnostic push
42
+ #pragma ide diagnostic ignored "OCDFAInspection"
38
43
/* *
39
44
* Find the position of the matching closing parenthesis ')'
40
45
* @param data string to search
@@ -58,6 +63,7 @@ int findClosingParenthesis(std::string &data, int openPos) {
58
63
}
59
64
return closePos;
60
65
}
66
+ #pragma clang diagnostic pop
61
67
/* *
62
68
* Find the position of the matching opening parenthesis '('
63
69
* (search from right to left)
@@ -107,6 +113,8 @@ void findAndReplaceAll(std::string &data, std::string toSearch, std::string repl
107
113
}
108
114
}
109
115
116
+ #pragma clang diagnostic push
117
+ #pragma ide diagnostic ignored "performance-inefficient-string-concatenation"
110
118
/* *
111
119
* Find any matching substring and surround all occurrences with 'replacestring' + 'substring' + 'closing'
112
120
*
@@ -136,6 +144,9 @@ void findClosingParenthesisAndInsert(std::string &data, std::string toSearch, st
136
144
pos = data.find (toSearch, pos + toSearch.size () + replaceStr.size () + orginalblock.size () + closing.size ());
137
145
}
138
146
}
147
+ #pragma clang diagnostic pop
148
+ #pragma clang diagnostic push
149
+ #pragma ide diagnostic ignored "performance-inefficient-string-concatenation"
139
150
/* *
140
151
* Find any matching substring and surround all occurrences with 'replacestring' + 'substring' + 'closing'
141
152
* (search from right to left)
@@ -166,6 +177,7 @@ void findOpeningParenthesisAndInsert(std::string &data, std::string toSearch, st
166
177
bracketpos + opening.size () + orginalblock.size () + replaceStr.size () + toSearch.size ());
167
178
}
168
179
}
180
+ #pragma clang diagnostic pop
169
181
170
182
/* *
171
183
* Get the system time as a string
@@ -235,6 +247,8 @@ std::string log_mem_usage()
235
247
}
236
248
237
249
//
250
+ #pragma clang diagnostic push
251
+ #pragma ide diagnostic ignored "abseil-string-find-startswith"
238
252
/* *
239
253
* Simple commandline parser.
240
254
* @param argc number of arguments on the commandline
@@ -270,6 +284,7 @@ std::string getCmdOption(int argc, char *argv[], const std::string &option, bool
270
284
}
271
285
return cmd;
272
286
}
287
+ #pragma clang diagnostic pop
273
288
274
289
/* *
275
290
* Writes a stream to a file. The stream will stop after the string "EOF_HOA" or the last line
@@ -458,6 +473,7 @@ std::string getAutomatonTitle(spot::twa_graph_ptr &aut) {
458
473
}
459
474
}
460
475
476
+
461
477
/* *
462
478
* Model checks a single LTL formula on the Buchi automaton
463
479
* This function checks the syntax of the formula and
@@ -472,9 +488,9 @@ std::string getAutomatonTitle(spot::twa_graph_ptr &aut) {
472
488
* @param aut buchi automaton
473
489
* @return multiline string with PASS or FAIL information, timing and counterexample traces.
474
490
*/
475
- std::string modelcheck_property (std::string formula, char ltlftype, bool witness, std::string ltlf_alive_ap,
476
- spot::bdd_dict_ptr &bdd,
477
- spot::twa_graph_ptr &aut) {
491
+ std::string model_check_property (std::string formula, char ltlftype, bool witness, std::string ltlf_alive_ap,
492
+ spot::bdd_dict_ptr &bdd,
493
+ spot::twa_graph_ptr &aut) {
478
494
479
495
std::ostringstream sout; // needed for capturing output of run.
480
496
sout << " === Formula\n " ;
@@ -572,6 +588,7 @@ std::string modelcheck_property(std::string formula, char ltlftype, bool witness
572
588
}
573
589
return sout.str ();
574
590
}
591
+
575
592
/* *
576
593
* Verifies whether the formula has a valid LTL syntax
577
594
*
@@ -641,7 +658,7 @@ bool model_has_noloops(std::string ltlf_alive_ap, spot::bdd_dict_ptr &bdd, spot:
641
658
if (ltlf_alive_ap.length () != 0 ) {
642
659
// alive U G(!alive): the 'U' makes that !alive or dead is required in all paths.
643
660
std::string istracetodead = ltlf_alive_ap + " U G(!" + ltlf_alive_ap + " )" ;
644
- std::string formula_result = modelcheck_property (istracetodead, LTL, false , " " , bdd, aut);
661
+ std::string formula_result = model_check_property (istracetodead, LTL, false , " " , bdd, aut);
645
662
std::size_t found = formula_result.rfind (" PASS" );
646
663
return (found != std::string::npos);
647
664
} else
@@ -658,37 +675,37 @@ bool model_has_noloops(std::string ltlf_alive_ap, spot::bdd_dict_ptr &bdd, spot:
658
675
* @param witness ask for a witness (if formula PASSes or counterexample if formula FAILs )
659
676
* @param out stream for collection the results
660
677
*
661
- * delegates checking of individual formulas to \see modelcheck_property
678
+ * delegates checking of individual formulas to \see model_check_property
662
679
*/
663
- void modelcheck_collection (std::istream &col_in, spot::bdd_dict_ptr &bdd, spot::parsed_aut_ptr &pa_ptr,
664
- std::string ltlf_alive_ap, bool originalandltlf, bool witness, std::ostream &out) {
680
+ void model_check_collection (std::istream &col_in, spot::bdd_dict_ptr &bdd, spot::parsed_aut_ptr &pa_ptr,
681
+ std::string ltlf_alive_ap, bool originalandltlf, bool witness, std::ostream &out) {
665
682
std::string formula_result;
666
683
std::string f;
667
684
bool tracetodead = model_has_noloops (ltlf_alive_ap, bdd, pa_ptr->aut );
668
685
while (getline (col_in, f)) {
669
686
if (f.empty ()) break ;
670
687
if (ltlf_alive_ap.length () == 0 ){
671
- formula_result = modelcheck_property (f, LTL, witness, " " , bdd, pa_ptr->aut );
688
+ formula_result = model_check_property (f, LTL, witness, " " , bdd, pa_ptr->aut );
672
689
out << formula_result;
673
690
}
674
691
else
675
692
if (originalandltlf) {
676
- formula_result = modelcheck_property (f, LTL, witness, " " , bdd, pa_ptr->aut );
693
+ formula_result = model_check_property (f, LTL, witness, " " , bdd, pa_ptr->aut );
677
694
out << formula_result;
678
- formula_result = modelcheck_property (f, LTLf, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
695
+ formula_result = model_check_property (f, LTLf, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
679
696
out << formula_result;
680
- formula_result = modelcheck_property (f, LTLfs, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
697
+ formula_result = model_check_property (f, LTLfs, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
681
698
out << formula_result;
682
- formula_result = modelcheck_property (f, LTLfl, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
699
+ formula_result = model_check_property (f, LTLfl, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
683
700
out << formula_result;
684
701
}
685
702
else
686
703
if (tracetodead) {
687
- formula_result = modelcheck_property (f, LTLf, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
704
+ formula_result = model_check_property (f, LTLf, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
688
705
out << formula_result;
689
706
}
690
707
else {
691
- formula_result = modelcheck_property (f, LTLfl, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
708
+ formula_result = model_check_property (f, LTLfl, witness, ltlf_alive_ap, bdd, pa_ptr->aut );
692
709
out << formula_result;
693
710
}
694
711
}
@@ -844,13 +861,13 @@ int main(int argc, char *argv[]) {
844
861
if (!formulafilename.empty ()) {
845
862
std::ifstream f_in;
846
863
f_in.open (formulafilename.c_str ());
847
- modelcheck_collection (f_in, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
864
+ model_check_collection (f_in, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
848
865
} else if (!formula.empty ()) {
849
866
std::istringstream s_in;
850
867
s_in.str (formula);
851
- modelcheck_collection (s_in, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
868
+ model_check_collection (s_in, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
852
869
} else
853
- modelcheck_collection (std::cin, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
870
+ model_check_collection (std::cin, bdd, pa, ltlf_alive_ap, not ltlxf.empty (), dowitness, std::cout);
854
871
} else {
855
872
std::cout << res << " \n " ;
856
873
std::cout << " === " << log_elapsedtime () << log_mem_usage () << " \n " ;
@@ -865,4 +882,6 @@ int main(int argc, char *argv[]) {
865
882
866
883
std::cout << " === LTL model-check End\n === " << log_elapsedtime () << log_mem_usage () << " \n " ;
867
884
return 0 ;
868
- }
885
+ }
886
+
887
+ // #pragma clang diagnostic pop
0 commit comments