aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/parse.h
AgeCommit message (Collapse)AuthorFilesLines
2007-03-07Free up some special bits in modifiers.Josh Triplett1-0/+1
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>
2007-03-02Add annotation for inline function call.Christopher Li1-0/+2
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>
2006-08-30[PATCH] Parse and track multiple contexts by expressionJosh Triplett1-1/+4
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>
2005-12-31Make local declarations be statements of their ownLinus Torvalds1-1/+4
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>
2005-08-03Get closer to parsing multiple files correctly.Linus Torvalds1-1/+1
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.
2005-04-07[PATCH] static declearChristopher Li1-0/+1
This patch add static declare to make sparse happy of checking itself.
2005-04-07Add compile-time "range-check" infrastructure to sparseLinus Torvalds1-1/+7
2005-04-07Save away (most) of the asm information when parsing inline assembly.Linus Torvalds1-0/+6
The named parameter thing is still unsupported. And the format we save things into is for simple saving rather than real usability.
2005-04-07Allow the C99/C++ mixed variable declaration syntax.Linus Torvalds1-1/+0
Currently we warn unconditionally about it.
2005-04-07Make "translation_unit()" do symbol evaluation too.Linus Torvalds1-1/+1
Not only do all users want it, the list of used symbols is not stable until after the tree has been evaluated.
2005-04-07Add an internal sparse "context" statement type.Linus Torvalds1-0/+1
It just ends up propagating the expression to the linearizer, which creates an internal "context" instruction for it.
2005-04-07Remove "match_string_ident" now that nothing uses it.Linus Torvalds1-1/+0
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.
2005-04-07[PATCH] uninlining inline functionsAlexander Viro1-0/+1
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.
2005-04-07Mondane cleanups at the level of typos.welinder@troll.com1-2/+2
2005-04-07Keep track of computed target label lists per-function.Linus Torvalds1-0/+6
Associate them with each computed goto, and copy them properly when inlining.
2005-04-07Remove now-obsolete temporary statement types.Linus Torvalds1-6/+0
They were only used for the original pre-instruction linearization.
2005-04-07Add proper linearization of switch statements.Linus Torvalds1-0/+7
2005-04-07Split "STMT_GOTO_BB" into "STMT_CONDTRUE" and "STMT_CONDFALSE".Linus Torvalds1-1/+2
This lets us get the type of comparison right.
2005-04-07Linearize iterators, at least a first try at it.Linus Torvalds1-1/+1
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.
2005-04-07Add real flow control to the basic-block handling.Linus Torvalds1-0/+7
Right now we only really do trivial if-statements, but the ideas are all there now.
2005-04-07Update copyright notices to reflect the fact that TransmetaLinus Torvalds1-0/+1
isn't the sole copyright owner these days.
2005-04-07Clean up function inlining some, and fix the type of theLinus Torvalds1-0/+1
argument symbols that got corrupted by the incorrect partial symbol copy when creating the new argument symbols.
2005-04-07[PATCH] Make all the anonymous structures truly anonymousRyan Anderson1-9/+9
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>.
2005-04-07Create "inline.c", which contains the function "copy_statement()",Linus Torvalds1-0/+1
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.
2005-04-07Make function returns a bit more realisticLinus Torvalds1-0/+5
2005-04-07Simplify if-statements without even evaluating the false sideLinus Torvalds1-1/+0
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.
2005-04-07Parse and evaluate gcc computed goto extensions: label addressingLinus Torvalds1-0/+1
(&&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).
2005-04-07Parse C99 style 'for()' statements with variable declarations.Linus Torvalds1-0/+1
2005-04-07Fix switch/case statement show-parse.Linus Torvalds1-0/+1
2005-04-07Add comments about special terator/switch statement symbols.Linus Torvalds1-1/+1
Add a "case" symbol for the switch statement, to let the statement keep track of all the cases. This cleans up handling a lot.
2005-04-07Start updating the copyright license comments to the OSL,Linus Torvalds1-1/+3
preparing for a public release.
2005-04-07Show if/label/asm statements in a saner format.Linus Torvalds1-2/+3
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.
2005-04-07Turn 'break'/'continue' statements into goto's withLinus Torvalds1-2/+2
per-iterator anonymous symbols. Make arrays also gracefully degenerate into "void *".
2005-04-07Make statement and expression printouts be more "linearized", andLinus Torvalds1-2/+2
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".
2005-04-07Add some limited attribute parsing. "packed", "aligned" and "type".Linus Torvalds1-0/+2
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.
2005-04-07Change the copyright to Transmeta Corp, that's likely to beLinus Torvalds1-1/+1
the real one when it goes out the door.
2005-04-07Make labels be symbols in their own namespace (NS_LABEL).Linus Torvalds1-3/+3
This still gets the nesting scope wrong, though. Labels should use function scope, not block scope.
2005-04-07Remove last user of "struct token" from "struct expression".Linus Torvalds1-1/+1
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".
2005-04-07Make a function call point an expression type of its own, andLinus Torvalds1-1/+1
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.
2005-04-07Clean up type handling in a big way. Don't leave thoseLinus Torvalds1-0/+3
dangling anonymous "int_type" types with magic modifiers, but turn all types into explicit C types.
2005-04-07Replace for/while/do-while loops with a generic internalLinus Torvalds1-6/+9
'iterator' representation so that the parse tree doesn't have to care.
2005-04-07Move expression data structures to "expression.h", they gotLinus Torvalds1-41/+0
left behind in "parse.h" when the files were split.
2005-04-07Add copyright statements and file comments. Add a FAQ, README, andLinus Torvalds1-0/+5
placeholder LICENSE file.
2005-04-07Make iterators take a helper datum, and tell the callback whetherLinus Torvalds1-1/+1
the entry is the first or last. Make printouts prettier by using the new iterator functionality.
2005-04-07Bind symbols when declared. Bind arguments to functions.Linus Torvalds1-1/+3
Fix up function argument list to use a proper symbol list.
2005-04-07Fix up warnings by adding includes and the proper prototypes.Linus Torvalds1-0/+3
2005-04-07Fix cast parsing. Add parsing of gcc typeof/attribute stuff. Parse theLinus Torvalds1-0/+11
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_).
2005-04-07Add parsing for 'for', 'while', 'do', 'goto' and label statements.Linus Torvalds1-1/+17
2005-04-07Parse compound statements, 'break', 'continue', 'default', 'case' andLinus Torvalds1-0/+14
'switch' statements.
2005-04-07Parse if-else and return statementsLinus Torvalds1-4/+8
2005-04-07Parse a lot more types (including complex structures and unions andLinus Torvalds1-3/+7
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).
2005-04-07Start binding typedefs. More work needed, but this parses correctly:Linus Torvalds1-2/+3
typedef int a; a b = 0; Use new 'add_symbol()' infrastructure.
2005-04-07Add more type parsing: function and array declarators, functionLinus Torvalds1-0/+2
parameter lists etc. It can now parse things like const volatile int hello(const int (*argc)(void), const char *const* argv); apparently correctly.
2005-04-07Make for more readable "expected xxxx" messages.Linus Torvalds1-1/+1
Start parsing pointer, array and function types.
2005-04-07First cuts at simple type declaration and statement parsing.Linus Torvalds1-1/+25
2005-04-07Start handling minimal semantic information, needed for types.Linus Torvalds1-0/+5
This adds a layer of symbol information on top of the raw tokens.
2005-04-07Parse more C expressions.Linus Torvalds1-2/+8
Namespace handling (and types) still not even started.
2005-04-07Add simple recursive-descent C expression parsing (but we only do theLinus Torvalds1-0/+24
simple binops so far, type parsing is still way off). Clean up and update tokenization.