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

lib/posix-environ: Remove unused variable warnings #1058

Closed

Conversation

mogasergiu
Copy link
Member

@mogasergiu mogasergiu commented Aug 16, 2023

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): [all]
  • Platform(s): [all]
  • Application(s): [all]

Additional configuration

Description of changes

If an environment variable is not set, the
DECLARE_LIBPOSIX_ENVIRON_ENV_VAR macros end up declaring unused global variables which generate warnings.

To solve this, guard the use of these macros so that they are not used for a particular unset environment variable.

If an environment variable is not set, the
`DECLARE_LIBPOSIX_ENVIRON_ENV_VAR` macros end up declaring unused
global variables which generate warnings.

To solve this, guard the use of these macros so that they are not used
for a particular unset environment variable.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
@mogasergiu mogasergiu requested a review from a team as a code owner August 16, 2023 18:02
@razvand razvand self-assigned this Aug 16, 2023
@razvand razvand requested review from michpappas and removed request for a team August 16, 2023 18:22
@razvand razvand added this to the v0.14.0 (Prometheus) milestone Aug 16, 2023
@razvand razvand added topic/posix Topics pertaining to POSIX standard lang/c Issues or PRs to do with C/C++ kind/build-warning Issue or PR is related with a build warning labels Aug 16, 2023
@unikraft-bot
Copy link
Member

Checkpatch passed

Beep boop! I ran Unikraft's checkpatch.pl support script on your pull request and it all looks good!

SHA commit checkpatch
0748626 lib/posix-environ: Remove unused variable warnings

@unikraft-bot unikraft-bot added the area/lib Internal Unikraft Microlibrary label Aug 16, 2023
Copy link
Member

@michpappas michpappas left a comment

Choose a reason for hiding this comment

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

An alternative would had been to use __maybe_unused in the declaration macro. I guess it doesn't matter too much though as these are wrapped around conditionally below a few times already.

Reviewed-by: Michalis Pappas michalis@unikraft.io

@skuenzer skuenzer self-assigned this Aug 16, 2023
Copy link
Member

@skuenzer skuenzer left a comment

Choose a reason for hiding this comment

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

Approved-by: Simon Kuenzer simon@unikraft.io

@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary ci/merged Merged by CI kind/build-warning Issue or PR is related with a build warning lang/c Issues or PRs to do with C/C++ topic/posix Topics pertaining to POSIX standard
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

5 participants