Skip to content

Commit 08f054c

Browse files
georgkrylovjeanlego
authored andcommitted
ODIN_II: Changes to fix coverity scan errors
The commit addresses several errors CID 212805: API usage errors (PRINTF_ARGS) Related to verilog-to-routing#1496 Signed-off-by: Georgiy Krylov <[email protected]>
1 parent 469ab56 commit 08f054c

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

ODIN_II/SRC/MixingOptimization.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,20 @@
3434

3535
void MixingOpt::scale_counts() {
3636
if (this->_blocks_count < 0 || this->_blocks_count == INT_MAX || this->_ratio < 0.0 || this->_ratio > 1.0) {
37-
error_message(NETLIST, unknown_location, "%s",
38-
"The parameters for optimization kind:%i are configured incorrectly : count %i, ratio %f\n", this->_kind, this->_blocks_count, this->_ratio);
37+
error_message(NETLIST, unknown_location, "The parameters for optimization kind:%i are configured incorrectly : count %i, ratio %f\n", this->_kind, this->_blocks_count, this->_ratio);
3938
exit(0);
4039
}
4140
this->_blocks_count = this->_blocks_count * this->_ratio;
4241
}
4342

4443
void MixingOpt::assign_weights(netlist_t* /*netlist*/, std::vector<nnode_t*> /*nodes*/) {
4544
// compute weights for all noted nodes
46-
error_message(NETLIST, unknown_location, "%s",
47-
"Assign_weights mixing optimization was called for optimization without specification provided, for kind %i\n", this->_kind);
45+
error_message(NETLIST, unknown_location, "Assign_weights mixing optimization was called for optimization without specification provided, for kind %i\n", this->_kind);
4846
exit(0);
4947
}
5048

5149
void MixingOpt::perform(netlist_t*, std::vector<nnode_t*>&) {
52-
error_message(NETLIST, unknown_location, "%s",
53-
"Performing mixing optimization was called for optimization without method provided, for kind %i\n", this->_kind);
50+
error_message(NETLIST, unknown_location, "Performing mixing optimization was called for optimization without method provided, for kind %i\n", this->_kind);
5451
exit(0);
5552
}
5653

@@ -63,8 +60,7 @@ MultsOpt::MultsOpt(int _exact)
6360
MultsOpt::MultsOpt(float ratio)
6461
: MixingOpt(ratio, MULTIPLY) {
6562
if (ratio < 0.0 || ratio > 1.0) {
66-
error_message(NETLIST, unknown_location, "%s",
67-
"Miltipliers mixing optimization is started with wrong ratio %f\n", ratio);
63+
error_message(NETLIST, unknown_location, "Miltipliers mixing optimization is started with wrong ratio %f\n", ratio);
6864
exit(0);
6965
}
7066

@@ -144,14 +140,12 @@ void MultsOpt::set_blocks_needed(int new_count) {
144140
this->scale_counts();
145141
}
146142
void MixingOpt::instantiate_soft_logic(netlist_t* /*netlist*/, std::vector<nnode_t*> /* nodes*/) {
147-
error_message(NETLIST, unknown_location, "%s",
148-
"Performing instantiate_soft_logic was called for optimization without method provided, for kind %i\n", this->_kind);
143+
error_message(NETLIST, unknown_location, "Performing instantiate_soft_logic was called for optimization without method provided, for kind %i\n", this->_kind);
149144
exit(0);
150145
}
151146

152147
void MixingOpt::partial_map_node(nnode_t* /*node*/, short /*traverse_value*/, netlist_t*, /*netlist*/ HardSoftLogicMixer* /*mixer*/) {
153-
error_message(NETLIST, unknown_location, "%s",
154-
"Performing partial_map_node was called for optimization without method provided, for kind %i\n", this->_kind);
148+
error_message(NETLIST, unknown_location, "Performing partial_map_node was called for optimization without method provided, for kind %i\n", this->_kind);
155149
exit(0);
156150
}
157151

ODIN_II/SRC/include/MixingOptimization.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class MixingOpt {
138138
* @brief this variable allows to cache traverse value
139139
*
140140
*/
141-
short cached_traverse_value;
141+
short cached_traverse_value = 0;
142142

143143
// an integer representing the number of required hard blocks
144144
// that should be estimated and updated through set blocks needed

ODIN_II/SRC/netlist_statistic.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ void mixing_optimization_stats(nnode_t* node, netlist_t* netlist) {
8282
break;
8383
}
8484
default:
85-
error_message(NETLIST, unknown_location, "%s",
86-
"Counting weights for mixing optimization for %i: Hard block type is unimplemented", node->type);
85+
error_message(NETLIST, unknown_location, "Counting weights for mixing optimization for %i: Hard block type is unimplemented", node->type);
8786
break;
8887
}
8988
}

0 commit comments

Comments
 (0)