format(ARCHETYPE,STRING-INDEX,FIRST-TO-CHECK)属性用于函数,表示该函数使用printf,scanf或strftime风格的参数,使用这类函数最容易犯的错误是格式串与参数不匹配,指定format属性可以让编译器根据格式串检查参数类型。例如: //include/linux/kernel.h asm linkage int printk(const char* fmt, ...) __attribute__((...
unused-value:计算了但是未使用的值; format:printf和scanf这样的函数中的格式字符 串的使用不当; implicit-int:未指定类型; implicit-function:函数在声明前使用; char- subscripts:使用char类作为数组下标(因为char可能是有符号数); missingbraces:大括号不匹配; parentheses: 圆括号不匹配; return-type:函数有无返...
format (archetype, string-index, first-to-check) format属性告诉编译器,按照printf, scanf, strftime或strfmon的参数表格式规则对该函数的参数进行检查。“archetype”指定是哪种风格;“string-index”指定传入函数的第几个参数是格式化字符串;“first-to-check”指定从函数的第几个参数开始按上述规则进行检查。 具...
format(archetype, string-index, first-to-check) 属性format用于函数,表示该函数使用printf、scanf、strftime或strfmon风格的参数,并可以让编译器检查函数声明和函数实际调用参数之间的格式化字符串是否匹配。 archetype指定是哪种风格,string-index指定传入函数的第几个参数是格式化字符串,first-to-check指定从函数的第...
M88K选项 -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...
-Wformat 对 printf/scanf/strftime/strfmon中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 ...
-Wformat 对 printf/scanf/strftime/strfmon中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 ...
-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...
-Wformat 对 printf/scanf/strftime/strfmon中的格式字符串异常给出警告 -Wformat-contains-nul 当格式字符串包含 NUL 字节时给出警告 -Wformat-extra-args 当传递给格式字符串的参数太多时给出警告 -Wformat-nonliteral 当格式字符串不是字面值时给出警告 ...
of constant propagation is-Wformat. The implementation of the warning is able to checkprintfformat strings that are either literals or compile-time constants but not others. For instance, when the format string is declared as aconst chararray, GCC can check it and catch mistakes like this one...