检查未使用的变量、函数等:使用-Wunused选项可以检查未使用的变量、函数等。例如: gcc -Wunusedyour_source_file.c-o output_file 检查隐式函数声明:使用-Wimplicit-function-declaration选项可以检查隐式函数声明。例如: gcc -Wimplicit-function-declaration your_source_file.c-o output_file 检查类型不匹配:使用-...
-Wimplicit (C and Objective-C only) -Wimplicit-function-declaration (C and Objective-C only) -Wimplicit-int (C and Objective-C only) -Winfinite-recursion -Winit-self (C++ and Objective-C++ only) -Wint-in-bool-context -Wlogical-not-parentheses -Wmain (only for C/ObjC and unless -ffre...
-Wimplicit 对隐式函数声明给出警告 -Wimplicit-function-declaration 对隐式函数声明给出警告 -Wimplicit-int 当声明未指定类型时给出警告 -Wimplicit-interface 对带有隐式接口的调用给出警告 -Wimplicit-procedure 对没有隐式声明的过程调用给出警告 -Winit-self 对初始化为自身的变量给出警告。 -Winline 当内...
gcc -Wimplicit -c test_implicit.c test_implicit.c:7: warning: return type defaults to `int’ test_implicit.c: In function `test’: test_implicit.c:18: warning: implicit declaration of function `sub’ [-Wmissing-braces] 当聚合类型或者数组变量的初始化表达式没有’充分’用括号{}括起时,给...
-Wimplicit-function-declaration (C and Objective-C only) -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation (only for C/C++) ...
#pragma GCC diagnostic error "-Wimplicit-function-declaration" 这段代码会将接下来的代码中关于隐式函数声明的警告视为错误。 解决警告的方法: 检查选项名称:确保你使用的选项名称是正确的,没有拼写错误。 查阅文档:查阅GCC的官方文档或相关资源,了解支持的选项列表。 使用#pragma GCC diagnostic push 和#pragma...
-Wempty-body 当 if 或 else 语句体为空时给出警告 -Wendif-labels 当#elif 和 #endif后面跟有其他标识符时给出警告 -Wenum-compare 对不同枚举类型之间的比较给出警告 -Werror-implicit-function-declaration 不建议使用此开关;请改用 -Werror=implicit-function-declaration ...
gcc -Wimplicit -c test_implicit.ctest_implicit.c:7: warning: return type defaults to `int'test_implicit.c: In function `test':test_implicit.c:18: warning: implicit declaration of function `sub' 1.5 [-Wmissing-braces] [-Wmissing-braces]当聚合类型或者数组变量的初始化表达式没有'充分'用括号...
warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration] 1. Code:码: #include <stdio.h> #include <math.h> int main (void) { printf ("%d\n", abs (-1)); return 0; } 1. 2. 3. 4. 5. 6. 7.
-Wimplicit-function-declaration 警告在声明之前就使用的函数. -Wimplicit 同-Wimplicit-int 和-Wimplicit-function-declaration. -Wmain 如果把 main 函数声明或定义成奇怪的类型,编译器就发出警告.典 型情况下,这个函数用于外部连接, 返回 int 数值,不需要参数,或指定两 个参数. -Wreturn-type 如果函数定义了...