Skip to content

sys/can: annotate functions with ACCESS()#22382

Open
maribu wants to merge 2 commits into
RIOT-OS:masterfrom
maribu:sys/can/add-access-attribute
Open

sys/can: annotate functions with ACCESS()#22382
maribu wants to merge 2 commits into
RIOT-OS:masterfrom
maribu:sys/can/add-access-attribute

Conversation

@maribu

@maribu maribu commented Jun 14, 2026

Copy link
Copy Markdown
Member

Contribution description

Use the ACCESS() macro to annotate functions so that GCC can provide better diagnostics for -Wstringop-overflow.

Testing procedure

The CI will do this

Issues/PRs references

#22380

Declaration of AI-Tools / LLMs usage:

Same as in #22380

Use the `ACCESS()` macro to annotate functions so that GCC can provide
better diagnostics for `-Wstringop-overflow`.
@maribu maribu added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 14, 2026
@github-actions github-actions Bot added the Area: sys Area: System label Jun 14, 2026
@riot-ci

riot-ci commented Jun 14, 2026

Copy link
Copy Markdown

Murdock results

✔️ PASSED

dfd38c1 fixup! sys/can: annotate functions with ACCESS()

Success Failures Total Runtime
11124 0 11124 12m:42s

Artifacts

@maribu

maribu commented Jun 15, 2026

Copy link
Copy Markdown
Member Author

Adding the one const did result in quite a few more const being required. The API doc in all the cases said @param[in], so the const should be correct - if the API doc is correct.

@crasbe crasbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't want to go all out again, but maybe we can use the opportunity to reduce the long-line static-test debt a bit 😅

Comment thread sys/can/dll.c
}

static int register_filter_entry(can_reg_entry_t *entry, struct can_filter *filter, void *param)
static int register_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
static int register_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param)
static int register_filter_entry(can_reg_entry_t *entry,
const struct can_filter *filter, void *param)

Comment thread sys/can/dll.c
}

static int unregister_filter_entry(can_reg_entry_t *entry, struct can_filter *filter, void *param)
static int unregister_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
static int unregister_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param)
static int unregister_filter_entry(can_reg_entry_t *entry,
const struct can_filter *filter, void *param)

Comment thread sys/can/dll.c
}

int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param)
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param)
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter,
kernel_pid_t pid, void *param)

Comment thread sys/can/dll.c

#ifdef MODULE_CAN_MBOX
int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param)
int raw_can_subscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
int raw_can_subscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param)
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter,
kernel_pid_t pid, void *param)

Comment thread sys/can/dll.c

#ifdef MODULE_CAN_MBOX
int raw_can_unsubscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param)
int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param)
int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter,
mbox_t *mbox, void *param)

Comment thread sys/include/can/raw.h
* @return < 0 on error
*/
int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param);
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param);
int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter,
kernel_pid_t pid, void *param);

Comment thread sys/include/can/raw.h
Comment on lines 82 to 83
* This function must be called if a user thread @p pid wants to receive the CAN frame matching @p filter
* on the interface @p ifnum.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* This function must be called if a user thread @p pid wants to receive the
* CAN frame matching @p filter on the interface @p ifnum.

Comment thread sys/include/can/raw.h
*
* This function must be called if a user thread waiting on @p mbox wants to receive
* the CAN frame matching @p filter on the interface @p ifnum.
* The user thread will then receive msg via mailbox IPC on reception of frame matching @p filters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The user thread will then receive msg via mailbox IPC on reception of
* frame matching @p filters.

Comment thread sys/include/can/raw.h
Comment on lines 252 to 254
* @return 0 on success
* @return 1 if the bitrate/sample_point couple can not be reached precisely but the bitrate is set
* @return < 0 on error

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @retval 0 on success
* @retval 1 if the bitrate/sample_point couple can not be reached precisely
* but the bitrate is set
* @retval <0 on error

* @param[in] master the master connection
* @param[in,out] slave the slave connection to initialize
*/
static inline void conn_can_isotp_init_slave(conn_can_isotp_t *master, conn_can_isotp_slave_t *slave)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
static inline void conn_can_isotp_init_slave(conn_can_isotp_t *master,
conn_can_isotp_slave_t *slave)

@maribu maribu added the AI: Helped PR/Issue uses AI sparingly, e.g. code inline assistant, debugging with AI, etc. label Jul 6, 2026
@crasbe crasbe added the State: waiting for author State: Action by the author of the PR is required label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Helped PR/Issue uses AI sparingly, e.g. code inline assistant, debugging with AI, etc. Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR State: waiting for author State: Action by the author of the PR is required Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants