Skip to content

Commit 187308d

Browse files
committed
Make delete calls not look like function calls.
If the argument to the delete keyword is parenthesized, it looks like a function call, which is confusing while reading. Signed-off-by: Henner Zeller <[email protected]>
1 parent 1fa012b commit 187308d

File tree

11 files changed

+47
-47
lines changed

11 files changed

+47
-47
lines changed

vpr/src/base/echo_files.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void setEchoFileEnabled(enum e_echo_files echo_option, bool value) {
4444

4545
void setEchoFileName(enum e_echo_files echo_option, const char* name) {
4646
if (echoFileNames[(int)echo_option] != nullptr) {
47-
delete[](echoFileNames[(int)echo_option]);
47+
delete[] echoFileNames[(int)echo_option];
4848
}
4949
echoFileNames[(int)echo_option] = new char[strlen(name) + 1];
5050
strcpy(echoFileNames[(int)echo_option], name);
@@ -140,7 +140,7 @@ void free_echo_file_info() {
140140
if (echoFileEnabled != nullptr) {
141141
for (i = 0; i < (int)E_ECHO_END_TOKEN; i++) {
142142
if (echoFileNames[i] != nullptr) {
143-
delete[](echoFileNames[i]);
143+
delete[] echoFileNames[i];
144144
}
145145
}
146146
delete[] echoFileNames;
@@ -155,7 +155,7 @@ void setOutputFileName(enum e_output_files ename, const char* name, const char*
155155
alloc_and_load_output_file_names(default_name);
156156
}
157157
if (outputFileNames[(int)ename] != nullptr) {
158-
delete[](outputFileNames[(int)ename]);
158+
delete[] outputFileNames[(int)ename];
159159
}
160160
outputFileNames[(int)ename] = new char[strlen(name) + 1];
161161
strcpy(outputFileNames[(int)ename], name);
@@ -189,7 +189,7 @@ void free_output_file_names() {
189189
if (outputFileNames != nullptr) {
190190
for (i = 0; i < (int)E_FILE_END_TOKEN; i++) {
191191
if (outputFileNames[i] != nullptr) {
192-
delete[](outputFileNames[i]);
192+
delete[] outputFileNames[i];
193193
outputFileNames[i] = nullptr;
194194
}
195195
}

vpr/src/draw/draw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ void free_draw_structs() {
544544
t_draw_coords* draw_coords = get_draw_coords_vars();
545545

546546
if (draw_coords != nullptr) {
547-
delete[](draw_coords->tile_x);
547+
delete[] draw_coords->tile_x;
548548
draw_coords->tile_x = nullptr;
549-
delete[](draw_coords->tile_y);
549+
delete[] draw_coords->tile_y;
550550
draw_coords->tile_y = nullptr;
551551
}
552552

vpr/src/pack/pb_type_graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ static void alloc_and_load_mode_interconnect(t_pb_graph_node* pb_graph_parent_no
828828
for (j = 0; j < num_input_pb_graph_node_sets; j++) {
829829
delete[] input_pb_graph_node_pins[j];
830830
}
831-
delete[](input_pb_graph_node_pins);
831+
delete[] input_pb_graph_node_pins;
832832
for (j = 0; j < num_output_pb_graph_node_sets; j++) {
833833
delete[] output_pb_graph_node_pins[j];
834834
}
@@ -1469,7 +1469,7 @@ static bool realloc_and_load_pb_graph_pin_ptrs_at_var(const int line_num,
14691469

14701470
if (prev_num_pins > 0) {
14711471
std::vector<t_pb_graph_pin*> temp(*pb_graph_pins, *pb_graph_pins + prev_num_pins);
1472-
delete[](*pb_graph_pins);
1472+
delete[] * pb_graph_pins;
14731473
*pb_graph_pins = new t_pb_graph_pin*[*num_pins];
14741474
for (i = 0; i < prev_num_pins; i++)
14751475
(*pb_graph_pins)[i] = temp[i];

vpr/src/place/place_macro.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,17 +424,17 @@ void free_placement_macros_structs() {
424424
unsigned int itype;
425425
if (f_idirect_from_blk_pin != nullptr) {
426426
for (itype = 1; itype < device_ctx.physical_tile_types.size(); itype++) {
427-
delete[](f_idirect_from_blk_pin[itype]);
427+
delete[] f_idirect_from_blk_pin[itype];
428428
}
429-
delete[](f_idirect_from_blk_pin);
429+
delete[] f_idirect_from_blk_pin;
430430
f_idirect_from_blk_pin = nullptr;
431431
}
432432

433433
if (f_direct_type_from_blk_pin != nullptr) {
434434
for (itype = 1; itype < device_ctx.physical_tile_types.size(); itype++) {
435-
delete[](f_direct_type_from_blk_pin[itype]);
435+
delete[] f_direct_type_from_blk_pin[itype];
436436
}
437-
delete[](f_direct_type_from_blk_pin);
437+
delete[] f_direct_type_from_blk_pin;
438438
f_direct_type_from_blk_pin = nullptr;
439439
}
440440
}

vpr/src/power/power_components.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void power_components_init() {
6060
*/
6161
void power_components_uninit() {
6262
auto& power_ctx = g_vpr_ctx.mutable_power();
63-
delete[](power_ctx.by_component.components);
63+
delete[] power_ctx.by_component.components;
6464
}
6565

6666
/**
@@ -375,13 +375,13 @@ void power_usage_lut(t_power_usage* power_usage, int lut_size, float transistor_
375375

376376
/* Free allocated memory */
377377
for (i = 0; i <= lut_size; i++) {
378-
delete[](internal_prob[i]);
379-
delete[](internal_dens[i]);
380-
delete[](internal_v[i]);
378+
delete[] internal_prob[i];
379+
delete[] internal_dens[i];
380+
delete[] internal_v[i];
381381
}
382-
delete[](internal_prob);
383-
delete[](internal_dens);
384-
delete[](internal_v);
382+
delete[] internal_prob;
383+
delete[] internal_dens;
384+
delete[] internal_v;
385385

386386
/* Callibration */
387387
callibration = power_ctx.commonly_used->component_callibration[POWER_CALLIB_COMPONENT_LUT];
@@ -507,8 +507,8 @@ void power_usage_local_interc_mux(t_power_usage* power_usage, t_pb* pb, t_interc
507507
}
508508
}
509509

510-
delete[](in_dens);
511-
delete[](in_prob);
510+
delete[] in_dens;
511+
delete[] in_prob;
512512
break;
513513
default:
514514
VTR_ASSERT(0);
@@ -561,7 +561,7 @@ void power_usage_mux_multilevel(t_power_usage* power_usage,
561561
mux_arch->mux_graph_head, mux_arch, selector_values, in_prob,
562562
in_dens, output_level_restored, period);
563563

564-
delete[](selector_values);
564+
delete[] selector_values;
565565

566566
callibration = power_ctx.commonly_used->component_callibration[POWER_CALLIB_COMPONENT_MUX];
567567
if (callibration->is_done_callibration()) {
@@ -625,11 +625,11 @@ static void power_usage_mux_rec(t_power_usage* power_usage, float* out_prob, flo
625625
power_add_usage(power_usage, &sub_power_usage);
626626

627627
if (mux_node->level != 0) {
628-
delete[](in_prob);
629-
delete[](in_dens);
628+
delete[] in_prob;
629+
delete[] in_dens;
630630
}
631631

632-
delete[](v_in);
632+
delete[] v_in;
633633
}
634634

635635
/**

vpr/src/power/power_sizing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static double power_count_transistors_mux(t_mux_arch* mux_arch) {
167167

168168
transistor_cnt += power_count_transistors_mux_node(mux_arch->mux_graph_head,
169169
mux_arch->transistor_size);
170-
delete[](max_inputs);
170+
delete[] max_inputs;
171171
return transistor_cnt;
172172
}
173173

@@ -773,8 +773,8 @@ static void power_size_pin_buffers_and_wires(t_pb_graph_pin* pin,
773773
* this_pb_interc_sidelength;
774774
}
775775

776-
delete[](fanout_per_mode);
777-
delete[](wirelength_out_per_mode);
776+
delete[] fanout_per_mode;
777+
delete[] wirelength_out_per_mode;
778778

779779
/* Input wirelength - from parent PB */
780780
if (!top_level_pb) {

vpr/src/route/route_timing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,11 +1045,11 @@ void free_timing_driven_route_structs(float* pin_criticality, int* sink_order, t
10451045
/* Frees all the structures needed only by the timing-driven router. */
10461046

10471047
// coverity[offset_free : Intentional]
1048-
delete[](pin_criticality);
1048+
delete[] pin_criticality;
10491049
// coverity[offset_free : Intentional]
1050-
delete[](sink_order);
1050+
delete[] sink_order;
10511051
// coverity[offset_free : Intentional]
1052-
delete[](rt_node_of_sink);
1052+
delete[] rt_node_of_sink;
10531053

10541054
free_route_tree_timing_structs();
10551055
}

vpr/src/route/rr_graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ static void build_rr_graph(const t_graph_type graph_type,
12941294
track_to_pin_lookup_x.clear();
12951295
track_to_pin_lookup_y.clear();
12961296
if (clb_to_clb_directs != nullptr) {
1297-
delete[](clb_to_clb_directs);
1297+
delete[] clb_to_clb_directs;
12981298
}
12991299
}
13001300

@@ -3952,8 +3952,8 @@ static t_clb_to_clb_directs* alloc_and_load_clb_to_clb_directs(const t_direct_in
39523952
//Use the delayless switch by default
39533953
clb_to_clb_directs[i].switch_index = delayless_switch;
39543954
}
3955-
delete[](tile_name);
3956-
delete[](port_name);
3955+
delete[] tile_name;
3956+
delete[] port_name;
39573957
}
39583958

39593959
return clb_to_clb_directs;
@@ -4186,7 +4186,7 @@ static std::vector<bool> alloc_and_load_perturb_opins(const t_physical_tile_type
41864186
perturb_opins[0] = false;
41874187
}
41884188
}
4189-
delete[](prime_factors);
4189+
delete[] prime_factors;
41904190

41914191
return perturb_opins;
41924192
}

vpr/src/route/rr_graph_area.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,17 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
284284
} /* End switch on from_rr_type */
285285
} /* End for all nodes */
286286

287-
delete[](cblock_counted);
288-
delete[](shared_buffer_trans);
289-
delete[](unsharable_switch_trans);
290-
delete[](sharable_switch_trans);
287+
delete[] cblock_counted;
288+
delete[] shared_buffer_trans;
289+
delete[] unsharable_switch_trans;
290+
delete[] sharable_switch_trans;
291291

292292
/* Now add in the input connection block transistors. */
293293

294294
input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch,
295295
max_inputs_to_cblock, trans_sram_bit);
296296

297-
delete[](num_inputs_to_cblock);
297+
delete[] num_inputs_to_cblock;
298298

299299
ntrans_sharing += input_cblock_trans;
300300
ntrans_no_sharing += input_cblock_trans;
@@ -485,8 +485,8 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
485485
input_cblock_trans = get_cblock_trans(num_inputs_to_cblock, wire_to_ipin_switch,
486486
max_inputs_to_cblock, trans_sram_bit);
487487

488-
delete[](cblock_counted);
489-
delete[](num_inputs_to_cblock);
488+
delete[] cblock_counted;
489+
delete[] num_inputs_to_cblock;
490490

491491
ntrans += input_cblock_trans;
492492

@@ -528,7 +528,7 @@ static float get_cblock_trans(int* num_inputs_to_cblock, int wire_to_ipin_switch
528528
trans_count += trans_per_cblock[num_inputs];
529529
}
530530

531-
delete[](trans_per_cblock);
531+
delete[] trans_per_cblock;
532532
return (trans_count);
533533
}
534534

vpr/src/route/rr_graph_timing_params.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void add_rr_graph_C_from_switches(float C_ipin_cblock) {
201201
mutable_device_ctx.rr_graph_builder.set_node_rc_index(rr_id, NodeRCIndex(find_create_rr_rc_data(rr_graph.node_R(rr_id), rr_node_C[(size_t)rr_id], mutable_device_ctx.rr_rc_data)));
202202
}
203203

204-
delete[](Couts_to_add);
205-
delete[](cblock_counted);
206-
delete[](buffer_Cin);
204+
delete[] Couts_to_add;
205+
delete[] cblock_counted;
206+
delete[] buffer_Cin;
207207
}

vpr/src/util/vpr_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ void free_pb_stats(t_pb* pb) {
15981598
pb->pb_stats->num_pins_of_net_in_pb.clear();
15991599

16001600
if (pb->pb_stats->feasible_blocks) {
1601-
delete[](pb->pb_stats->feasible_blocks);
1601+
delete[] pb->pb_stats->feasible_blocks;
16021602
}
16031603
if (!pb->parent_pb) {
16041604
pb->pb_stats->transitive_fanout_candidates.clear();

0 commit comments

Comments
 (0)