linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@freedesktop.org>
To: Mike Goodwin <mike.goodwin@cantab.net>
Cc: linux-sparse@vger.kernel.org
Subject: Re: Style checking
Date: Tue, 01 May 2007 11:09:58 -0700	[thread overview]
Message-ID: <46378276.8060307@freedesktop.org> (raw)
In-Reply-To: <c38fc0de0704300030x6ab610acge10482904056d1db@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

Mike Goodwin wrote:
> I have begun modifying sparse (read: adding in various hooks to the
> preprocessing and parsing stages) in order to be able to use it as a
> style checker. Checking rules such as order of includes, function and
> variable naming ... etc.
> 
> The style checking is intended to be for linux/driver modules and as
> far as I am aware the only two freely available c parsers which can
> parse all the headers in the linux kernel are those that are part of
> sparse and gcc. As sparse is a lot simpler to modify it seems the
> logical choice
> 
> So I was wondering:-
>  1) if anyone had used sparse similarly?

Not that I know of.

>  2) would it ever be desirable to have this kind of feature as a part of sparse?

Yes!  I'd love to see the frontend save enough information to do things
like this, such as saving the tree of "#include"s.  I don't know if these
kinds of rules should go in the Sparse backend or in another backend using
libsparse; if the former, you'll need to include options to turn these
checks on, and they should likely default to "off" because they will vary
between projects.

In addition to the warnings you suggest, I'd love to see a warning for "Header
not self-contained": a header does not #include all the headers it needs, and
instead relied on the inclusion of another header first.

>  3) is there anything wrong with this approach?!

Not that I can see; I look forward to seeing your patches.

- Josh Triplett


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

  reply	other threads:[~2007-05-01 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30  7:30 Style checking Mike Goodwin
2007-05-01 18:09 ` Josh Triplett [this message]
2007-05-03 16:34   ` Uwe Kleine-König
2007-05-11 10:25   ` Mike Goodwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46378276.8060307@freedesktop.org \
    --to=josh@freedesktop.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mike.goodwin@cantab.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).