mirror of
https://github.com/keirf/greaseweazle-firmware.git
synced 2025-10-24 11:00:50 -07:00
New intrinsic "unreachable()" to indicate unreachable code points
This allows better compiler optimisation, while also including an ASSERT() for debug builds. Refs #7
This commit is contained in:
@@ -27,6 +27,8 @@ struct exception_frame {
|
||||
#define likely(x) __builtin_expect(!!(x),1)
|
||||
#define unlikely(x) __builtin_expect(!!(x),0)
|
||||
|
||||
#define unreachable() do { ASSERT(0); __builtin_unreachable(); } while (0)
|
||||
|
||||
#define illegal() asm volatile (".short 0xde00");
|
||||
|
||||
#define barrier() asm volatile ("" ::: "memory")
|
||||
|
||||
@@ -26,8 +26,7 @@ GPIO gpio_from_id(uint8_t id)
|
||||
case _I: return gpioi;
|
||||
#endif
|
||||
}
|
||||
ASSERT(0);
|
||||
return NULL;
|
||||
unreachable();
|
||||
}
|
||||
|
||||
uint8_t write_mapped_pin(
|
||||
|
||||
@@ -410,9 +410,8 @@ static void handle_iepint(uint8_t epnr)
|
||||
handle_tx_ep0();
|
||||
}
|
||||
|
||||
if (iepint & OTG_DIEPINT_TXFE) {
|
||||
ASSERT(0);
|
||||
}
|
||||
/* We don't set DIEPEMPMSK bits so TXFE notification is impossible. */
|
||||
ASSERT(!(iepint & OTG_DIEPINT_TXFE));
|
||||
}
|
||||
|
||||
static void dwc_otg_process(void)
|
||||
|
||||
@@ -65,7 +65,7 @@ void hw_usb_init(void)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
unreachable();
|
||||
}
|
||||
|
||||
peripheral_clock_delay();
|
||||
@@ -109,7 +109,7 @@ void hw_usb_deinit(void)
|
||||
rcc->ahb1enr &= ~RCC_AHB1ENR_OTGHSEN;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user