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 gcc 14.x builds #29

Open
wants to merge 2 commits into
base: openocd-cubeide-r6
Choose a base branch
from

Conversation

manujedi
Copy link

This should fix the warnings introduced with GCC 14 (?) -Werror=calloc-transposed-args and therefore breaks the builds

....
src/flash/nor/max32xxx.c: In function 'max32xxx_flash_bank_command':
src/flash/nor/max32xxx.c:90:30: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
   90 |         info = calloc(sizeof(struct max32xxx_flash_bank), 1);
      |                              ^~~~~~
src/flash/nor/max32xxx.c:90:30: note: earlier argument should specify number of elements, later size of each element
src/target/arc_jtag.c: In function 'arc_jtag_read_registers':
src/flash/nor/stm32f2x.c: In function 'stm32x_probe':
src/flash/nor/stellaris.c: In function 'stellaris_flash_bank_command':
src/target/arc_jtag.c:301:43: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  301 |         uint8_t *data_buf = calloc(sizeof(uint8_t), count * 4);
      |                                           ^~~~~~~
src/target/arc_jtag.c:301:43: note: earlier argument should specify number of elements, later size of each element
src/flash/nor/stldr_driver.c: In function 'stldr_parse':
src/flash/nor/stldr_driver.c:265:71: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  265 |                         struct stldr_section *section = calloc(sizeof(struct stldr_section), 1);
      |                                                                       ^~~~~~
src/flash/nor/stellaris.c:456:40: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  456 |         stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1);
  ...

Not sure if this PR is wanted. If there is a different fix from the openocd source simply close this PR.
I already opened a PR but did not sign the Contribution License Agreement, sorry i did not know about it.
Thanks!

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