Coan is a software engineering tool for analysing preprocessor-based configurations of C or C++ source code. Its principal use is to simplify a body of source code by eliminating any parts that are redundant with respect to a specified configuration. Dead code removal is an application of this sort.

Coan is most useful to developers of constantly evolving products with large code bases, where preprocessor definitions and #if-directives are used differentiate progressive releases or parallel variants of the product. In these settings the upkeep of the product's configuration tree can become difficult and the incidence of configuration-related defects can become costly. (The side-panels on these pages illustrate how preprocessor-encrusted production code can get.) Coan can largely automate the maintenance of preprocessor-based configurations and the investigation of configuration-related questions. More...

Latest News

  • 2013-09-07 Coan v5.2 release
  • What's new?
    • This feature release adds two new options to the symbols command that analyses the processor macros used in the scanned code.
      • The select option lets you specify a set of symbols or wildcard prefixes that will restrict coan's reporting to matching symbols.
      • The explain option directs coan to "backtrace" the expansion of each macro S that is reported by recursively reporting the expansion of each macro that is expanded in expanding S.
    • Apple OS X is now supported by the source tarball. (OS X binaries are not provided).
    • All (7) open bugs on v5.1.2 are closed
    • A complete listing of the changes can be found in the changelog.
  • 2012-06-04 Coan v5.1.2 release
  • What's new?
    • This patch release adds build support for the clang C++ compiler, in addition to GCC and MSVC++. You will need clang v3.1 or later to build coan. Build instructions are on the install page.
    • New binary packages are made for:-
      • Fedora 17
      • SUSE Enterprise Linux 11 SP 2
      • Ubuntu 12.04
    • All (1) open bugs on v5.1.1 are closed
    • A complete listing of the changes can be found in the changelog.
  • Supported Platforms

    Coan 5.1.2 has been built and tested successfully on the following platforms:

    • CentOS Linux 6:- x86, x86_64
    • Debian Linux 6.0:- x86, x86_64
    • Debian Linux 7.0:- x86, x86_64
    • Fedora Linux 17, 18, 19 :- x86, x86_64
    • openSUSE Linux 11.4, 12.1, 12.2, 12.2:- x86, x86_64
    • Redhat Enterprise Linux 6:- x86, x86_64
    • SUSE Linux Enterprise Linux 11, 11_SP1, 11_SP2, 11_SP3:- x86, x86_64
    • Ubuntu Linux 11.10, 12.04, 12.10, 13.04:- x86, x86_64
    • Microsoft Windows Windows 7:- x86, x86_64

    There is a good chance that Coan will build from source on a system that provides the GNU build tools and Perl. However it will not peform arithmetic operations correctly on PowerPC, ARM or other big-endian architecture.

    Authorship, Copyright & License

    • The author and maintainer of Coan is Mike Kinghan, Some fundamental elements of Coan are derived from Tony Finch's version of Unifdef.
    • Coan is copyright © 2004 - 2006 Symbian Software Ltd., © 2007 - 2011 Mike Kinghan, except where otherwise asserted by copyright notices within the source files. Some source files that vitally depend on cribs from the work of Tony Finch retain his copyright notice.
    • Coan is derived from BSD licensed code and is released under the New BSD License.


    Coan is dedicated to the memory of Altan Walker, nee Vaughan Kinghan, 1964 - 2007.