Change in ...simtrace2[master]: Fix builds on Ubuntu 16.04

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 8 08:21:07 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/15112


Change subject: Fix builds on Ubuntu 16.04
......................................................................

Fix builds on Ubuntu 16.04

The most recent commits introduced 'C99' syntax by declaring variables
inside the 'for' statement itself, rather than before.

This resulted in compile failures in the Ubuntu 16.04 builds on
build.opensuse.org:

[  105s] libcommon/source/usb.c: In function 'SIMtrace_USB_Initialize':
[  105s] libcommon/source/usb.c:679:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
[  105s]   ^
[  105s] libcommon/source/usb.c:679:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
[  105s] libcommon/source/usb.c:686:15: error: redefinition of 'i'
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[  105s]                ^
[  105s] libcommon/source/usb.c:679:15: note: previous definition of 'i' was here
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
[  105s]                ^
[  105s] libcommon/source/usb.c:686:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[  105s]   ^
[  105s] libcommon/source/usb.c:692:15: error: redefinition of 'i'
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
[  105s]                ^
[  105s] libcommon/source/usb.c:686:15: note: previous definition of 'i' was here
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[  105s]                ^
[  105s] libcommon/source/usb.c:692:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[  105s]   for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
[  105s]   ^
[  105s] Makefile:227: recipe for target 'obj/simtrace/flash_usb.o' faile

Change-Id: Ibdb837ac105664484b10873c2c0d9561051b1c2a
---
M firmware/libcommon/source/usb.c
1 file changed, 4 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/12/15112/1

diff --git a/firmware/libcommon/source/usb.c b/firmware/libcommon/source/usb.c
index 3efb9fc..9d3072f 100644
--- a/firmware/libcommon/source/usb.c
+++ b/firmware/libcommon/source/usb.c
@@ -653,7 +653,7 @@
 
 void SIMtrace_USB_Initialize(void)
 {
-
+	unsigned int i;
 	/* Signal USB reset by disabling the pull-up on USB D+ for at least 10 ms */
 #ifdef PIN_USB_PULLUP
 	const Pin usb_dp_pullup = PIN_USB_PULLUP;
@@ -676,20 +676,20 @@
 	char device_id_string[32 + 1];
 	snprintf(device_id_string, ARRAY_SIZE(device_id_string), "%08x%08x%08x%08x",
 		device_id[0], device_id[1], device_id[2], device_id[3]);
-	for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
+	for (i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
 		usb_string_serial[2 + 2 * i] = device_id_string[i];
 	}
 
 	// put version into USB string
 	usb_string_version[0] = USBStringDescriptor_LENGTH(ARRAY_SIZE(git_version) - 1);
 	usb_string_version[1] = USBGenericDescriptor_STRING;
-	for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
+	for (i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
 		usb_string_version[2 + i * 2 + 0] = git_version[i];
 		usb_string_version[2 + i * 2 + 1] = 0;
 	}
 
 	// fill extended USB strings
-	for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
+	for (i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
 		usb_strings_extended[i] = usb_strings[i];
 	}
 	usb_strings_extended[SERIAL_STR] = usb_string_serial;

-- 
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/15112
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ibdb837ac105664484b10873c2c0d9561051b1c2a
Gerrit-Change-Number: 15112
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190808/4c5f632f/attachment.htm>


More information about the gerrit-log mailing list