|
FhSim
3.1.0
Marine systems simulation
|
| ID | 0440 |
| Class | ARCHITECTURE |
| Severity | 1 |
| Status | ready |
Models: —
Found: 2026-11-03, feature me-structure (review item A13)
ATTACH_SPHERE is a visualization-only macro. src/cable/subroutines/InternalCable.h:33 defines it (#define ATTACH_SPHERE, after its includes). src/cable/subroutines/CableElBasics.h:25 undefines it under FH_VISUALIZATION (# undef ATTACH_SPHERE). src/net/NetElement3N.h:31 has it commented out (//#define ATTACH_SPHERE). The macro guards members of the visualization classes (CableElBasics.h:279, InternalCable.h:445) and code in CableElBasics.cpp:831,883, InternalCable.cpp:825,873 and NetElement3N.cpp (#ifdef ATTACH_SPHERE).
So its value in a translation unit depends on which header the unit includes first: CableElBasics.h first leaves it undefined, InternalCable.h defines it once its own includes (which reach CableElBasics.h) are done. A class whose layout depends on a macro with a different value in different units is an ODR hazard. It is not always on, so it was not removed with RENDER_OUTLINE, RENDER_MESH and CCableElDynStiff_USE_MEAN_TENSION_FILTER.
Only with FH_VISUALIZATION. A unit that sees another value than the unit that defines the class reads or writes members at the wrong offsets. No test builds the visualization, so the risk is not exercised.
Decide whether the sphere end markers are wanted. If yes, define the macro in one place (a CMake definition of the visualization build) and delete the #undef. If no, delete the macro and its guarded code.
A visualization build with a static_assert on sizeof of the cable element classes in the units that use them.
Visualization output only. Result files do not change.