$ clang --version
clang version 5.0.0 (tags/RELEASE_500/final)
.
CC ../../py/nlrthumb.c
../../py/nlrthumb.c:79:5: error: non-ASM statement in naked function is not supported
return 0; // needed to silence compiler warning
Why doesn't Clang support non-ASM statement in naked function
?
This works fine on gcc
.
The mailing list explains it as
Naked functions don't have prologues or epilogues, so doing codegen for anything other than inline assembly would be completely hit or miss.
so then how can gcc
do it?
I should have written this as an answer instead of a comment. The question was:
Why doesn't Clang support non-ASM statement in naked function? This works fine on gcc.
The answer is that this doesn't work fine in gcc. Quoting from the gcc docs for the naked
attribute:
Only basic asm statements can safely be included in naked functions. While using extended asm or a mixture of basic asm and C code may appear to work, they cannot be depended upon to work reliably and are not supported.
If there is a less ambiguous way to phrase this, I couldn't come up with it.
Note that while the specific link above is for ARM (which is what I'm guessing the OP is using), I believe the same text applies to all platforms that support naked
.