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

chore(docs): replace IN and OUT macros with docs #1817

Merged
merged 3 commits into from
May 8, 2024

Conversation

Molter73
Copy link
Contributor

@Molter73 Molter73 commented Apr 30, 2024

What type of PR is this?

/kind cleanup

/kind documentation

Any specific area of the project related to this PR?

/area libscap-engine-bpf

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-source-plugin

/area libscap

/area libsinsp

/area tests

Does this PR require a change in the driver versions?

What this PR does / why we need it:

In scap.h, we have a couple of quite generic macros called IN and OUT that can very easily leak into adopter's code bases and wreak havoc (i.e: we actually had these macros override parameters in an auto-generated enum from protobufs that were literally called IN and OUT, giving very confusing compilation errors).

From my understanding, these macros are only used for documenting which parameters in a function are input and which are output. Since they are not consistently used, only appear in a handful of places in the codebase and the preprocessor is the devil's spawn, we should replace these macros with proper doxygen style string docs.

Alternatively, we could rename them to something like SCAP_IN and SCAP_OUT, so collision with adopters code would be harder, but I think removing them is the more sensible approach.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

This PR touches a bunch of different places in the code base, but it should only be removing the IN and OUT macros that normally expands to empty strings, so there should be no effective changes to code.

The added doc descriptions might not be specific enough, so any comments on how to improve them are more than welcomed.

Does this PR introduce a user-facing change?:

NONE

Copy link

Please double check driver/API_VERSION file. See versioning.

/hold

@leogr
Copy link
Member

leogr commented Apr 30, 2024

Please double check driver/API_VERSION file. See versioning.

/hold

Hey @Molter73

I believe this is a false positive. If I understood correctly, your PR is a no-op from the kernelspace<->userspace APIs backward compatibility perspective. Right?

@leogr
Copy link
Member

leogr commented Apr 30, 2024

cc @falcosecurity/libs-maintainers for visibility
/milestone 0.17.0

@poiana poiana added this to the 0.17.0 milestone Apr 30, 2024
@Molter73
Copy link
Contributor Author

Please double check driver/API_VERSION file. See versioning.
/hold

Hey @Molter73

I believe this is a false positive. If I understood correctly, your PR is a no-op from the kernelspace<->userspace APIs backward compatibility perspective. Right?

Yup, no actual code change should happen since the removed macros expand to empty strings anyways.

@leogr
Copy link
Member

leogr commented Apr 30, 2024

Please double check driver/API_VERSION file. See versioning.
/hold

Hey @Molter73
I believe this is a false positive. If I understood correctly, your PR is a no-op from the kernelspace<->userspace APIs backward compatibility perspective. Right?

Yup, no actual code change should happen since the removed macros expand to empty strings anyways.

👍
/unhold

@incertum
Copy link
Contributor

incertum commented May 7, 2024

I don't have any problems with these changes @leogr - let's wait to hear from the others.

@leogr
Copy link
Member

leogr commented May 8, 2024

it's good for me too. @Molter73 could you rebase pls? 🙏

Molter73 and others added 3 commits May 8, 2024 13:14
In scap.h, we have a couple of quite generic macros called IN and OUT
that can very easily leak into adopter's code bases and wreak havoc.

From my understanding, these macros are only used for documenting which
parameters in a function are input and which are output. Since they are
not consistently used, only appear in a handful of places in the
codebase and the preprocessor is the devil's spawn, we should replace
these macros with proper doxygen style string docs.

Signed-off-by: Mauro Ezequiel Moltrasio <[email protected]>
Co-authored-by: Olivier Valentin <[email protected]>
@Molter73 Molter73 force-pushed the remove-in-out-macros branch from 6bf09c3 to 16a9ded Compare May 8, 2024 11:17
@@ -199,7 +199,7 @@ void sinsp_evt_formatter::set_format(output_format of, const std::string& fmt)
j++;
msize++; // count ')'
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dang it, I didn't mean to commit whitespace changes 🤦🏻‍♂️

We really need to get formatting checked by CI.

Copy link
Member

Choose a reason for hiding this comment

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

I agree.

Anyway, considering the affected file name, the change is on topic 😜

@poiana poiana added the lgtm label May 8, 2024
@poiana
Copy link
Contributor

poiana commented May 8, 2024

LGTM label has been added.

Git tree hash: d01e0bf03fdbf9095cb8ef7f5efe03b06be67475

Copy link
Contributor

@incertum incertum 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 May 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: incertum, leogr, Molter73

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:
  • OWNERS [Molter73,incertum,leogr]

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 cdef274 into falcosecurity:master May 8, 2024
40 of 42 checks passed
@Molter73 Molter73 deleted the remove-in-out-macros branch May 8, 2024 12:55
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