Skip to content

Commit f7d82a1

Browse files
committed
Fix IAR warnings
Signed-off-by: HiFiPhile <admin@hifiphile.com>
1 parent 0486c6b commit f7d82a1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/common/tusb_fifo.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ TU_ATTR_ALWAYS_INLINE static inline bool tu_fifo_empty(const tu_fifo_t *f) {
253253
return wr_idx == rd_idx;
254254
}
255255

256+
// Suppress IAR warning
257+
// Warning[Pa082]: undefined behavior: the order of volatile accesses is undefined in this statement
258+
#if defined(__ICCARM__)
259+
#pragma diag_suppress = Pa082
260+
#endif
261+
256262
// return number of items in fifo, capped to fifo's depth
257263
TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_fifo_count(const tu_fifo_t *f) {
258264
return tu_min16(tu_ff_overflow_count(f->depth, f->wr_idx, f->rd_idx), f->depth);
@@ -267,6 +273,10 @@ TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_fifo_remaining(const tu_fifo_t *
267273
return tu_ff_remaining_local(f->depth, f->wr_idx, f->rd_idx);
268274
}
269275

276+
#if defined(__ICCARM__)
277+
#pragma diag_default=Pa082
278+
#endif
279+
270280
#ifdef __cplusplus
271281
}
272282
#endif

src/tusb.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
#include "host/usbh_pvt.h"
4040
#endif
4141

42+
// Suppress IAR warning
43+
// Warning[Pe111]: statement is unreachable
44+
#if defined(__ICCARM__)
45+
#pragma diag_suppress = Pe111
46+
#endif
47+
4248
tusb_role_t _tusb_rhport_role[TUP_USBIP_CONTROLLER_NUM] = { TUSB_ROLE_INVALID };
4349

4450
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)