sys/{flash_utils,fmt}: add ACCESS() attribute#22374
Open
maribu wants to merge 1 commit into
Open
Conversation
- annotate functions using the `ACCESS()` macro with the `access` attribute so that GCC can emit proper `-Wstringop-overflow` warnings
mguetschow
reviewed
Jun 11, 2026
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); |
Contributor
There was a problem hiding this comment.
Isn't this the same argument as before that flash could have been smaller than n if NULL-terminated?
crasbe
reviewed
Jun 14, 2026
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. |
Contributor
There was a problem hiding this comment.
Suggested change
| * SPDX-FileCopyrightText: 2022 Otto-von-Guericke-Universität Magdeburg | |
| * SPDX-License-Identifier: LGPL-2.1-only |
Comment on lines
23
to
25
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c} | ||
| * #include "flash_utils.h" | ||
| * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Contributor
There was a problem hiding this comment.
Suggested change
| * ```c | |
| * #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 |
Contributor
There was a problem hiding this comment.
Suggested change
| * ## Usage |
| * No module needs to be selected, this is a header-only implementation that | ||
| * is always available. | ||
| * | ||
| * # Porting Code to Use `flash_utils` |
Contributor
There was a problem hiding this comment.
Suggested change
| * ## Porting Code to use `flash_utils` |
| * | ||
| * # Porting Code to Use `flash_utils` | ||
| * | ||
| * This is mainly targeting applications developers to ease developing apps |
Contributor
There was a problem hiding this comment.
Suggested change
| * This is mainly targeting application developers to ease developing apps |
| * @param[out] out Pointer to output buffer, or NULL | ||
| * @param[in] val Value to convert | ||
| * | ||
| * @return 8 |
Contributor
There was a problem hiding this comment.
Suggested change
| * @retval 8 in any case |
| * @param[out] out Pointer to output buffer, or NULL | ||
| * @param[in] val Value to convert | ||
| * | ||
| * @return 16 |
Contributor
There was a problem hiding this comment.
Suggested change
| * @retval 16 in any case |
| * 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 |
Contributor
There was a problem hiding this comment.
Suggested change
| * @param[in] n Maximum number of characters to consider |
| * @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. |
Contributor
There was a problem hiding this comment.
Suggested change
| * `YYYY-MM-DD\<separator\>HH:MM:SS` or `YYYY-MM-DD`. |
| /** | ||
| * @brief Convert an ISO 8601 time string to time structure | ||
| * | ||
| * This function parses a string in the format YYYY-MM-DD. |
Contributor
There was a problem hiding this comment.
Suggested change
| * This function parses a string in the format `YYYY-MM-DD`. |
Contributor
|
Oh great, GitHub eated the changes again :( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
ACCESS()macro with theaccessattribute so that GCC can emit proper-Wstringop-overflowwarningsTesting procedure
The CI will do this
Issues/PRs references
#22368
Declaration of AI-Tools / LLMs usage:
Same as in #22368