如何在 GCC 下生成缺少 return 语句的错误?
cpfsfuse.c:184: 警告:函数中没有 return 语句返回非 void
我能够返回隐式函数声明的错误(-Werror-implicit-function-declaration
),并且我知道-Werror=
开关,但我找不到适当的警告来提升到错误状态。
我怎样才能实现这个目标?
您应该能够使用-fdiagnostics-show-option
显示正确标志的选项Werror=
转变。取自this http://blog.flameeyes.eu/2008/11/13/gcc-features-and-shortcomings博客文章:
gcc -x c -Wall -Wextra -fdiagnostics-show-option -c -o /dev/null - <<EOF
int foo() {
}
EOF
Output
<stdin> In function ‘foo’:
<stdin>:2: warning: control reaches end of non-void function [-Wreturn-type]
事实上,它看起来像return-type
flag 可能是您想要的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)