laforge submitted this change.

View Change


Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
firmware/layer1: avoid 'for' loop initial declarations

As was reported by roox, osmocom-bb currently fails to build on OBS:

https://build.opensuse.org/build/home:mnhauke:osmocom:nightly/openSUSE_Tumbleweed/x86_64/osmocom-bb/_log

[ 24s] layer1/prim_tch.c: In function 'l1s_tch_meas_avg':
[ 24s] layer1/prim_tch.c:183:2: error: 'for' loop initial declarations are only allowed in C99 mode
[ 24s] layer1/prim_tch.c:183:2: note: use option -std=c99 or -std=gnu99 to compile your code

We don't specify the C standard explicitly, so let's move the variable
declaration out of the for-loop in l1s_tch_meas_avg().

Change-Id: I6c65fbead4e612c81728e9c6601d5f2107616ee6
Fixes: 7286560a3 "firmware/layer1: fill-in DL info for L1CTL TRAFFIC.ind"
---
M src/target/firmware/layer1/prim_tch.c
1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c
index a33cb58..1bc842b 100644
--- a/src/target/firmware/layer1/prim_tch.c
+++ b/src/target/firmware/layer1/prim_tch.c
@@ -179,8 +179,9 @@
{
uint32_t avg_snr = 0;
int32_t avg_dbm8 = 0;
+ unsigned int i;

- for (unsigned int i = 0; i < meas_num; i++) {
+ for (i = 0; i < meas_num; i++) {
int j = (rx_tch.meas_id + FACCH_MEAS_HIST - i) % FACCH_MEAS_HIST;
avg_snr += rx_tch.meas[j].snr;
avg_dbm8 += rx_tch.meas[j].pm_dbm8;

To view, visit change 35080. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I6c65fbead4e612c81728e9c6601d5f2107616ee6
Gerrit-Change-Number: 35080
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged