Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: class definitions with duplicate names #1886

Merged

Conversation

federico-sysdig
Copy link
Contributor

@federico-sysdig federico-sysdig commented May 30, 2024

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area build

Does this PR require a change in the driver versions?
No

What this PR does / why we need it:
The struct plugin_state is defined several times with different definitions in different compilation units. This would not be a problem, but if you try to apply link-time optimization (LTO) the linker complains and raises an error because the one-definition rule (ODR) has been broken. The fix is easy, the duplicate definitions are only used within their .cpp file and can be enclosed in an anonymous namespace, so that they'll have internal linkage.
This is one of several changes to make falcosecurity-libs (and its client code) amenable to LTO, should one want to experiment with it. There are other such cases that will be handled in other PR's.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

  • Some minor cleanup has been performed to prefer an explicit reinterpret_cast rather than an generic C-style cast and similar.
  • The word static has been removed from functions that fell inside the anonymous namespace as this already gives them internal linkage.

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
@federico-sysdig federico-sysdig force-pushed the fix-duplicate-class-definitions branch from b3edf06 to 3233a22 Compare May 30, 2024 17:06
@FedeDP
Copy link
Contributor

FedeDP commented Jun 3, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Jun 3, 2024
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Jun 4, 2024

LGTM label has been added.

Git tree hash: c7afe1021aa0d89352f9f574fbd1789d36527ed4

@poiana poiana added the approved label Jun 4, 2024
@federico-sysdig
Copy link
Contributor Author

@hbrueckner @LucaGuerra
Any chance you can review this?

@poiana
Copy link
Contributor

poiana commented Jun 24, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, federico-sysdig, LucaGuerra

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@poiana poiana merged commit c3900a9 into falcosecurity:master Jun 24, 2024
40 checks passed
@FedeDP FedeDP mentioned this pull request Aug 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants