Skip to content

Conversation

NordicBuilder
Copy link
Contributor

Backport 25e27e3 from #2741.

Declaration of variables after a label inside a switch statement is a
c23 extension, not c99.

This results in the following warning when compiling with clang:
> .../subsys/net/lib/zperf/zperf_shell.c:912:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>   912 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> .../subsys/net/lib/zperf/zperf_shell.c:1145:4: warning: label followed
>                by a declaration is a C23 extension [-Wc23-extensions]
>  1145 |                      int seconds = parse_arg(&i, argc, argv);
>       |                         ^
> 2 warnings generated.

There are no practical reasons why the variable should be declared
inside the switch statement, therefore move the declaration and place it
together with declaration of other variables.

Upstream PR #: 88403

Signed-off-by: Torsten Rasmussen <[email protected]>
(cherry picked from commit 25e27e3)
Copy link

@carlescufi carlescufi merged commit 4ff1c36 into v4.0.99-ncs1-branch Apr 11, 2025
22 checks passed
carlescufi added a commit to carlescufi/sdk-nrf that referenced this pull request Apr 11, 2025
carlescufi added a commit to nrfconnect/sdk-nrf that referenced this pull request Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants