Non-static local-only function in async_context_XXX implementations #2678

Closed
opened 2025-09-19 13:28:27 -05:00 by earlephilhower · 1 comment
earlephilhower commented 2025-09-19 13:28:27 -05:00 (Migrated from github.com)

When running some other code with extra GCC warnings enabled (-Wmissing-declaration) it looks like one function in the async_context_threadsafe_background C-object should be static

In file included from /home/earle/Arduino/hardware/pico/rp2040/cores/rp2040/sdkoverride/async_context_threadsafe_background.c:2:
/home/earle/Arduino/hardware/pico/rp2040/cores/rp2040/sdkoverride/../../../pico-sdk/src/rp2_common/pico_async_context/async_context_threadsafe_background.c:138:10: warning: no previous declaration for 'async_context_threadsafe_background_execute_sync' [-Wmissing-declarations]
  138 | uint32_t async_context_threadsafe_background_execute_sync(async_context_t *self_base, uint32_t (*func)(void *param), void *param) {
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This function is only used as a function pointer in the async_context_type_t struct and not defined in a header for external use (nor should it be, async_context_execute_sync is the proper interface). Other functions assigned to this struct are all static, so it looks like just an oversight.

The same non-static state for only the execute function is present in async_context_poll and async_context_freertos.

When running some other code with extra GCC warnings enabled (`-Wmissing-declaration`) it looks like one function in the `async_context_threadsafe_background` C-object should be `static` ```` In file included from /home/earle/Arduino/hardware/pico/rp2040/cores/rp2040/sdkoverride/async_context_threadsafe_background.c:2: /home/earle/Arduino/hardware/pico/rp2040/cores/rp2040/sdkoverride/../../../pico-sdk/src/rp2_common/pico_async_context/async_context_threadsafe_background.c:138:10: warning: no previous declaration for 'async_context_threadsafe_background_execute_sync' [-Wmissing-declarations] 138 | uint32_t async_context_threadsafe_background_execute_sync(async_context_t *self_base, uint32_t (*func)(void *param), void *param) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```` This function is only used as a function pointer in the `async_context_type_t` struct and not defined in a header for external use (nor should it be, `async_context_execute_sync` is the proper interface). Other functions assigned to this struct are all `static`, so it looks like just an oversight. The same non-static state for only the execute function is present in `async_context_poll` and `async_context_freertos`.
kilograham commented 2026-01-05 11:23:53 -06:00 (Migrated from github.com)

merged into develop

merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#2678
No description provided.