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

fix: some compiler warnings (func def. w/o decl.) #1887

Conversation

federico-sysdig
Copy link
Contributor

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:
Remove some compiler warnings on functions being defined without a prior declaration.
This happens with newer compilers that have more in-depth static code checks. In this case it is enough to define the functions as static, they are used only within the compilation unit anyway.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
Copy link

Please double check driver/SCHEMA_VERSION file. See versioning.

/hold


static int32_t scap_gvisor_init_platform(scap_platform* platform, char* lasterr, scap_engine_handle engine, struct scap_open_args* oargs)
namespace {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious: why are you suggesting an anonymous namespace rather than C-style static functions? Was there a compiler warning for it? Is there a specific reason? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They should be equivalent, they give the function internal linkage. I have read on advice to prefer anonymous namespaces for reasons I can't recall, but I suppose it's more a fashion than a deep technical reason.
For this reason in this case I could (should?) have kept the static. I probably made it like this because it's more uniform with another PR I have created where the anonymous namespace was created to put inside a class definition that had a duplicate name so that the duplication could be handled by the linker.
Not a problem if you prefer to keep the old syntax, the only advantage here could be a shorter function signature to read.
FTR, the definition of the object scap_gvisor_engine has been put inside the extern "C" as its declaration elsewhere is inside such a block.

@LucaGuerra
Copy link
Contributor

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone May 31, 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: 426299fd69b031bed845ae8989cbde96516aefbd

@poiana poiana added the approved label Jun 4, 2024
@poiana
Copy link
Contributor

poiana commented Jun 4, 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

@FedeDP
Copy link
Contributor

FedeDP commented Jun 4, 2024

/unhold

@poiana poiana merged commit 7472524 into falcosecurity:master Jun 4, 2024
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants