Skip to content

Initialized enums that might not be assigned depending on NO_GRAPHICS macro #2187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vpr/src/place/place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ static e_move_result try_swap(const t_annealing_state* state,
crit_params.crit_exponent = state->crit_exponent;
crit_params.crit_limit = placer_opts.place_crit_limit;

e_move_type move_type; //move type number
e_move_type move_type = e_move_type::UNIFORM; //move type number

num_ts_called++;

Expand Down Expand Up @@ -1462,7 +1462,7 @@ static e_move_result try_swap(const t_annealing_state* state,
rlim = state->rlim;
}

e_create_move create_move_outcome;
e_create_move create_move_outcome = e_create_move::ABORT;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move the #ifndef NO_GRAPHICS here and the #endif after "} else" and before the "if" in line 1472 so that the manual_move_enabled will only be checked if the graphics are enabled (NO_GRAPHICS isn't defined). Then, create_move_outcome will be initialized in all the cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzeller : any thoughts on Mohamed's comment? I'm OK with merging as is, but if you and @MohamedElgammal have a better fix please make the change now so we fix this one way or the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the suggestion, but I am busy with other things currently, so if we merge it now, I leave it to @MohamedElgammal to do another PR to improve the situation.

//When manual move toggle button is active, the manual move window asks the user for input.
if (manual_move_enabled) {
Expand All @@ -1481,7 +1481,7 @@ static e_move_result try_swap(const t_annealing_state* state,
++move_type_stat.num_moves[(int)move_type];
LOG_MOVE_STATS_PROPOSED(t, blocks_affected);

e_move_result move_outcome = ABORTED;
e_move_result move_outcome = e_move_result::ABORTED;

if (create_move_outcome == e_create_move::ABORT) {
LOG_MOVE_STATS_OUTCOME(std::numeric_limits<float>::quiet_NaN(),
Expand Down