如何在c/c ++代码中生成编译器警告"语句无效"

use*_*148 3 c c++ compiler-construction warnings

对于我的编译器测试,我需要在我的测试代码中生成此"警告无效"的警告.我怎样才能做到这一点?

使用VS cl.exe编译器

Dig*_*oss 6

so ross$ cat > noeff.c
void f(void) {
  1;
}
so ross$ cc -Wall -c noeff.c
noeff.c: In function ‘f’:
noeff.c:2: warning: statement with no effect
so ross$ 
Run Code Online (Sandbox Code Playgroud)