Re: [mingo@elte.hu: [git pull] headers_check fixes]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Tuesday, January 27, 2009 - 3:57 pm

On Tue, 27 Jan 2009, Ingo Molnar wrote:

I really hate the patch. I think it's fundamentally flawed. I hate scripts 
that test for things that are readable, and encourage people to then write 
crap instead.

The thing is, the headers_check stuff is just wrong if it causes these 
things, and I'd rather just turn it off.

If those 

	#ifdef CONFIG_XYZ

things result in problems, then we should just make the rule be that we 
turn that kind of string into

	#if 0

automatically when exporting the kernel headers. IOW, just about 
_anything_ that headers_check complains about automatically is something 
that should just be _fixed_ automatically at header install time rather 
than make the code harder to read.

So I think it makes our headers worse. Code like

	> +#ifdef __KERNEL__
	> +# ifdef CONFIG_X86_BSWAP
	> +# define __X86_BSWAP  
	> +# endif /* CONFIG_X86_BSWAP */
	> +#endif /* __KERNEL__ */

just doesn't make sense. It doesn't make sense _inside_ the kernel, and it 
doesn't make sense _outside_ it either.

As far as I can tell, the header install script could literally just do 
something like run 'sed' over the headers as it installs them, and do 
something like

	sed 's/\<CONFIG_[A-Z0-9_]*\>/__kernel_only__/g'

which I realize is not really the complete/correct solution (ie you could 
write a nicer thing that does a better job), but my point here is that 
rather than have scripts that _whine_ about these kinds of trivial things 
and cause people to write less readable header files, we should just make 
sure that if we can recognize them so easily, we can just fix them 
instead.

End result: headers that don't suck.

If the damn headers-check isn't working for people, then let's turn the 
thing off, not make our code look worse.

There are parts of the patches that look fine, like moving __KERNEL__ 
checks around a bit, and changing <asm/types.h> to <linux/types.h> which 
looks correct _both_ in a kernel and in a user context, but I dislike the 
stupid parts.

			Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [mingo@elte.hu: [git pull] headers_check fixes], Linus Torvalds, (Tue Jan 27, 3:57 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Tue Jan 27, 4:22 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Linus Torvalds, (Tue Jan 27, 4:29 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Ingo Molnar, (Tue Jan 27, 4:31 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Linus Torvalds, (Tue Jan 27, 4:43 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Vegard Nossum, (Tue Jan 27, 4:51 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Harvey Harrison, (Tue Jan 27, 5:03 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Tue Jan 27, 5:12 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Linus Torvalds, (Tue Jan 27, 5:19 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Tue Jan 27, 6:02 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Jaswinder Singh Rajput, (Tue Jan 27, 6:36 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Arnd Bergmann, (Wed Jan 28, 5:37 am)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Wed Jan 28, 10:48 am)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Harvey Harrison, (Wed Jan 28, 12:22 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Linus Torvalds, (Wed Jan 28, 12:44 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Harvey Harrison, (Wed Jan 28, 1:03 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Sam Ravnborg, (Wed Jan 28, 1:49 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Sam Ravnborg, (Wed Jan 28, 2:06 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Wed Jan 28, 2:23 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], H. Peter Anvin, (Wed Jan 28, 2:25 pm)
[PATCH] x86: do not expose CONFIG_BSWAP to userspace, Harvey Harrison, (Wed Jan 28, 2:58 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Linus Torvalds, (Wed Jan 28, 3:13 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Wed Jan 28, 3:15 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Harvey Harrison, (Wed Jan 28, 3:38 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Harvey Harrison, (Wed Jan 28, 3:40 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Arnd Bergmann, (Wed Jan 28, 4:24 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Wed Jan 28, 4:27 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Wed Jan 28, 4:30 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Harvey Harrison, (Wed Jan 28, 4:36 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Wed Jan 28, 4:47 pm)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Jaswinder Singh Rajput, (Fri Jan 30, 7:01 am)
Re: [mingo@elte.hu: [git pull] headers_check fixes], Ingo Molnar, (Fri Jan 30, 11:20 am)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Fri Jan 30, 11:20 am)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Maciej W. Rozycki, (Sat Jan 31, 11:43 am)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, H. Peter Anvin, (Sat Jan 31, 1:24 pm)
Re: [PATCH] x86: do not expose CONFIG_BSWAP to userspace, Arnd Bergmann, (Tue Feb 3, 11:19 am)