dependabot-core
dependabot-core copied to clipboard
Fix `calloc-transposed-args` with `prism`
GCC 14 was release on 7th May^1. It introduced a new warning -Wcalloc-transposed-args^2 designd to raise a warning when the arguments to calloc were given in the wrong order.
Unfortunately, prism version 0.24.0 made this mistake. Attempting to bundle install Dependabot gives the error:
src/diagnostic.c: In function ‘pm_diagnostic_list_append’:
src/diagnostic.c:328:69: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
328 | pm_diagnostic_t *diagnostic = (pm_diagnostic_t *) calloc(sizeof(pm_diagnostic_t), 1);
| ^~~~~~~~~~~~~~~
src/diagnostic.c:328:69: note: earlier argument should specify number of elements, later size of each element
src/diagnostic.c: In function ‘pm_diagnostic_list_append_format’:
src/diagnostic.c:359:69: error: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
359 | pm_diagnostic_t *diagnostic = (pm_diagnostic_t *) calloc(sizeof(pm_diagnostic_t), 1);
| ^~~~~~~~~~~~~~~
src/diagnostic.c:359:69: note: earlier argument should specify number of elements, later size of each element
cc1: all warnings being treated as errors
The issue was logged upstream in https://github.com/ruby/prism/issues/2645, fixed in https://github.com/ruby/prism/pull/2648, and released in https://github.com/ruby/prism/releases/tag/v0.25.0.
This change upgrades prism, by way of upgrading rbi, and resolves the compile error.