Commit 4ff1c36
[nrf fromlist] zperf: moving declaration of variable to top of function
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)1 parent 9ad6673 commit 4ff1c36
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
842 | 842 | | |
843 | 843 | | |
844 | 844 | | |
| 845 | + | |
845 | 846 | | |
846 | 847 | | |
847 | 848 | | |
| |||
909 | 910 | | |
910 | 911 | | |
911 | 912 | | |
912 | | - | |
| 913 | + | |
913 | 914 | | |
914 | 915 | | |
915 | 916 | | |
| |||
1076 | 1077 | | |
1077 | 1078 | | |
1078 | 1079 | | |
| 1080 | + | |
1079 | 1081 | | |
1080 | 1082 | | |
1081 | 1083 | | |
| |||
1142 | 1144 | | |
1143 | 1145 | | |
1144 | 1146 | | |
1145 | | - | |
| 1147 | + | |
1146 | 1148 | | |
1147 | 1149 | | |
1148 | 1150 | | |
| |||
0 commit comments