format(ARCHETYPE,STRING-INDEX,FIRST-TO-CHECK)属性用于函数,表示该函数使用printf,scanf或strftime风格的参数,使用这类函数最容易犯的错误是格式串与参数不匹配,指定format属性可以让编译器根据格式串检查参数类型。例如: //include/linux/kernel.h asm linkage int printk(const char* fmt, ...) __attribute__((...
-Wfloat-equal 当比较浮点数是否相等时给出警告 -Wformat 对 printf/scanf/strftime/strfmon 中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 -Wformat...
non-PIC 的形势是:jump printf ,意思是调用 printf。 PIC 的形式则是:jump printf-offset@GOT, 意思是跳到 GOT 表的 index 为 printf-offset 的地方处指示的地址去执行, 这个地址处的代码摆放在 .plt section, 每个外部函数对应一段这样的代码,其功能是呼叫dynamic-loader(ld-linux.so) 来查找函数的地址(本...
-Wfloat-equal 当比较浮点数是否相等时给出警告 -Wformat 对 printf/scanf/strftime/strfmon中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 -Wformat-...
printf ("Two plus two is %f/n", 4);一眼看去该错误并不明显,但是它可被编译器捕捉到,只要启用了警告选项 -Wall。编译上面的程序‘bad.c’,将得到如下的消息:$ gcc -Wall bad.c -o bad bad.c: In function 'main':bad.c:6: warning: double format, different type arg (arg 2)这表明文件...
-Wformat 对 printf/scanf/strftime/strfmon中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 ...
检查对printf和scanf等函数的调用,确认各个参数类型和格式串中的一致. -Wchar-subscripts 警告类型是char的数组下标.这是常见错误,程序员经常忘记在某些机器上char有符号. -Wuninitialized 在初始化之前就使用自动变量. 这些警告只可能做优化编译时出现,因为他们需要数据流信息,只有做优化的时候才估算数据流信息.如果不...
--place_holder symbol[,size[,section[,alignment]]] Reserve a place in ROM for later use --preconfig file Read before normal linker configuration file --printf_multibytes Enable multibyte support in printf & friends --redirect orig=replacement Redirect symbol refs to replacement symbol --remarks ...
-m88000 -m88100 -m88110 -mbig-pic -mcheck-zero-division -mhandle-large-shift -midentify-revision -mno-check-zero-division -mno-ocs-debug-info -mno-ocs-frame-position -mno-optimize-arg-area -mno-serialize-volatile -mno-underscores -mocs-debug-info -mocs-frame-position -moptimize-arg-area...
此外,所有参数数量可变地函数必须提供函数原型(包括printf);否则编译器会生成错误的调用代码. 另外,如果调用函数时携带了过多的参数,编译器将生成严重错误的代码. (正常情况下,多余的参数被安全无害的忽略.) 68010和68020处理器支持rtd指令,但是68000不支持. 下面是针对VAX定义的`-m'选项: -munix 禁止输出某...