<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/15112">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix builds on Ubuntu 16.04<br><br>The most recent commits introduced 'C99' syntax by declaring variables<br>inside the 'for' statement itself, rather than before.<br><br>This resulted in compile failures in the Ubuntu 16.04 builds on<br>build.opensuse.org:<br><br>[  105s] libcommon/source/usb.c: In function 'SIMtrace_USB_Initialize':<br>[  105s] libcommon/source/usb.c:679:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {<br>[  105s]   ^<br>[  105s] libcommon/source/usb.c:679:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code<br>[  105s] libcommon/source/usb.c:686:15: error: redefinition of 'i'<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {<br>[  105s]                ^<br>[  105s] libcommon/source/usb.c:679:15: note: previous definition of 'i' was here<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {<br>[  105s]                ^<br>[  105s] libcommon/source/usb.c:686:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {<br>[  105s]   ^<br>[  105s] libcommon/source/usb.c:692:15: error: redefinition of 'i'<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {<br>[  105s]                ^<br>[  105s] libcommon/source/usb.c:686:15: note: previous definition of 'i' was here<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {<br>[  105s]                ^<br>[  105s] libcommon/source/usb.c:692:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode<br>[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {<br>[  105s]   ^<br>[  105s] Makefile:227: recipe for target 'obj/simtrace/flash_usb.o' faile<br><br>Change-Id: Ibdb837ac105664484b10873c2c0d9561051b1c2a<br>---<br>M firmware/libcommon/source/usb.c<br>1 file changed, 4 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/12/15112/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/libcommon/source/usb.c b/firmware/libcommon/source/usb.c</span><br><span>index 3efb9fc..9d3072f 100644</span><br><span>--- a/firmware/libcommon/source/usb.c</span><br><span>+++ b/firmware/libcommon/source/usb.c</span><br><span>@@ -653,7 +653,7 @@</span><br><span> </span><br><span> void SIMtrace_USB_Initialize(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+   unsigned int i;</span><br><span>      /* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */</span><br><span> #ifdef PIN_USB_PULLUP</span><br><span>        const Pin usb_dp_pullup = PIN_USB_PULLUP;</span><br><span>@@ -676,20 +676,20 @@</span><br><span>    char device_id_string[32 + 1];</span><br><span>       snprintf(device_id_string, ARRAY_SIZE(device_id_string), "%08x%08x%08x%08x",</span><br><span>               device_id[0], device_id[1], device_id[2], device_id[3]);</span><br><span style="color: hsl(0, 100%, 40%);">-        for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+   for (i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {</span><br><span>          usb_string_serial[2 + 2 * i] = device_id_string[i];</span><br><span>  }</span><br><span> </span><br><span>        // put version into USB string</span><br><span>       usb_string_version[0] = USBStringDescriptor_LENGTH(ARRAY_SIZE(git_version) - 1);</span><br><span>     usb_string_version[1] = USBGenericDescriptor_STRING;</span><br><span style="color: hsl(0, 100%, 40%);">-    for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+        for (i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {</span><br><span>               usb_string_version[2 + i * 2 + 0] = git_version[i];</span><br><span>          usb_string_version[2 + i * 2 + 1] = 0;</span><br><span>       }</span><br><span> </span><br><span>        // fill extended USB strings</span><br><span style="color: hsl(0, 100%, 40%);">-    for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+ for (i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {</span><br><span>                usb_strings_extended[i] = usb_strings[i];</span><br><span>    }</span><br><span>    usb_strings_extended[SERIAL_STR] = usb_string_serial;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/15112">change 15112</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/simtrace2/+/15112"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ibdb837ac105664484b10873c2c0d9561051b1c2a </div>
<div style="display:none"> Gerrit-Change-Number: 15112 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>