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 build with -Werror=calloc-transposed-args #144

Conversation

mrc0mmand
Copy link
Member

Fix build with -Werror=calloc-transposed-args

calloc() expects the number of elements as the first argument, and the
size of each element as the second one. Recent-enough gcc/clang started
warning about this, so let's fix the order of the arugments to avoid
build errors with -Werror.

[9/30] Compiling C object dfuzzer.p/src_suppression.c.o
../src/suppression.c: In function ‘df_suppression_load’:
../src/suppression.c:123:37: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
  123 |                 item = calloc(sizeof(*item), 1);
      |                                     ^
../src/suppression.c:123:37: note: earlier argument should specify number of elements, later size of each element

Resolves #143

calloc() expects the number of elements as the first argument, and the
size of each element as the second one. Recent-enough gcc/clang started
warning about this, so let's fix the order of the arugments to avoid
build errors with -Werror.

[9/30] Compiling C object dfuzzer.p/src_suppression.c.o
../src/suppression.c: In function ‘df_suppression_load’:
../src/suppression.c:123:37: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
  123 |                 item = calloc(sizeof(*item), 1);
      |                                     ^
../src/suppression.c:123:37: note: earlier argument should specify number of elements, later size of each element

Resolves dbus-fuzzer#143
@evverx evverx merged commit ade83ef into dbus-fuzzer:master May 2, 2024
24 checks passed
@mrc0mmand mrc0mmand deleted the fix-build-with-Werror-calloc-transposed-args branch May 2, 2024 12:03
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.

dfuzzer fails to compile on Fedora 40
2 participants