-
Notifications
You must be signed in to change notification settings - Fork 165
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
fix: some compiler warnings (func def. w/o decl.) #1887
Conversation
Signed-off-by: Federico Aponte <[email protected]>
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 { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
/milestone 0.18.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 426299fd69b031bed845ae8989cbde96516aefbd
|
[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 |
/unhold |
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?: