On Wed, 3 Aug 2005, Linus Torvalds wrote:
> 
> Actually, having thought about this some more, I think I'll just parse the 
> initial preprocessing tokens into global scope. That way I can do it just 
> once at the top, and every file will automatically see it.

Ok, done and checked in. As mentioned, it has somewhat "interesting" 
behaviour wrt predefines:

        [EMAIL PROTECTED] sparse]$ cat -n t.c
             1  DEBUG
             2  #undef DEBUG
        [EMAIL PROTECTED] sparse]$ sparse -E t.c t.c
        DEBUG
        DEBUG
        [EMAIL PROTECTED] sparse]$ sparse -DDEBUG=1 -E t.c t.c
        1
        DEBUG

ie notice in the second case how the "#undef DEBUG" will mean that the
second time through t.c, DEBUG won't be defined any more (and will thus
obviously preprocess to itself).

This is true only of the _predefined_ defines - a file that does a
"#include" will obviously have that #include done within the scope of that
file, and it will be re-done every time the file is accessed.

I may go back to the old setup if this turns out inconvenient, or I might 
make "#undef" only hide the symbol for that particular scope (so when we 
start a new scope, we'll automatically see the global #define again).

#undef really screws up my otherwise beautiful scoping code. It's a nasty 
special case.

                Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to