A New Krazy Checker for #include

Allen Winter winter at kde.org
Sun Apr 8 18:28:33 BST 2007


Howdy,

I will be installing a new Krazy checker today that does some sanity checking
of #include.   It doesn't do everything on my to-do list yet.

It checks for the following:
- in installed headers
  + use #include <foo.h> rather than "foo.h" 
  +  use #include <QtModule/QClass> rather than <qclass.h>, <QtModule/qclass.h> or <QClass>
- including the same header more than once
- including <QtModule>
- including "blacklisted" headers (so far only malloc.h)

Other ideas that I may implement one day (or maybe someone will do me):
- if including an installed header, always use #include <foo.h>, not "foo.h"
- foo.cpp should always include its own header foo.h first
- check if foo.h is needed at all
- check if  include <foo.h> should be replaced with class Foo
- an application should include its own, non-installed headers with #include ".."

As usual, please let me know about false positives.

-Allen




More information about the kde-core-devel mailing list