Add an ENABLE_LTO option to make link-time optimization configurable on
while keeping it enabled by default.
This allows builds that require LTO to be disabled (add -DENABLE_LTO=OFF),
including builds for Coverity static analysis, without changing the default
optimization settings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add a CMake cppcheck module that provides a new "make cppcheck" target
for running cppcheck against the project and generating a html report.
Use compile_commands.json for analysis, ensure generated Qt sources exist
before analysis, support project suppressions and parallel execution, and
generate an HTML report when cppcheck-htmlreport is available.
Cppcheck remains optional and is only required when BUILD_CPPCHECK is
enabled.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Modernize deprecated CMake usage and correct package-name mismatches
reported by newer CMake versions. Replace exec_program() with
execute_process(), use PkgConfig through find_package() while retaining
fallback discovery, and align find_package_handle_standard_args() names
with their corresponding find_package() calls.
This removes most CMake developer warnings without changing the intended
dependency discovery behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Address cppcheck warnings by checking fopen() results before using the
returned file handles and reporting the underlying error on failure.
This prevents null file handles from being passed to fprintf() and
fclose(), avoiding a potential crash when test output files cannot be
created.
Explicitly convert RRC filter coefficients to double for fprintf() to
match the %f format specifier.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Use the validated bandwidth index when accessing bandwidth tables in the
ChirpChat, MeshCore, and Meshtastic channel GUIs. The previous code used the
raw UI value after clamping it into m_bandwidthIndex, allowing negative or
out-of-range array accesses.
Found by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_rollupState to nullptr in the constructor and set
m_autoNbSymbolsMax to false in resetToDefaults(). This ensures the optional
rollup state pointer and the automatic message length setting have defined
initial values rather than relying on uninitialized storage.
Pointed out by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_radiotext_AB_flag in the RDSParser constructor to ensure the
radio text state is defined before the first Group 2 update.
Keep the flag out of clearUpdateFlags() because it is persistent parser state,
not a transient update flag. Resetting it when update flags are cleared could
incorrectly appear as an A/B transition and cause stale radio text handling.
Pointed out by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Zero-initialize the pilot PLL sample buffer used by BFMDemodSink.
This ensures all four PLL sample values have defined initial values
before they are consumed by the FM stereo processing path and removes
the uninitialized member warning reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the field and vertical sync detection sample counters and
the previous sample value in ATVDemodSink.
This gives the video synchronization state defined initial values when
the sink is constructed and removes the uninitialized member warnings
reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the channel pointer to nullptr and zero-initialize the
synchronous AM demodulation buffer in AMDemodSink.
This ensures both members have defined values when the sink is
constructed and removes the uninitialized member warnings reported by
cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the m_bytes buffer to zero so all elements have defined
values when an AISDemodSink is constructed.
Detected by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_matchColumn and m_autoTarget in the NotificationSettings
constructor rather than assigning m_matchColumn in the constructor body.
This ensures both members are initialized before the constructor body
executes and removes the uninitialized m_autoTarget member.
Detected by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Value-initialize the Interogator airspace member so it has a defined
state when an Interogator is constructed.
Found by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the CPR latitude and longitude state when an Aircraft is
created so the position data has defined values before the first CPR
calculation.
Found by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>