Re: [PATCH 1/6] headers_check fix: arm, hwcap.h

From: Sam Ravnborg
Date: Fri Jun 05 2009 - 17:22:44 EST


On Fri, Jun 05, 2009 at 09:48:06PM +0100, Russell King wrote:
> On Thu, Jun 04, 2009 at 10:16:49PM +0200, Sam Ravnborg wrote:
> > On Thu, Jun 04, 2009 at 01:53:07PM +0100, Russell King wrote:
> > > On Thu, Jun 04, 2009 at 05:57:56PM +0530, Jaswinder Singh Rajput wrote:
> > > > fix the following 'make headers_check' warning:
> > >
> > > I think headers_check needs fixing - there's nothing wrong with the
> > > code as it presently stands except the tools obviously can't properly
> > > parse C preprocessor statements.
> >
> > You are correct that headers_ceck is limited here and this patch
> > take some valid code and refactor it to make it headers_check compatible.
>
> Okay, here's the question:
>
> Does userspace require anything in the ifdef __ASSEMBLY__ bits?
>
> In any case, passing -D__KERNEL__ or -U__KERNEL__ allows unifdef to
> do the right thing.
>
> The problem which unifdef has is that if it finds a symbol in an
> evaluation that it doesn't know about, it fails the expansion
> entirely, rather than checking whether the expansion always results
> in something which should be omitted. In other words:
>
> #if defined(__KERNEL__) && (<unknown>)
>
> results in basically an "unknown" answer from the evaluator, where
> we can see perfectly well that the expansion can never be true if
> __KERNEL__ is never set.
>
> So, the trivial answer to the problem if:
>
> #if defined(__KERNEL__) && something-depending-on-__ASSEMBLY__
>
> is to tell unifdef whether we want __ASSEMBLY__ defined or not defined.
> This does shut up the headers_install warning from ARMs hwdef.h.

That would help this onn - right.
But we have 12 other places in include/linux and 2 other places in arch/arm/include/asm
that uses this construct.

So to me this is simple a matter of:
1) add a number of specific -Dxxx to unifdef to silence those warnings
2) simplify the logic in a few places
3) fix unifdef (or use somethign better)

If I had better time I had rewritten unifdef long time ago.
And of 1) or 2) I so far has used option 2) to avoid an endless
list of config entries.

If someone uses an expression that unifdef does not cope with then
the worst things that happens is that we export a piece
of useless stuff to userspace (they never see it) and in a few cases
we spit out false warnign as in this case.

Adding only -U__ASSEMBLY__ is fine by me.
But adding all the others are not OK and here I request the simplified
logic.

Sam


>
> --
> Russell King
> Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
> maintainer of:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/