lkml.org 
[lkml]   [2008]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Speed up "make headers_*"
On Sun, Jun 08, 2008 at 11:49:01AM +0100, David Woodhouse wrote:
> On Sun, 2008-06-08 at 12:41 +0200, Sam Ravnborg wrote:
> > headers_install.pl looks like this now.
> > I am not happy about the way I call unifdef - can it be
> > done better?
>
> Possibly. unifdef only actually handles "#ifdef __KERNEL__" and
> "#ifndef __KERNEL__", doesn't it? It shouldn't be too hard to recreate
> at least that much functionality in perl, surely?

Correct. A quick grep shows that we have these different
uses of __KERNEL__:

#if defined(__ARM_EABI__) && !defined(__KERNEL__)
#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
#if defined(__KERNEL__)
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
#if defined(__KERNEL__) && defined(CONFIG_PPC32)
#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
#if !defined(__KERNEL__) || defined(CONFIG_X86)
#if defined(__KERNEL__) || defined(__DEFINE_BSD_TERMIOS)
#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
#if defined(__KERNEL__) || defined(__linux__)
# if (defined(__KERNEL__) || !defined(RELOC_DEBUG)) \
#if defined(__KERNEL__) || defined(__USE_ALL)
#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
#if defined(__KERNEL__) && defined(__x86_64__)
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
#ifdef __KERNEL__
#ifndef __KERNEL__
#else and #endif filtered away.

A script needs to take into account other preprocessor
uses too due to their nested nature.
But doable I'm sure.

And I rather have 100 lines perl than use the unifdef utility
because we then have it collected in one place and can do even
stricter validation.


>
> Bonus points for making it handle more interesting constructs like
> "#if defined (KERNEL) || defined (FOO)", and for warning/erroring
> whenever any ifdefs on CONFIG_xxx would be visible in userspace.
> But those can come later; we don't have those yet anyway.

Agree.

Sam


\
 
 \ /
  Last update: 2008-06-08 13:19    [from the cache]
©2003-2011 Jasper Spaans