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

Test code: fix wrong order in calloc call (-Wcalloc-transposed-args) #6

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

mkannwischer
Copy link
Contributor

The calloc API is void* calloc(size_t num, size_t size); gcc14 added a warning when usign sizeof(.) for the first argument, e.g., calloc(sizeof(sk_t), 1) generates a warning as it likely should be calloc(1, sizeof(sk_t)).

MAYO-C/apps/example.c: In function ‘example_mayo’: MAYO-C/apps/example.c:34:31: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
   34 |     sk_t *esk = calloc(sizeof(sk_t), 1);

This commit fixes those warnings by swapping the arguments.

@mkannwischer mkannwischer force-pushed the fix-calloc-transposed-args branch from 0eabccf to aa300a3 Compare December 9, 2024 01:32
The calloc API is void* calloc(size_t num, size_t size);
gcc14 added a warning when usign sizeof(.) for the first
argument, e.g., calloc(sizeof(sk_t), 1) generates a warning
as it likely should be calloc(1, sizeof(sk_t)).

MAYO-C/apps/example.c: In function ‘example_mayo’:
MAYO-C/apps/example.c:34:31: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
   34 |     sk_t *esk = calloc(sizeof(sk_t), 1);

This commit fixes those warnings by swapping the arguments.
@mkannwischer mkannwischer force-pushed the fix-calloc-transposed-args branch from aa300a3 to 751aaf6 Compare December 9, 2024 01:40
@mkannwischer mkannwischer merged commit bd9e97f into main Dec 9, 2024
6 checks passed
@mkannwischer mkannwischer deleted the fix-calloc-transposed-args branch December 9, 2024 01:53
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.

1 participant