How about putting
#if !defined(__AVR__) && !defined(__MSP430__)
#warning "Fix this FIFO - ++/-- possibly not atomic!"
#endif
into the header of that thingy then. Save work on small uCs, and be warned when moving it somewhere else.
#if !defined(__AVR__) && !defined(__MSP430__)
#warning "Fix this FIFO - ++/-- possibly not atomic!"
#endif
into the header of that thingy then. Save work on small uCs, and be warned when moving it somewhere else.
It's not a great coding practice. Move to a different processor (this happens!) and your code turns into a load-add-store, gets interrupted halfway through, and you scratch your head for a while about the mysterious and flaky FIFO failures.
Been there. At least a gesture towards an atomic operation would be nice, when you have data shared between interrupt and non-interrupt code.