Skip to content

sys/{flash_utils,fmt}: add ACCESS() attribute#22374

Open
maribu wants to merge 1 commit into
RIOT-OS:masterfrom
maribu:sys/fmt_flash_utils/add-access-attribute
Open

sys/{flash_utils,fmt}: add ACCESS() attribute#22374
maribu wants to merge 1 commit into
RIOT-OS:masterfrom
maribu:sys/fmt_flash_utils/add-access-attribute

Conversation

@maribu

@maribu maribu commented Jun 10, 2026

Copy link
Copy Markdown
Member

Contribution description

  • annotate functions using the ACCESS() macro with the access attribute so that GCC can emit proper -Wstringop-overflow warnings

Testing procedure

The CI will do this

Issues/PRs references

#22368

Declaration of AI-Tools / LLMs usage:

Same as in #22368

- annotate functions using the `ACCESS()` macro with the `access`
  attribute so that GCC can emit proper `-Wstringop-overflow` warnings
@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 10, 2026
@github-actions github-actions Bot added the Area: sys Area: System label Jun 10, 2026
@riot-ci

riot-ci commented Jun 10, 2026

Copy link
Copy Markdown

Murdock results

✔️ PASSED

dfbd2d3 sys/{flash_utils,fmt}: add ACCESS() attribute

Success Failures Total Runtime
11123 0 11124 14m:41s

Artifacts

Comment thread sys/include/flash_utils.h
Comment on lines +110 to 111
ACCESS(read_only, 2, 3)
int flash_strncmp(const char *ram, FLASH_ATTR const char *flash, size_t n);

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.

Isn't this the same argument as before that flash could have been smaller than n if NULL-terminated?

Comment thread sys/include/flash_utils.h
Comment on lines 2 to 6
* Copyright (C) 2022 Otto-von-Guericke-Universität Magdeburg
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.

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
* SPDX-FileCopyrightText: 2022 Otto-von-Guericke-Universität Magdeburg
* SPDX-License-Identifier: LGPL-2.1-only

Comment thread sys/include/flash_utils.h
Comment on lines 23 to 25
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}
* #include "flash_utils.h"
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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
* ```c
* #include "flash_utils.h"
* ```

Comment thread sys/include/flash_utils.h
* that map flash into the data address space (e.g. ARM) and those which
* doesn't (e.g. most AVR, Xtensa).
*
* # Usage

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
* ## Usage

Comment thread sys/include/flash_utils.h
* No module needs to be selected, this is a header-only implementation that
* is always available.
*
* # Porting Code to Use `flash_utils`

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
* ## Porting Code to use `flash_utils`

Comment thread sys/include/flash_utils.h
*
* # Porting Code to Use `flash_utils`
*
* This is mainly targeting applications developers to ease developing apps

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 is mainly targeting application developers to ease developing apps

Comment thread sys/include/fmt.h
* @param[out] out Pointer to output buffer, or NULL
* @param[in] val Value to convert
*
* @return 8

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 8 in any case

Comment thread sys/include/fmt.h
* @param[out] out Pointer to output buffer, or NULL
* @param[in] val Value to convert
*
* @return 16

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 16 in any case

Comment thread sys/include/fmt.h
* Will convert up to @p n digits. Stops at any non-digit or '\0' character.
*
* @param[in] str Pointer to string to read from
* @param[in] n Maximum nr of characters to consider

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
* @param[in] n Maximum number of characters to consider

Comment thread sys/include/fmt.h
* @brief Convert an ISO 8601 string to time structure
*
* This function parses a string in the format
* YYYY-MM-DD\<separator\>HH:MM:SS or YYYY-MM-DD.

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
* `YYYY-MM-DD\<separator\>HH:MM:SS` or `YYYY-MM-DD`.

Comment thread sys/include/fmt.h
/**
* @brief Convert an ISO 8601 time string to time structure
*
* This function parses a string in the format YYYY-MM-DD.

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 parses a string in the format `YYYY-MM-DD`.

@crasbe

crasbe commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Oh great, GitHub eated the changes again :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR 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