Skip to content

Commit 164b453

Browse files
authored
Merge pull request #2537 from AlexandreSinger/feature-vqm2blif-warnings
[vqm2blif][Warnings] Removed std::regex and strncpy Warnings
2 parents 3e8d605 + 70c6970 commit 164b453

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

utils/vqm2blif/src/base/hard_block_recog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,7 @@ static std::string construct_hard_block_name(std::vector<std::string>*node_name_
17351735
static void identify_hard_block_port_name_and_index (t_parsed_hard_block_port_info* curr_hard_block_port, std::string curr_node_name_component)
17361736
{
17371737
// identifer to check whether the port defined in the current node name is a bus (ex. payload[1]~QIC_DANGLING_PORT_I)
1738-
std::regex port_is_a_bus ("(.*)[[]([0-9]*)\]~(?:.*)");
1738+
std::regex port_is_a_bus ("(.*)[[]([0-9]*)\\]~(?:.*)");
17391739

17401740
// identifier to check whether the current port defined in the current node name isn't a bus (ex. value~9490_I)
17411741
std::regex port_is_not_a_bus ("(.*)~(?:.*)");
@@ -1936,4 +1936,4 @@ bool sort_hard_blocks_by_valid_connections(t_hard_block instance_one, t_hard_blo
19361936

19371937
return ((instance_one.hard_block_ports_not_assigned) > (instance_two.hard_block_ports_not_assigned));
19381938

1939-
}
1939+
}

utils/vqm2blif/src/base/preprocess.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,8 +1914,9 @@ void duplicate_and_split_multiclock_blocks(t_module* module, vector<t_node*>& mu
19141914

19151915
char buf[50];
19161916
snprintf(buf, sizeof(char)*50, DUMMY_NET_NAME_FORMAT, dummy_net_count);
1917-
new_net->name = (char*) vtr::malloc(strlen(buf)+1);
1918-
strncpy(new_net->name, buf, strlen(buf)+1);
1917+
size_t new_net_name_length = strlen(buf) + 1;
1918+
new_net->name = (char*) vtr::malloc(new_net_name_length * sizeof(char));
1919+
strncpy(new_net->name, buf, new_net_name_length);
19191920
new_net->left = 0;
19201921
new_net->right = 0;
19211922
new_net->indexed = T_FALSE;

utils/vqm2blif/src/base/vqm2blif_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void verify_hard_block_type_name(string curr_hard_block_type_name){
6161
// Condition 1: the first charatcer must be a lowercase/uppercase alphabetical character. Or the first character can be a underscore.
6262
// Condition 2: The remaning characters must be a lowercase/uppercase alphabetical character, or a underscore, or a single digit number or the '$' character
6363
// the rules above are checked with the identifier below
64-
std::regex verilog_VHDL_naming_rules_one ("^[a-zA-Z_][a-zA-Z_\$0-9]*[a-zA-Z_\$0-9]$");
64+
std::regex verilog_VHDL_naming_rules_one ("^[a-zA-Z_][a-zA-Z_\\$0-9]*[a-zA-Z_\\$0-9]$");
6565

6666
// verilog names can also contain any characters, as long as they are escaped with a '\' at the start of the identifer. For example, \reset-
6767
// we check this using the identifier below

0 commit comments

Comments
 (0)