public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	Adrian Bunk <bunk@kernel.org>,
	linux-kbuild@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] headerdep: a tool for detecting inclusion cycles in header file
Date: Sat, 26 Apr 2008 20:26:48 +0200	[thread overview]
Message-ID: <20080426182648.GA18578@uranus.ravnborg.org> (raw)
In-Reply-To: <20080426134554.GA20727@damson.getinternet.no>

On Sat, Apr 26, 2008 at 03:45:54PM +0200, Vegard Nossum wrote:
> Hi Sam,
> 
> Maybe something like this could be useful for cleaning up headers (and
> maintaining that cleanliness once it has been achieved). What do you think?
Hi Vegard.

I really like the idea to use some automated checks to increase the
quality of our headers.
And that raises the question about what is the most important
issue we have with our headers and how do we detect them in the
best possible way?

To detect inclusion cycles in a configured kernel I really think
sparse is the better place to detect it. We have sparse as an
advenced sanity check tool and adding the possibility to detect
inclusion cycles should be easier than it was to cook up this
perl script.

But we have much more important issues.
In general we have far to many dependencies in the current headers
and too much code rely on headers being implicitly pulled.

We have headers that uses types we actually do not want to use
in the kernel.

We have headers that export stuff to userspace they shouldnt.

We have heders defining prototypes for non existing functions.

We have headers defining extern variables that no longer exists.

You could continue the list.
And some of the above topics are really newbies material to fix.

If you then decide to automate it then I would need a good
explanation why we did not use sparse before considering
including the tool in the kernel.

So I do not plan to apply this patch because this should be
done in sparse and not in a random perl script.

> 
> (One thing which might or might not be good is that 'make headerdep' will
>  also compile using CC if they're not already compiled. If this should be
>  fixed, I think you'd know how to do it.)

Not a big deal - we neither support this for sparse.


> +# Output dependency graph in GraphViz language.
> +sub graph {
> +	printf "digraph {\n";
> +
> +	printf "\t/* vertices */\n";
> +	for my $header (keys %deps) {
> +		printf "\t%s [label=\"%s\"];\n",
> +			mangle($header), escape($header);
> +	}
> +
> +	printf "\n";
> +
> +	printf "\t/* edges */\n";
> +	for my $header (keys %deps) {
> +		for my $dep (@{$deps{$header}}) {
> +			printf "\t%s -> %s;\n",
> +				mangle($header), mangle($dep);
> +		}
> +	}
> +
> +	printf "}\n";
> +}

I like this part. I would be nice to see a full dependency graph
for any file that kbuild builds.
But again maybe we should do this as a sparse backend?

	Sam

      parent reply	other threads:[~2008-04-26 18:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-26 13:45 [PATCH] headerdep: a tool for detecting inclusion cycles in header file Vegard Nossum
2008-04-26 13:59 ` Pekka Enberg
2008-04-26 14:17   ` Vegard Nossum
2008-04-26 14:22     ` Nick Andrew
2008-04-26 18:03       ` Jan Engelhardt
2008-04-26 15:00 ` Adrian Bunk
2008-04-26 15:21   ` Julia Lawall
2008-04-26 15:30     ` Vegard Nossum
2008-04-26 15:25   ` Vegard Nossum
2008-04-26 16:17 ` Matthew Wilcox
2008-04-26 16:38   ` Adrian Bunk
2008-04-30 17:57   ` "Anyone who likes complexity and fuzzy logic" (Re: [PATCH] headerdep:...) Oleg Verych
2008-04-30 17:38     ` Matthew Wilcox
2008-04-26 16:44 ` [PATCH] headerdep: a tool for detecting inclusion cycles in header file Adrian Bunk
2008-04-26 16:57   ` Vegard Nossum
2008-04-26 17:23     ` Adrian Bunk
2008-04-26 17:55       ` Vegard Nossum
2008-04-26 18:11 ` Jan Engelhardt
2008-04-26 18:26 ` Sam Ravnborg [this message]

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=20080426182648.GA18578@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=bunk@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=vegard.nossum@gmail.com \
    /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