Standard atomic block also has some problems with different C standards as well, I actually made a new macro that works as a one-shot to avoid the issue instead. My application for it is to wrap malloc/free/realloc so that it is IRQ safe.
You can look at what I did here: xmem2/malloc.c at master · xxxajk/xmem2 · GitHub