Skip to content

Commit e441a33

Browse files
committed
suppressed specific un-needed performance compiler warnings
1 parent a65dc20 commit e441a33

File tree

1 file changed

+37
-18
lines changed

1 file changed

+37
-18
lines changed

spot_checker.cpp

+37-18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#pragma clang diagnostic push
2+
#pragma ide diagnostic ignored "performance-for-range-copy"
3+
#pragma ide diagnostic ignored "performance-unnecessary-value-param"
14
/** \file
25
This TESTAR wrapper for interfacing to the SPOT library consists of a single C++ sourcecode file,
36
with imperative function calls to subroutines.
@@ -35,6 +38,8 @@ namespace fs = std::experimental::filesystem;
3538
const std::string version = "20201024"; /**< version of the application */ // NOLINT(cert-err58-cpp)
3639
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)
3740

41+
#pragma clang diagnostic push
42+
#pragma ide diagnostic ignored "OCDFAInspection"
3843
/**
3944
* Find the position of the matching closing parenthesis ')'
4045
* @param data string to search
@@ -58,6 +63,7 @@ int findClosingParenthesis(std::string &data, int openPos) {
5863
}
5964
return closePos;
6065
}
66+
#pragma clang diagnostic pop
6167
/**
6268
* Find the position of the matching opening parenthesis '('
6369
* (search from right to left)
@@ -107,6 +113,8 @@ void findAndReplaceAll(std::string &data, std::string toSearch, std::string repl
107113
}
108114
}
109115

116+
#pragma clang diagnostic push
117+
#pragma ide diagnostic ignored "performance-inefficient-string-concatenation"
110118
/**
111119
* Find any matching substring and surround all occurrences with 'replacestring' + 'substring' + 'closing'
112120
*
@@ -136,6 +144,9 @@ void findClosingParenthesisAndInsert(std::string &data, std::string toSearch, st
136144
pos = data.find(toSearch, pos + toSearch.size() + replaceStr.size() + orginalblock.size() + closing.size());
137145
}
138146
}
147+
#pragma clang diagnostic pop
148+
#pragma clang diagnostic push
149+
#pragma ide diagnostic ignored "performance-inefficient-string-concatenation"
139150
/**
140151
* Find any matching substring and surround all occurrences with 'replacestring' + 'substring' + 'closing'
141152
* (search from right to left)
@@ -166,6 +177,7 @@ void findOpeningParenthesisAndInsert(std::string &data, std::string toSearch, st
166177
bracketpos + opening.size() + orginalblock.size() + replaceStr.size() + toSearch.size());
167178
}
168179
}
180+
#pragma clang diagnostic pop
169181

170182
/**
171183
* Get the system time as a string
@@ -235,6 +247,8 @@ std::string log_mem_usage()
235247
}
236248

237249
//
250+
#pragma clang diagnostic push
251+
#pragma ide diagnostic ignored "abseil-string-find-startswith"
238252
/**
239253
* Simple commandline parser.
240254
* @param argc number of arguments on the commandline
@@ -270,6 +284,7 @@ std::string getCmdOption(int argc, char *argv[], const std::string &option, bool
270284
}
271285
return cmd;
272286
}
287+
#pragma clang diagnostic pop
273288

274289
/**
275290
* 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) {
458473
}
459474
}
460475

476+
461477
/**
462478
* Model checks a single LTL formula on the Buchi automaton
463479
* This function checks the syntax of the formula and
@@ -472,9 +488,9 @@ std::string getAutomatonTitle(spot::twa_graph_ptr &aut) {
472488
* @param aut buchi automaton
473489
* @return multiline string with PASS or FAIL information, timing and counterexample traces.
474490
*/
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) {
478494

479495
std::ostringstream sout; //needed for capturing output of run.
480496
sout << "=== Formula\n";
@@ -572,6 +588,7 @@ std::string modelcheck_property(std::string formula, char ltlftype, bool witness
572588
}
573589
return sout.str();
574590
}
591+
575592
/**
576593
* Verifies whether the formula has a valid LTL syntax
577594
*
@@ -641,7 +658,7 @@ bool model_has_noloops(std::string ltlf_alive_ap, spot::bdd_dict_ptr &bdd, spot:
641658
if (ltlf_alive_ap.length() != 0) {
642659
//alive U G(!alive): the 'U' makes that !alive or dead is required in all paths.
643660
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);
645662
std::size_t found = formula_result.rfind("PASS");
646663
return (found != std::string::npos);
647664
} else
@@ -658,37 +675,37 @@ bool model_has_noloops(std::string ltlf_alive_ap, spot::bdd_dict_ptr &bdd, spot:
658675
* @param witness ask for a witness (if formula PASSes or counterexample if formula FAILs )
659676
* @param out stream for collection the results
660677
*
661-
* delegates checking of individual formulas to \see modelcheck_property
678+
* delegates checking of individual formulas to \see model_check_property
662679
*/
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) {
665682
std::string formula_result;
666683
std::string f;
667684
bool tracetodead = model_has_noloops(ltlf_alive_ap, bdd, pa_ptr->aut);
668685
while (getline(col_in, f)) {
669686
if (f.empty()) break;
670687
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);
672689
out << formula_result;
673690
}
674691
else
675692
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);
677694
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);
679696
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);
681698
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);
683700
out << formula_result;
684701
}
685702
else
686703
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);
688705
out << formula_result;
689706
}
690707
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);
692709
out << formula_result;
693710
}
694711
}
@@ -844,13 +861,13 @@ int main(int argc, char *argv[]) {
844861
if (!formulafilename.empty()) {
845862
std::ifstream f_in;
846863
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);
848865
} else if (!formula.empty()) {
849866
std::istringstream s_in;
850867
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);
852869
} 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);
854871
} else {
855872
std::cout << res << "\n";
856873
std::cout << "=== " << log_elapsedtime() << log_mem_usage() << "\n";
@@ -865,4 +882,6 @@ int main(int argc, char *argv[]) {
865882

866883
std::cout << "=== LTL model-check End\n=== " << log_elapsedtime() << log_mem_usage() << "\n";
867884
return 0;
868-
}
885+
}
886+
887+
//#pragma clang diagnostic pop

0 commit comments

Comments
 (0)