我有翻译与此功能的gcc交叉编译器的一些PowerPC汇编代码:如何抑制“警告:控制到达非void函数结束”
uint32_t fill_cache(void)
{
__asm__ ("addi 3, 0, 0\n"); /* R3 = 0 */
/* More asm here modifying R3 and filling the cache lines. */
}
其中,下了PowerPC EABI,返回在R3中计算的值。编译时我得到
foo.c:105: warning: control reaches end of non-void function
有没有办法教gcc实际返回一个值?或者是否有办法抑制警告(不删除-Wall或添加-Wno- *)?我想非常有选择性地仅仅为了使这个警告级别尽可能高而禁止这个警告。
由于调用者需要计算的值,因此不能使此函数返回void。