Skip to content

Conversation

bryghtlabs-richard
Copy link
Contributor

@bryghtlabs-richard bryghtlabs-richard commented Oct 3, 2025

Description

Fixes "error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]"

Related

Blocking CI run of #715

Testing

I don't have a great way to test this - it's a fix to allocation failure handling, but those allocation failures don't often occur on our products.

On the current FreeRTOS + newlib-libc, failing asprintf() sets strp=NULL, so this patch isn't expected to have a functional impact today, just fix the compiler errors and would improve portability on potential future platforms.

I did test by backporting and flashing onto our products - no functional impact.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

cursor[bot]

This comment was marked as outdated.

asprintf()'s return value:
    When successful, these functions return the number of bytes
    printed, just like sprintf(3).  On error, -1 is returned, errno is
    set to indicate the error, and the contents of strp are undefined.

Fixes the following:
    error: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
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