Skip to content

Fix more cppcheck indicated duplicate inherited methods and members #3357

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 1 commit into from
Mar 2, 2025

Conversation

BsAtHome
Copy link
Contributor

There were several more cppcheck warnings in NML message type implementations where the update() method was duplicated in a derived class. This is fine because it cannot be virtual and the sub-class calls the base-class. This was also the case for the get_address() method.

A slightly more serious problem was indicated by cppcheck where there were duplicate inherited members. These are allocated and hide the other name. This PR prefixes the base-class member with '_' (underscore) and fixes the code to address the fallout. Removing the duplicate member, as for example the case with instances of 'spindle', are not an option because it would change the in-memory layout of the shared memory. Other name collisions, like 'type' or 'state' would cause the code to become non-functional if folded. The members must be present as each version has separate functionality.

The last few cppcheck duplicate inherited member warnings will be addressed in a separate PR.

The findings in NML so far do suggest that it may be wise to start thinking to modernize the code and maybe migrate libnml to libzmq (like for example suggested in #2722 and touched in #2803).

Rename duplicate inherited members in base-class prefixing with '_'.
@andypugh andypugh merged commit 5fe48a6 into LinuxCNC:master Mar 2, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants