epezent / implot

Immediate Mode Plotting
MIT License
4.66k stars 520 forks source link

Static analyzers warnings #320

Closed ocornut closed 2 years ago

ocornut commented 2 years ago

Courtesy of PVS Studio:

implot_internal.h:532 | High | V730 | Not all members of a class (ImPlotTick) are initialized inside the constructor. Consider inspecting: PixelPos.
implot_internal.h:885 | High | V730 | Not all members of a class (ImPlotLegend) are initialized inside the constructor. Consider inspecting: PreviousLocation.
implot_internal.h:903 | High | V730 | Not all members of a class (ImPlotItemGroup) are initialized inside the constructor. Consider inspecting: ID.
implot_internal.h:860 | High | V730 | Not all members of a class (ImPlotItem) are initialized inside the constructor. Consider inspecting: Color.
implot_internal.h:1045 | High | V730 | Not all members of a class (ImPlotSubplot) are initialized inside the constructor. Consider inspecting: ID, Flags, PreviousFlags, TempSizes.

Not "fixing" because there might be an intent/good reason for those, otherwise easy to fix.

ocornut commented 2 years ago

Some more:

General Analysis | imgui_tests | implot.cpp:965 | Medium | V1048 | The 'Tm.tm_mon' variable was assigned the same value. -- | -- | -- | -- | -- | -- General Analysis | imgui_tests | implot.cpp:966 | Medium | V1048 | The 'Tm.tm_mday' variable was assigned the same value. General Analysis | imgui_tests | implot.cpp:1149 | Medium | V557 | Array overrun is possible. The value of 'unit1' index could reach 8. General Analysis | imgui_tests | implot.cpp:4905 | Medium | V1004 | The 'axis.OrthoAxis' pointer was used unsafely after it was verified against nullptr. General Analysis | imgui_tests | implot.cpp:5276 | Medium | V560 | A part of conditional expression is always true: !clk. General Analysis | imgui_tests | implot.cpp:964 | Medium | V1048 | The 'Tm.tm_year' variable was assigned the same value. General Analysis | imgui_tests | implot_demo.cpp:95 | Medium | V1044 | Loop break conditions do not depend on the number of iterations. General Analysis | imgui_tests | implot_demo.cpp:739 | Medium | V601 | The bool type is implicitly cast to the float type. Inspect the second argument. General Analysis | imgui_tests | implot_demo.cpp:741 | Medium | V601 | The bool type is implicitly cast to the float type. Inspect the second argument. General Analysis | imgui_tests | implot_internal.h:629 | Medium | V730 | Not all members of a class are initialized inside the constructor. Consider inspecting: ID, RangeCond, PixelMin, PixelMax, LinM, LogD, ... General Analysis | imgui_tests | implot_internal.h:948 | Medium | V730 | It is possible that not all members of a class are initialized inside the constructor. Consider inspecting: ID. General Analysis | imgui_tests | implot_internal.h:1096 | Medium | V730 | It is possible that not all members of a class are initialized inside the constructor. Consider inspecting: RenderLine, RenderFill, RenderMarkerLine, RenderMarkerFill, HiddenCond. General Analysis | imgui_tests | implot_items.cpp:1044 | Medium | V547 | Expression 'marker != ImPlotMarker_None' is always true. General Analysis | imgui_tests | implot_items.cpp:1617 | Medium | V547 | Expression 'marker != ImPlotMarker_None' is always true.

Sorry for the spam, I thought I'd submit because not everyone may have access to PVS Studio or static analyzers (although there's now one in Visual Studio) maybe there's a bug lurking behind one of one. Otherwise feel free to close :)

epezent commented 2 years ago

Thanks Omar! Very thoughtful of you to share these. Will defintely address these.