[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121101114301.GB32532@liondog.tnic>
Date: Thu, 1 Nov 2012 12:43:01 +0100
From: Borislav Petkov <bp@...en8.de>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Pavel Machek <pavel@....cz>, Joe Perches <joe@...ches.com>,
Andy Whitcroft <apw@...onical.com>,
Adil Mujeeb <mujeeb.adil@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] checkpatch: Emit a warning when decimal values are
used
On Wed, Oct 31, 2012 at 03:49:08PM -0700, Andrew Morton wrote:
> Joe means floating point. I suggest that the patchset be reworked,
> using s/decimal/float/g.
>
>
> The kernel does have floating point constants, in various graphics
> drivers, iirc. They are used in places where the floatiness gets
> handled at complation time. Along the lines of:
>
> int foo = 1.1 * 2.2;
>
> And I suppose that's an OK thing to do. We could instead do
>
> int foo = 2; /* 1.1 * 2.2 */
>
> but that's taking away a programmer convenience for no good reason.
> It would be highly inconvenient if the "1.1" was in fact a #define in
> some other file, or a Kconfig string.
>
>
>
> That being said, I guess it's a worthwhile thing for checkpatch to warn
> about. Hopefully the programmer will say "well thanks, but I meant to
> do that".
>
> A much better solution would be to arrange for the kernel to fail to
> compile (or to fail to link) if floats are used. That way, people
> could continue to use floats within their compile-time scalar
> expressions without getting harrassed by checkpatch. But I don't know
> how to arrange this.
Run git grep on the source before compiling... Expensive though.
Also, Joe, I think you should add Andrew's explanation to the commit
message so that it is clear what that check is for. Or maybe even as a
comment above the check itself in checkpatch.pl.
Thanks.
--
Regards/Gruss,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists