Skip to content
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

Add copy constructor & assignment operator to acl_device_binary_t #236

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

IlanTruanovsky
Copy link
Contributor

@IlanTruanovsky IlanTruanovsky commented Jan 5, 2023

Add default copy constructor to acl_device_binary_t to fix a Coverity issue.

Coverity issue:

include/acl_device_binary.h:25:7:
  Type: Missing assignment operator (MISSING_COPY_OR_ASSIGN)

@pcolberg
Copy link
Contributor

pcolberg commented Jan 5, 2023

Thanks @IlanTruanovsky for tackling this. Unless there is a specific reason to have a copyable object, you may = delete the default copy constructor and assignment operator. This may then result in a compiler error where accidental copies are made, which should be replaced with references as needed.

@pcolberg pcolberg added the bug Something isn't working label Jan 5, 2023
@pcolberg pcolberg added this to the 2023.2 milestone Jan 5, 2023
@IlanTruanovsky IlanTruanovsky changed the title Add copy constructor to acl_device_binary_t Add copy constructor & assignment operator to acl_device_binary_t Jan 5, 2023
@pcolberg
Copy link
Contributor

pcolberg commented Jan 6, 2023

@IlanTruanovsky It's been a while, but I submitted a fix for the same issue in #207 and ran into this Klocwork issue. Klocwork's analysis is flawed here since the returned value is a reference into m_split_device_binaries, not a reference to a local variable. Since Klocwork is being phased out, we should go ahead and merge despite the Klocwork false positive. @zibaiwan, what do you think?

Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IlanTruanovsky. This looks good; you can drop the extra empty lines since this code is boilerplate.

@IlanTruanovsky IlanTruanovsky marked this pull request as ready for review January 6, 2023 21:21
@zibaiwan
Copy link
Contributor

zibaiwan commented Jan 6, 2023

@IlanTruanovsky It's been a while, but I submitted a fix for the same issue in #207 and ran into this Klocwork issue. Klocwork's analysis is flawed here since the returned value is a reference into m_split_device_binaries, not a reference to a local variable. Since Klocwork is being phased out, we should go ahead and merge despite the Klocwork false positive. @zibaiwan, what do you think?

Thanks @pcolberg for catching this false positive. I agree we should merge it.

Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IlanTruanovsky. You can go ahead and squash the commits together into a single commit and force-push your branch. Revise the commit subject to match the actual changes, and in the commit message state why the change was done (to fix a Coverity issue).

Necessary to fix a coverity issue
Copy link
Contributor

@pcolberg pcolberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IlanTruanovsky!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants