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: c99 array designators used in C++ #1693

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

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:
Fixes c99 array designators used in C++ and causing a warning. There is a warning suppression for these few cases that is also removed. As some of these arrays were defined in a header file, which can be potentially included in a C++ source file, the definition has been split from the declaration and moved to a new C file. Some re-arrangement of the enums used for the array designators was also needed.
I noticed also some global variables defined in a header file. They are now declared as inline to avoid potential duplication when the header is used in more than one source file.
Lastly, the compiler was warning about an unused data member that has been removed.

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>
@poiana
Copy link
Contributor

poiana commented Feb 15, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: federico-sysdig
Once this PR has been reviewed and has the lgtm label, please assign molter73 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@@ -71,6 +71,7 @@ limitations under the License.
#include <libsinsp/sinsp_suppress.h>
#include <libsinsp/state/table_registry.h>
#include <libsinsp/stats.h>
#include <libsinsp/stats_v2_resource_utilization.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

@federico-sysdig suggestion instead of touching the stats and adding a new header file, would it be ok to move those changes to the refactor PR we have here: #1652 Open to however you would like to go about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Absolutely. I am open to several ways to proceed. If you want to integrate these changes into the other PR, I can close this as superseded. I have no interest on the "paternity" of this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Great let's do this then. If you leave this commit and add another one on top we can come back to it later in the other PR. Ty!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm lost. What should I do? I can let this PR lag behind the other one and merge later on once it has been merged. Or you can integrate some of these changes into the other PR. Or what?

Copy link
Contributor

Choose a reason for hiding this comment

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

If ok, revert anything that touched the stats, but ok to leave it in the history. I can port them over to the other PR later. That way we do not block all other changes here and keep the larger metrics refactor in one place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is an array initializer in stats.cpp that uses c99 array designators, if I revert that I also need to revert the warning suppression and the PR would lose its purpose and a second PR would be needed.
This PR isn't critical. It can wait as much time as #1652 needs to be merged. I'll then patch this up for the new situation and ask you to review. Take your time, I've put this as draft for the moment.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok let's do this then, ty!

@incertum
Copy link
Contributor

/hold until #1652 is merged.

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.

None yet

4 participants