Browse Source

compile with -Wextra

Thomas Buck 1 year ago
parent
commit
5d3ff84866
4 changed files with 7 additions and 6 deletions
  1. 1
    0
      firmware/CMakeLists.txt
  2. 1
    1
      firmware/src/console.c
  3. 1
    1
      firmware/src/debug.c
  4. 4
    4
      firmware/src/log.c

+ 1
- 0
firmware/CMakeLists.txt View File

58
 
58
 
59
 target_compile_options(trackball PUBLIC
59
 target_compile_options(trackball PUBLIC
60
     -Wall
60
     -Wall
61
+    -Wextra
61
     -Werror
62
     -Werror
62
 )
63
 )
63
 
64
 

+ 1
- 1
firmware/src/console.c View File

163
 }
163
 }
164
 
164
 
165
 static int32_t cnsl_find_line_end(void) {
165
 static int32_t cnsl_find_line_end(void) {
166
-    for (int32_t i = 0; i < cnsl_buff_pos; i++) {
166
+    for (uint32_t i = 0; i < cnsl_buff_pos; i++) {
167
         if ((cnsl_line_buff[i] == '\r') || (cnsl_line_buff[i] == '\n')) {
167
         if ((cnsl_line_buff[i] == '\r') || (cnsl_line_buff[i] == '\n')) {
168
             return i;
168
             return i;
169
         }
169
         }

+ 1
- 1
firmware/src/debug.c View File

91
     } else {
91
     } else {
92
         UINT bw;
92
         UINT bw;
93
         res = f_write(&file, frame, r, &bw);
93
         res = f_write(&file, frame, r, &bw);
94
-        if ((res != FR_OK) || (bw != r)) {
94
+        if ((res != FR_OK) || ((ssize_t)bw != r)) {
95
             debug("error: f_write returned %d", res);
95
             debug("error: f_write returned %d", res);
96
         }
96
         }
97
     }
97
     }

+ 4
- 4
firmware/src/log.c View File

38
 
38
 
39
     char buff[32];
39
     char buff[32];
40
     int l = snprintf(buff, sizeof(buff), "\r\n\r\nbuffered log output:\r\n");
40
     int l = snprintf(buff, sizeof(buff), "\r\n\r\nbuffered log output:\r\n");
41
-    if ((l > 0) && (l <= sizeof(buff))) {
41
+    if ((l > 0) && (l <= (int)sizeof(buff))) {
42
         usb_cdc_write(buff, l);
42
         usb_cdc_write(buff, l);
43
     }
43
     }
44
 
44
 
50
     }
50
     }
51
 
51
 
52
     l = snprintf(buff, sizeof(buff), "\r\n\r\nlive log:\r\n");
52
     l = snprintf(buff, sizeof(buff), "\r\n\r\nlive log:\r\n");
53
-    if ((l > 0) && (l <= sizeof(buff))) {
53
+    if ((l > 0) && (l <= (int)sizeof(buff))) {
54
         usb_cdc_write(buff, l);
54
         usb_cdc_write(buff, l);
55
     }
55
     }
56
 }
56
 }
94
     if (l < 0) {
94
     if (l < 0) {
95
         // encoding error
95
         // encoding error
96
         l = snprintf(buff, len, "%s: encoding error\r\n", __func__);
96
         l = snprintf(buff, len, "%s: encoding error\r\n", __func__);
97
-    } else if (l >= len) {
97
+    } else if (l >= (ssize_t)len) {
98
         // not enough space for string
98
         // not enough space for string
99
         l = snprintf(buff, len, "%s: message too long (%d)\r\n", __func__, l);
99
         l = snprintf(buff, len, "%s: message too long (%d)\r\n", __func__, l);
100
     }
100
     }
110
     int l = format_debug_log(line_buff, sizeof(line_buff), format, args);
110
     int l = format_debug_log(line_buff, sizeof(line_buff), format, args);
111
     va_end(args);
111
     va_end(args);
112
 
112
 
113
-    if ((l > 0) && (l <= sizeof(line_buff))) {
113
+    if ((l > 0) && (l <= (int)sizeof(line_buff))) {
114
         usb_cdc_write(line_buff, l);
114
         usb_cdc_write(line_buff, l);
115
 
115
 
116
         if (log) {
116
         if (log) {

Loading…
Cancel
Save