.TH icheck 1 .SH NAME icheck \- C interface ABI/API checker .SH SYNOPSIS .I icheck .B --canonify [[\fB\-\-baseline\fR \fBFILE\fR] ...] [\fBOPTIONS\fR] [\fBGCC_OPTIONS\fR] [\-\-] .B files .PP .I icheck .B \-\-compare [\fBOPTIONS\fR] .B old_file .B new_file .SH DESCRIPTION A tool for statically checking C interfaces for API and ABI changes. All changes to type declarations that can cause ABI changes should be detected, along with most API changes. .PP icheck is intended for use with libraries, as a method of preventing ABI drift. .SH COMMANDS Reduce a set of source files to a canonical interface file with \-\-canonify, then compare two such interface files with \-\-compare. If there are interface changes between them, icheck will describe the changes and fail. .PP .B --canonify [[\fB\-\-baseline\fR \fBFILE\fR] ...] [\fBOPTIONS\fR] [\fBGCC_OPTIONS\fR] [\-\-] .B files .PP .RS Canonify the source code files (typically .h headers) to be compared later with \fB\-\-compare\fR. Usually used with the \fB\-o\fR option to save the summary to a file. .RE .PP .B \-\-compare [\fBOPTIONS\fR] .B old_file .B new_file .PP .RS Reads two canonical interface files generated with \fB\-\-canonify\fR and compares the structure of the source code to the changes in the Application Public Interface (the developer interface or API) and the Application Binary Interface (ABI) used to link against other programs or libraries. .RE .SH OPTIONS .SS "ICHECK OPTIONS" \fB\-o\fR, \fB\-\-output\fR \fBFILE\fR .PP .RS Emit output to FILE, rather than stdout. .RE .PP \fB\-\-debug\fR \fBN\fR .PP .RS Dump debugging information. .RE .PP \fB\-\-only\fR \fBTHING\fR .PP .RS Only process the given THING. .RE .PP \fB\-\-skip\-from\fR \fBFILE\fR .PP .RS Skip unnecessary things from \fBFILE\fR. .RE .PP \fB\-\-skip\-from\-re\fR \fBregexp\fR .PP .RS Skip unnecessary things from files matching the regular expression. .RE .PP \fB\-\-only\-from\fR \fBFILE\fR .PP .RS Only take things from \fBFILE\fR. .RE .PP \fB\-\-only\-from\-re\fR \fBregexp\fR .PP .RS Only take things from files matching the regular expression. .RE .PP \fBGCC_OPTIONS\fR .PP .RS GCC_OPTIONS are passed through to gcc \-E .RE .SS "HELP OPTIONS" \fB\-\-help\fR .RS Display the help synopsis for \fIicheck\fR. .RE .SH EXAMPLES All source files are preprocessed with gcc, so canonify needs the same include information as the source code \- follow the syntax from the Makefile to include \-I options to \fBcpp\fR (or \fBgcc\fR) so that all necessary headers can be located. \fBicheck\fR will abort if any required headers cannot be found. The source must be compileable; icheck cannot process files which cannot be directly compiled. If a header is missing #include statements, or otherwise requires being used in a special way, then it cannot be directly processed with icheck. Instead, write a stub C file that sets things up appropriately and then #includes the header. .PP .I icheck .B \-\-canonify \fB\-o\fR \fB~/icheck/oldversion\fR .B \-I/usr/include/foo\-2.0 .B /usr/src/bar/src/foobar.h .PP Prepare a text summary of the foobar.h file and all files it includes. The summary is written out to \fB~/icheck/oldversion\fR. Repeat for \fB/usr/src/bar1/src/foobar.h\fR \- the same file in the newer source directory, outputting to a new file, e.g. \fB~/icheck/newversion\fR. .PP \fIicheck\fR .B \-\-compare \fB\-o\fR \fB~/icheck/results.txt\fR .B ~/icheck/oldversion .B ~/icheck/newversion .PP Writes the report of the comparison of the two summary files. The report indicates all the changes in the ABI and/or API found during the comparison. .PP .I icheck .B \-\-canonify \fB\-o\fR \fBdebian/icheck.canonical\fR .B \-Idebian/foo-dev/usr/include .B debian/foo-dev/usr/include/foobar.h .PP .I icheck .B \-\-compare .B debian/icheck.manifest .B debian/icheck.canonical .PP These two statements, included in a \fBdebian/rules\fR file, will cause the package build to fail if the API or ABI has changed in unexpected ways, where icheck.manifest is a copy of the expected interface, included in the package. .PP Note that the arguments to --compare are themselves valid C files which are preprocessed, so icheck.manifest can contain C preprocessor logic. This can be useful when a package exports different interfaces depending on the host architecture. In this case, you can't replace it with a new copy of icheck.canonical when the interface changes and you need to update the manifest. Rather than updating the entire manifest by hand, put the hand-written interface descriptions in one file (\fBicheck.static-manifest\fR) and then use: .PP .I icheck .B \-\-canonify \fB\-\-baseline\fR \fBdebian/icheck.static-manifest\fR \fB\-o\fR \fBdebian/icheck.dynamic-manifest\fR .PP Lastly, create icheck.manifest containing: .nf #include "icheck.static-manifest" #include "icheck.dynamic-manifest" .fi This allows you to update some parts of the manifest by hand, while still automatically generating the rest. .SH OUTPUT icheck generates a lengthly description of every possible API or ABI change, based on type information. It does not investigate the actual program code, and so it is possible that some type changes it detects are not actual ABI or API changes. However, this normally only happens when the program code was explicitly written for it. If in doubt, assume it's changed. .PP At the end, icheck provides a summary of the changes. Note that the directions here are dependent on the order of the arguments to --compare: the older interface must come first, or the directions will be the other way around. The meanings of the various terms are as follows: .RS .IP ABI The ABI is compatible if things compiled against one version of the interface will work when run using the other version. .IP API The API is compatible if things compiled against one version of the interface can be compiled against the other. .IP forwards-compatible An interface is forwards-compatible if things compiled against the old version will work with the new. This is the important feature for \fBsoname\fR changes. .IP backwards-compatible An interface is backwards-compatible if things compiled against the new version will work with the old. This is the important feature for \fBshlibs version\fR changes. If you aren't building Debian packages, you probably don't care about changes which aren't backwards-compatible. .RE .SH AUTHOR \fIicheck\fR was written by Andrew Suffield . .PP This manual page was written by Neil Williams and Andrew Suffield .