Skip to content

Fix warning shadowing result variable in the #define CHECK_ENUM #22

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

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

Conversation

ivan-v-kush
Copy link

@ivan-v-kush ivan-v-kush commented Jul 1, 2025

Hello, in the macros CHECK_ENUM we need to remove int, i.e. not create a result var. Or change a name to another.
I think, renaming is more safe

In file included from src/libkmip/libkmip/src/kmip.c:15: src/libkmip/libkmip/src/kmip.c: In function ‘kmip_decode_name’: ../../contrib/pg_tde/src/libkmip/libkmip/include/kmip.h:1414:9: warning: declaration of ‘result’ shadows a previous local [-Wshadow=compatible-local]
     int result = kmip_check_enum_value((A)->version, (B), (C)); \
         ^~~~~~
src/libkmip/libkmip/src/kmip.c:12759:5: note: in expansion of macro ‘CHECK_ENUM’
     CHECK_ENUM(ctx, KMIP_TAG_NAME_TYPE, value->type);
     ^~~~~~~~~~
src/libkmip/libkmip/src/kmip.c:12742:9: note: shadowed declaration is here
     int result = 0;
         ^~~~~~

```
In file included from src/libkmip/libkmip/src/kmip.c:15: src/libkmip/libkmip/src/kmip.c: In function ‘kmip_decode_name’: ../../contrib/pg_tde/src/libkmip/libkmip/include/kmip.h:1414:9: warning: declaration of ‘result’ shadows a previous local [-Wshadow=compatible-local]
     int result = kmip_check_enum_value((A)->version, (B), (C)); \
         ^~~~~~
src/libkmip/libkmip/src/kmip.c:12759:5: note: in expansion of macro ‘CHECK_ENUM’
     CHECK_ENUM(ctx, KMIP_TAG_NAME_TYPE, value->type);
     ^~~~~~~~~~
src/libkmip/libkmip/src/kmip.c:12742:9: note: shadowed declaration is here
     int result = 0;
         ^~~~~~
```
@lukin-oleksiy lukin-oleksiy self-requested a review July 3, 2025 09:32
@lukin-oleksiy
Copy link
Contributor

LGTM

@lukin-oleksiy lukin-oleksiy requested a review from dutow July 3, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants