專案引入第三方源碼(如 sqlite3.c)導致 Lint 報告噪音過大,需排除。PC-Lint 支持在 co-gcc.lnt 或專案 .lnt 中用 -e / -esym 排除。
在專案對應的 project.lnt 中添加:
-e{sqlite3.c} // 排除整個文件
// 或精確路徑
-e{../thirdparty/sqlite3.c}
若僅想屏蔽該文件的某類警告(如 534 忽略返回值):
-esym(534, sqlite3.c) // 只屏蔽 534
-esym(960, sqlite3.c) // 屏蔽 960 (未使用變量)
lint-nt +v -e{sqlite3.c} project.lnt
運行 lint-nt -v project.lnt 觀察輸出開頭的 --- Module: sqlite3.c (excluded) --- 確認生效。
StackOverflow 詳解:How to exclude some particular files in PC-Lint