| Age | Commit message (Collapse) | Author | Files | Lines |
|
This change using symbol_op to contain the specifier parsing
function. It is easier to add new specifiers. We don't need
special bits any more.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Triplett <josh@freedesktop.org>
|
|
For inline functions, Sparse inlines the function body at evaluation. It is
very hard to find out the original function call. This change preserves the
original call as an annotation.
Signed-Off-By: Christopher Li <sparse@chrisli.org>
|
|
sparse currently only tracks one global context for __context__ and
__attribute__((context)).
This adds support for parsing an additional argument to each of these
which gives a context expression. For __attribute__((context)), store
each context attribute as a separate context structure containing the
expression, the entry context, and the exit context, and keep a list of
these structures in the ctype. For __context__, store the context
expression in the context instruction. Modify the various frontends to
adapt to this change, without changing functionality.
This change should not affect parsing of programs which worked with
previous versions of sparse, unless those programs use comma expressions
as arguments to __context__ or __attribute__((context)), which seems
highly dubious and unlikely. sparse with -Wcontext generates identical
output with or without this change on Linux 2.6.18-rc4.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This removes the list of symbols for block statements, and instead makes
a declaration be a statement of its own.
This is necessary to correctly handle the case of mixed statements and
declarations correctly, since the order of declarations and statements
is meaningful.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
This actually seems to do some sane things when parsing even complex
multiple files. In particular, it actually works right when used for
multiple kernel C files together in limited testing.
|
|
This patch add static declare to make sparse happy of checking itself.
|
|
|
|
The named parameter thing is still unsupported. And the format we save
things into is for simple saving rather than real usability.
|
|
Currently we warn unconditionally about it.
|
|
Not only do all users want it, the list of used symbols
is not stable until after the tree has been evaluated.
|
|
It just ends up propagating the expression to the linearizer,
which creates an internal "context" instruction for it.
|
|
It may well come back as a debugging and prototyping thing,
but I'd rather remove it and have to re-introduce it, than
have people use that stupid interface just "because it's there".
Sparse is very good at hashing identifiers and making them
all unique. So you really should never need to match by
string, you can just compare "struct ident" pointers directly.
Thanks to Chris for getting rid of the users.
|
|
When we take the address of an inline function or otherwise refusing to
inline it, we need to output the now non-inline function properly.
What we do is
a) keeping body and symbol list of inlined function in new fields
b) when expanding inlined call use these fields
c) when evaluating the function itself (which happens if sparse
decides that it can't be [always] inlined) uninline the sucker. I.e.
create ->stmt and ->symbol_list by copying the ->inline_stmt and
->inline_symbol_list same as we would do while expanding a call.
That guarantees that we won't run into trouble with inlined calls coming
afterwards - evaluation doesn't mangle ->inline_stmt anymore.
|
|
|
|
Associate them with each computed goto, and copy them properly
when inlining.
|
|
They were only used for the original pre-instruction
linearization.
|
|
|
|
This lets us get the type of comparison right.
|
|
As with labels, this required us to do indirection through
a symbol for branch targets. Now everything is handled that
way, and things look a lot saner.
|
|
Right now we only really do trivial if-statements, but the
ideas are all there now.
|
|
isn't the sole copyright owner these days.
|
|
argument symbols that got corrupted by the incorrect
partial symbol copy when creating the new argument symbols.
|
|
This patch removes the type-names on the anonymous structures. This
fixes compilation when using gcc-3.3 (Debian). Credit for identifying
the fix goes to Arnaldo Carvalho de Melo <acme@conectiva.com.br>.
|
|
used for inlining. Right now the copying is totally broken, since
we don't actually do any symbol replacement, but hey, we'll get there
some day.
Make "inline_function()" call the new copy_statement() function.
|
|
|
|
for compile-time constant conditionals.
This allows inline functions and macros to do "illegal" things,
as long as it's compile-time deterministic that they aren't done.
|
|
(&&label) and computed goto (goto *expr).
Add label ctype for __label__ identifier. This is still quite broken
(it should create a block-symbol in the NS_LABEL namespace, right now
it creates a regular symbol).
|
|
|
|
|
|
Add a "case" symbol for the switch statement, to let the
statement keep track of all the cases. This cleans up handling
a lot.
|
|
preparing for a public release.
|
|
Parse break-statements inside switch-statements correctly.
Rename break/continue symbols to make switch/iterator statements
have the same naming logic for the break targets.
|
|
per-iterator anonymous symbols.
Make arrays also gracefully degenerate into "void *".
|
|
create the proper pseudo-registers for sub-expressions. This changes
the printout a lot, but makes it a lot closer to what you'd output
internally for a back-end to do the flow graph.
show_statement() and show_expression() now return the pseudo
number for the result of a statement or expression.
Pseudo 0 is "void".
|
|
The last one gives a "context mask" and "context value" to a symbol,
which can be used to verify that the symbol is only used in a certain
context.
|
|
the real one when it goes out the door.
|
|
This still gets the nesting scope wrong, though. Labels
should use function scope, not block scope.
|
|
Now constant expressions (strings, integers and fp constants)
are evaluated at parse-time into the proper EXPR_xxx type.
Remove "struct token" from "struct statement", which really only
wanted to know the position. So replace it with "struct position".
|
|
make the arguments use a proper argument list instead of being
a comma-expression (which has totally different type semantics).
Evaluate assignments and function calls (and their arguments).
Show function calls in the debug info.
|
|
dangling anonymous "int_type" types with magic modifiers,
but turn all types into explicit C types.
|
|
'iterator' representation so that the parse tree doesn't
have to care.
|
|
left behind in "parse.h" when the files were split.
|
|
placeholder LICENSE file.
|
|
the entry is the first or last.
Make printouts prettier by using the new iterator functionality.
|
|
Fix up function argument list to use a proper symbol list.
|
|
|
|
conditional expression ( x ? y : z ) and gcc statement expressions. Fix
complex typenames. Add some rudimentary parsing of inline asms.
This parses most of a kernel "sched.c" with all header files. It still gets
some declarations wrong, though (in particular, it accepts type specifiers
in the pointer declaration that should only accept type _qualifiers_).
|
|
|
|
'switch' statements.
|
|
|
|
function pointers). Still missing enum initializer parsing, but we
fake it for now.
This actually parses the header files, and stumbles only when it starts
seeing its first real statements (it can do expression statements, but
that's about it).
|
|
typedef int a;
a b = 0;
Use new 'add_symbol()' infrastructure.
|
|
parameter lists etc. It can now parse things like
const volatile int hello(const int (*argc)(void), const char *const* argv);
apparently correctly.
|
|
Start parsing pointer, array and function types.
|
|
|
|
This adds a layer of symbol information on top of the raw tokens.
|
|
Namespace handling (and types) still not even started.
|
|
simple binops so far, type parsing is still way off).
Clean up and update tokenization.
|