可以使用几个 lint 选项禁止 lint 诊断消息。可以使用后跟一个或多个 tag 的 -erroff 选项禁止消息。可以使用 -errtags=yes 选项显示这些助记符标记。
下表列出了用于禁止 lint 消息的选项。
表 4–8 用于禁止消息的 lint 选项
选项 |
禁止的消息 |
---|---|
-a |
assignment causes implicit narrowing conversion conversion to larger integral type may sign-extend incorrectly |
-b |
statement not reached (unreachable break and empty statements) |
-h |
assignment operator "=" found where equality operator "==" was expected constant operand to op: "!" fallthrough on case statements pointer cast may result in improper alignment precedence confusion possible; parenthesize statement has no consequent: if statement has no consequent: else |
-m |
declared global, could be static |
-erroff=tag |
由 tag 指定的一条或多条 lint 消息 |
-u |
name defined but never used name used but not defined |
-v |
arguments unused in function |
-x |
name declared but never used or defined |