Skip to content

Conversation

@benpicco
Copy link
Contributor

Backport of #21884

Contribution description

The test data is not intended to be a zero terminated C string. Just
a bunch of bytes that are easy to trace with a logic analyzer, in
case someone as to debug a test failure.

Testing procedure

In master

$ make BOARD=arduino-mega2560 -C tests/periph/selftest_shield
make: Entering directory '/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield'
Building application "tests_selftest_shield" for "arduino-mega2560" with CPU "atmega2560".

/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/main.c:175:33: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (9 chars into 8 available) [-Werror=unterminated-string-initialization]
  175 | static const char testdata[8] = "Selftest";
      |                                 ^~~~~~~~~~
cc1: all warnings being treated as errors

This PR

$ make BOARD=arduino-mega2560 -C tests/periph/selftest_shield
make: Entering directory '/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield'
Building application "tests_selftest_shield" for "arduino-mega2560" with CPU "atmega2560".
[...]
   text	   data	    bss	    dec	    hex	filename
  17260	    202	    981	  18443	   480b	/home/maribu/Repos/software/RIOT/master/tests/periph/selftest_shield/bin/arduino-mega2560/tests_selftest_shield.elf

Issues/PRs references

None

The test data is not intended to be a zero terminated C string. Just
a bunch of bytes that are easy to trace with a logic analyzer, in
case someone as to debug a test failure.

(cherry picked from commit d96a5a3)
Starting from clang 21 (see [release notes][1]) clang also supports
`-Wunterminated-string-initialization` and the corresponding
`__attribute__((nonstring))`. Hence, also provide `NONSTRING` as the
corresponding `__attribute__((nonstring))` for clang starting with
clang version 21.

[1]: https://releases.llvm.org/21.1.0/tools/clang/docs/ReleaseNotes.html

(cherry picked from commit 0998112)
@benpicco benpicco added the Area: core Area: RIOT kernel. Handle PRs marked with this with care! label Nov 21, 2025
@benpicco benpicco added Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 21, 2025
@benpicco benpicco requested a review from kaspar030 as a code owner November 21, 2025 14:00
@benpicco benpicco added Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Nov 21, 2025
@benpicco benpicco requested review from crasbe and maribu November 21, 2025 14:00
@maribu maribu enabled auto-merge November 21, 2025 14:03
@riot-ci
Copy link

riot-ci commented Nov 21, 2025

Murdock results

✔️ PASSED

967183a core/lib/compiler_hints: Make NONSTRING CLANG compatible

Success Failures Total Runtime
10558 0 10560 13m:59s

Artifacts

@maribu maribu added this pull request to the merge queue Nov 21, 2025
Merged via the queue into RIOT-OS:2025.10-branch with commit 349dbb1 Nov 21, 2025
32 checks passed
@benpicco benpicco added this to the Release 2025.10 milestone Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants