What is¶ ↑
adlint-postfilter is an ad-hoc filtering wrapper for AdLint to suppress useless warning messages.
News¶ ↑
1.1.0 is released (2012-04-18)¶ ↑
Changes since the 1.0.0 release¶ ↑
-
Fix bad copyright notice
-
Add ‘–config’ option to specify pathname of the configuration file
1.0.0 is released (2012-04-17)¶ ↑
This is the initial GA release of adlint-postfilter.
Implemented features¶ ↑
-
Platform headers’ warning message suppression
-
AdLint initial headers’ warning message suppression
-
Project-wide warning message suppression
-
Translation-unit-wide warning message control (both enable/disable suppressions)
-
Line-wise warning message control (both enable/disable suppressions)
How to Install¶ ↑
Requirements¶ ↑
-
AdLint 1.0.0 or later [mandatory]
Installation¶ ↑
You can install adlint-postfilter by following command.
If AdLint 1.0.0 or later version has not been installed, it will be installed automatically before installing adlint-postfilter.
% gem install adlint-postfilter
or
% sudo gem install adlint-postfilter
Usage¶ ↑
First, copy a template of adlint-postfilter’s configuration file to the root of the analysis project and transform the analysis GNUmakefile
.
% cd path/to/analysis/project % adlint_flt -it
Following files will be generated or overwritten.
adlint_postfilter.yml
-
Project-wide message suppression settings.
GNUmakefile
-
Overwritten
GNUmakefile
to use adlint-postfilter.
GNUmakefile.orig
-
Backup of the original
GNUmakefile
.
Second, edit project-wide message suppression settings in adlint_postfilter.yml
and add translation-unit-wide and line-wise message control annotations to source files if needed.
Finally, do analysis by ordinary instructions of the AdLint analysis.
% make verbose-all
Interface¶ ↑
adlint_flt
command¶ ↑
% adlint_flt --help Usage: adlint_flt --analyze <analysis command line> | [other options] Analysis Options: -A, --analyze Execute AdLint analysis command -V, --src-vpath DIR Use DIR as VPATH (CMA only) Other Options: -i, --install Generate adlint_filter.yml template -t, --transform Transform project's GNUmakefile -f, --force Force to overwrite existing files -c, --config FILE Use FILE as adlint-postfilter config --version Display version information --copyright Display copyright information --prefix Display prefix directory of adlint-postfilter -h, --help Display this message
Project-wide message control file (adlint_postfilter.yml
)¶ ↑
adlint_postfilter.yml
file should be written in YAML format.
Syntax in informal BNF¶ ↑
adlint-postfilter-yml : message-traits-section message-traits-section : "message_traits:" NEW_LINE suppression-list-section NEW_LINE individual-suppression-control-section NEW_LINE suppression-list-section : SPACE SPACE "suppression_list:" NEW_LINE message-suppression-list message-suppression-list : | message-suppression-list message-suppression-record message-suppression-record : SPACE SPACE SPACE SPACE "-" message-id NEW_LINE message-id : A string exactly matches with regexp /[WC][0-9]{4}/ individual-suppression-control-section : SPACE SPACE "enable_individual_suppression_control:" SPACE boolean-value NEW_LINE boolean-value : "true" | "false"
Example¶ ↑
% cat adlint_postfilter.yml ...snip... message_traits: suppression_list: - W0001 - W0002 - W0003 enable_individual_suppression_control : true ...snip...
Translation-unit-wide message control annotation¶ ↑
A translation-unit-wide message control annotation should be written as an ordinary comment of C language.
It can appear at any line in the target source file.
Syntax in informal BNF¶ ↑
tunit-wide-annotation : "/*" tunit-wide-message-controller "*/" | "/*" arbitrary-comment tunit-wide-message-controller "*/" | "/*" tunit-wide-message-controller arbitrary-comment "*/" | "/*" arbitrary-comment tunit-wide-message-controller arbitrary-comment "*/" arbitrary-comment : A sequence of any characters which does not match with regexp /ADLINT:TUNIT:/i tunit-wide-message-controller : tunit-wide-message-control-head "[" message-control-list "]" tunit-wide-message-control-head : "ADLINT:TUNIT:" message-control-list : message-control | message-control-list "," message-control message-control : message-suppression-activation | message-suppression-deactivation message-suppression-activation : "-" message-id message-suppression-deactivation : "+" message-id message-id : Described in `Project-wide message control file' section
Example¶ ↑
% head target.c /* ADLINT:TUNIT:[-W0001,-W0002,+W0003] added by yanoh */ ...snip...
Line-wise message control annotation¶ ↑
A line-wise message control annotation should be written as an ordinary comment of C language.
It should appear in the target line.
Syntax in informal BNF¶ ↑
line-wise-annotation : "/*" line-wise-message-controller "*/" | "/*" arbitrary-comment line-wise-message-controller "*/" | "/*" line-wise-message-controller arbitrary-comment "*/" | "/*" arbitrary-comment line-wise-message-controller arbitrary-comment "*/" arbitrary-comment : A sequence of any characters which does not match to regexp /ADLINT::/i and /ADLINT:LINE:/i line-wise-message-controller : line-wise-message-control-head "[" message-control-list "]" line-wise-message-control-head : "ADLINT::" | "ADLINT:LINE:" message-control-list : Described in `Translation-unit-wide message control annotation' section message-control : Described in `Translation-unit-wide message control annotation' section message-suppression-activation : Described in `Translation-unit-wide message control annotation' section message-suppression-deactivation : Described in `Translation-unit-wide message control annotation' section message-id : Described in `Translation-unit-wide message control annotation' section
Example¶ ↑
% cat target.c ...snip... const unsigned int ui1 = -1; /* ADLINT:LINE:[-W0607,+W0167] added by yanoh */ const unsigned int ui2 = -1; /* FIXME: ADLINT::[-W0607,+W0167] added by yanoh */ ...snip...
License¶ ↑
Copyright © 2010-2012, OGIS-RI Co.,Ltd.
adlint-postfilter is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
adlint-postfilter is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
Authors¶ ↑
-
Yutaka Yanoh <yanoh@users.sourceforge.net>