Skip to content

Drop dead control flow: empty conditionals, redundant zero-init, identical arg-parse branches #1491

Description

@sbryngelson

Several independent dead-control-flow cleanups. All verified on current master.

1. src/pre_process/m_check_patches.fpp:505-506 — empty conditional:

if (chemistry) then
end if

No body. Remove (or add the intended chemistry constraint check).

2. src/common/m_checker_common.fpp:62-63 — empty preprocessor block:

#ifndef MFC_POST_PROCESS
#endif

No content between guard and #endif. Remove.

3. src/simulation/m_riemann_solvers.fpp:1813-1824 — redundant second zero-init. rho_L, gamma_L, pi_inf_L, qv_L, rho_R, gamma_R, pi_inf_R, qv_R, alpha_L_sum, alpha_R_sum are set to 0._wp at lines 1795-1800, then set to 0._wp again at 1813-1824. Between 1800 and 1813 only vel_L/vel_R, vel_L_rms/vel_R_rms and pres_L/pres_R are written — none of the re-zeroed variables is read in that gap. Remove 1813-1824. (This sits inside the HLLC #:for-generated loop, so a fix should remove all instances generated from the same template.)

4. toolchain/mfc/args.py:128-137:

  • Lines 128-131: elif name == "build": runs parse_known_args([]), identical to the else: branch — collapse into a single else.
  • Line 137: args[key] = args.get(key) is a no-op self-assignment for key == "input". Drop the special-case.

5. toolchain/mfc/viz/interactive.py — dead iso-caps plumbing. _build_3d (def line 654) takes parameter _iso_caps (line 670) but never reads it in the body. Yet the UI wires a full path to it: the iso-caps checklist (line 1224), the Dash Input("iso-caps","value") (1634), and both render call sites compute bool(iso_caps and "caps" in iso_caps) (lines 1922, 2174) and pass it in. Net effect: the iso-caps toggle does nothing. Needs a maintainer decision — either remove the dead parameter + UI plumbing, or implement iso-surface caps in _build_3d. (This is the one sub-item that isn't purely mechanical.)

Output-neutrality: items 1-4 are pure dead-code removals (item 3 re-zeros already-zero variables). Item 5: removing the plumbing is output-neutral; implementing it would be a feature.


Filed from a repo-wide code-cleanliness review; verified against master @ 40dde5e.

Code references

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions