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: warning format #1592

Merged

Conversation

perigoso
Copy link
Contributor

@perigoso perigoso commented Aug 10, 2023

Detailed description

Fix some warnings for -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation

See #1590 for context

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

@perigoso perigoso mentioned this pull request Aug 10, 2023
43 tasks
@dragonmux dragonmux added the Enhancement General project improvement label Aug 13, 2023
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, and particularly the fixes and cleanup in the HostIO code. It'll be nice to eliminate some more UB and get things better sorted out.

There are some changes we'd like to see made in the hostio_reply() code though and a query over format string changes involving enums. Hopefully we can find a suitable solution with the latter though.

src/gdb_hostio.c Outdated Show resolved Hide resolved
src/gdb_hostio.c Outdated Show resolved Hide resolved
src/platforms/hosted/cmsis_dap.c Outdated Show resolved Hide resolved
@dragonmux dragonmux added this to the v1.10 milestone Aug 13, 2023
@perigoso perigoso force-pushed the fix/warning-format-signedness branch 3 times, most recently from b70229f to 59492bd Compare August 17, 2023 11:14
@perigoso
Copy link
Contributor Author

perigoso commented Aug 17, 2023

Reverted changes to enum type format specifiers, given the discussion in the review comments, for now let's reduce the scope of this PR and address the enum type issue separately

A note about format specifiers was added to HACKING.md, note that it was quickly thrown together and might not be optimal, suggestions are welcome

@perigoso perigoso force-pushed the fix/warning-format-signedness branch 2 times, most recently from 8bc3677 to 741ce51 Compare August 17, 2023 11:27
@perigoso perigoso requested a review from dragonmux August 17, 2023 11:27
@perigoso perigoso force-pushed the fix/warning-format-signedness branch from 741ce51 to b1fc7fc Compare August 17, 2023 19:37
Copy link
Contributor

@amyspark amyspark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @perigoso ! @dragonmux showed me this PR, good job! Just found some grammar and typo nitpicks to share with you.

src/target/HACKING.md Outdated Show resolved Hide resolved
src/target/HACKING.md Outdated Show resolved Hide resolved
src/target/HACKING.md Outdated Show resolved Hide resolved
src/target/HACKING.md Outdated Show resolved Hide resolved
src/target/HACKING.md Outdated Show resolved Hide resolved
@perigoso perigoso force-pushed the fix/warning-format-signedness branch from e3feb5a to 271d889 Compare August 18, 2023 23:56
Co-authored-by: amyspark <amy@amyspark.me>
@perigoso perigoso force-pushed the fix/warning-format-signedness branch from 271d889 to 38789dd Compare August 19, 2023 00:10
@perigoso
Copy link
Contributor Author

perigoso commented Aug 19, 2023

Hey @amyspark, thank you for the review and suggestions! 😃

I made a small change to the way it's formatted after applying the the changes, since the "note" "directive" moved inline, the break in the middle felt out of place, so I removed it.

I think I'm happy with this as is.

Copy link
Contributor

@amyspark amyspark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to poke @dragonmux to give it the final thumbs up!

Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you Amy for the SPaG pass on the hacking guide change, and thank you Perigoso for putting together such a good PR that fixes so many subtle things.

Merging! The only change here that needs testing, we don't have the capability right now to test.. and that's the HostIO code. It looks correct though, so that's going to have to do with the community giving us feedback.

Comment on lines +107 to +108
- `uint8_t`: `PRIx8`
- `uint16_t`: `PRIx16`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd probably just use %x for these, given integer promotion, but you are correct that technically we should be using the PRI macros everywhere on all fixed-width integer types, especially with raw types in new code being forbidden because using the raw types is non-portable for width constraints.

That said, this isn't a blocker, so we'll merge with this in.

@dragonmux dragonmux merged commit a0ac3fa into blackmagic-debug:main Aug 19, 2023
@perigoso perigoso deleted the fix/warning-format-signedness branch August 19, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement General project improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants