| Age | Commit message (Collapse) | Author | Files | Lines |
|
and system in cgcc.
|
|
into ppc970.osdl.org:/home/torvalds/BK/sparse
|
|
The current gcc initializer code is too permissive, AFAICS - [0][0] 1
will be rejected by gcc too, so we shouldn't consider it "broken gcc syntax".
There was another bug in there -
*ep = NULL;
token = initializer(ep, token);
if (!expr)
break;
add_expression(list, expr);
would not catch the case when we have e.g. .foo = <bad expression> and we
end up with list polluted by EXPR_IDENTIFIER with NULL ->ident_expression.
Should be if (!*ep) instead.
This also cleans it up by splitting the list handling case up from the
loop, and making the single initializer parsing a function of its own.
|
|
gcc.
|
|
Teach sparse to ignore the "model" (aka "__model__") attribute used by
ia64 linux.
Signed-off-by: davidm@hpl.hp.com
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
into troll.com:/scratch/welinder/solaris
|
|
Most of the kernel ones have long since been converted. This might
help convert the last few hold-outs.
|
|
|
|
It's not an error, it just is pretty rare. It happens when there
are bitfields that are all at byte offset zero, and we need to
allocate a new EXPR_POS when we offset these bitfields due to
them being inside a nested initializer.
|
|
specifiers.
They now parse the same way as __attribute__ node-specifiers. This
simplifies the code, and makes sparse not care about random gcc
rules for exactly where one or the other can be placed.
|
|
|
|
Instead of trying to handle two- and three-argument ?: in the same code,
have evaluate_expression() turn the expression 'v1 ? : v2' into its
equivalent of '(temp_var = v1, temp_var ? temp_var : v2)' and use the
normal logics to deal with the results.
|
|
- handling of "unexpanded identifiers should be replaced with 0" is
moved to pre-process.c and done on token replacement level
- warning about such replacement made conditional
- expand() and expand_one_symbol() return int now - it's "is the first
token completely expanded now" (simplifies the life in #if handling,
etc.)
- crud removed from evaluate.c and expand.c
|
|
a) we allow enum have an equivalent type other than int (it is kept in
->ctype.base_type for SYM_ENUM types). Code adjusted.
b) enum declaration parsing tries to determine the equivalent type; if
such type does not exist we set it to &bad_enum_ctype and
examine_symbol_type() generates a warning when it meets such beast.
The rules for equivalent type follow:
1) if all members have the same bitwise type, it is the
equivalent type of enum.
2) if all members have integer types and there is a single
integer type capable of representing all their values, we pick
the first such type (in the same ordering that is used for e.g.
integer constants).
3) anything else => bad_enum_ctype.
c) enum is compatible with its equivalent type.
d) it is an error to have implied initializer for a member following
that of bitwise type.
There are still issues with float in enums, but since gcc would choke on
those unconditionally, we can be sure that there's no instances in any
code we could deal with (unless we start playing with Plan 9 codebase,
and that would require more work in other places - float enum is not the
only C extension in there). Separate patch...
|
|
|
|
|
|
Noted by Chris Wedgwood.
|
|
Such a structure does not have its size padded up by the alignment,
since arrays of such structures are meaningless anyway.
|
|
|
|
|
|
|
|
mingw works fine, but cygwin needs <sys/stat.h> for stat structure
definition.
|
|
First cut at CygWin/MinGW compat support.
Currently, for mingw, I am using windows API to identify the files
uniquely, which is somewhat heavy because I have to open both the files
simultaneously to compare the indices, will replace it to a lighter
version later if I find out how to do that.
|
|
up for various system deficiencies.
This makes sparse easier to port to silly things like
MinGW or Solaris. In particular:
- strtold() is a C99 thing, not everybody has it
- MinGW has problems with mmap(MAP_ANONYMOUS) and doesn't zero it.
- st_ino/st_dev is POSIX identity testing, not supported by MinGW
|
|
This changes the sparse Makefile to use $(CC) (which is already defined
at the top) instead of using gcc directly. That makes it possible to
use "make CC=/long/path/bin/gcc".
|
|
|
|
they got initialized with.
This is not how standard C works. 'enum's are normally
just integers. Tough.
|
|
This should mean that the initializers are nicely sorted
in ascending order, which makes it possible to check for
duplicates and just in general is a good idea. We also need
the sorted order to emit the dang things, after all.
|
|
is just different enough to be confusing.
Thank you, thank you, I'll be here all week. Please remember
to tip your waitresses.
|
|
Otherwise the inner levels get the wrong offsets, because they
haven't added up the depth of the outer ones yet.
|
|
We move the offset from EXPR_POS into each of the EXPR_INITIALIZER
entries - they should all have an EXPR_POS themselves, except for
one potential zero-offset one (which we turn into an EXPR_POS by
re-using the now unused nested EXPR_INITIALIZER).
|
|
The EXPR_INDEX "to" thing is the last entry, while EXPR_POS
wants the number of entries (to+1 - from). Off-by-one error
resulted.
|
|
They happen with the new
struct xxx x = { .a.b[10].c = val; }
syntax.
|
|
|
|
Again, this allows us to continue past errors.
|
|
Obviously we should have just exited earlier, but this allows us to
survive past errors.
|
|
That just happens when an initializer has already been
evaluated once before, and the other positional expressions
have been convered to EXPR_POS.
Nothing more to do.
|
|
positional markers be hierarchical rather than a flat list.
This makes the data structure a bit more complex, but it simplifies
some of the code, and makes it possible to evaluate complex initializers
without going insane.
In particular, we how support
struct xxxx var = {
.a.b[10] = 1;
};
which we couldn't handle at all before (it had to
be written as
struct xxxx var = {
.a = {
.b = { [10] = 1; }
}
}
or similar.
The new code changes all array indexes and structure members
to EXPR_POS expressions offset from the "outer" scope (either
start of the symbol, or an outer EXPR_POS).
|
|
Pointed out by Mitesh shah <mshah@teja.com>
|
|
The "char **next" argument is confusing. It is in fact the pointer
to the _current_ argument.
|
|
This just parses them, we don't actually handle them correctly
afterwards. One step at a time.
|
|
issues and to get error checks.
|
|
|
|
This enables the type sign warnings. They don't seem to be
all that valid most of the time, so an explicit warning knob
seems to be called for.
|
|
We always warn about clashing _explicit_ signs.
We don't warn about non-explicitly signed "char".
The non-explicitly signed other types are still under
consideration, but for now we warn about them with a
different warning message.
|
|
|
|
We've got a fair number of these in the kernel, because
gcc historically hasn't checked it right, so lots of small
problems have crept in. But gcc-4 will check, and we really
should clean it up.
Make the warning string a bit more readable for the sign-only
difference case. NOTE! We're very anal about these things because
we check for _explicit_ signedness differences too. That might
be overkill, of course.
|
|
Print out a user-supplied sparse warning, possibly conditional.
Ie:
__builtin_warning("This should warn");
__builtin_warning([typeof(x)] == [int], "'x' is an integer");
Any C expression can be used for a conditional (or set of conditionals,
they all have to be true for the warning to trigger), but something is
considered "true" only for a non-zero compile-time integer constant.
|
|
so common that we might as well make it a proper operation.
|
|
A typeof on expression with bad type will result in segfault in
examine_symbol_type() when we get to SYM_TYPEOF case in switch.
void a(void)
{
typeof(*1) a;
a ? 1 : 0;
}
|
|
- make sure we convert the true expression in the tree,
not just in our local copy
- fix restricted binop checks (too much cut-and-paste)
|
|
We used to trigger the size check only when shifting constant
values by a constant value. Which is obviously bogus - we should
check the shift amount even for a non-const left side.
Noticed by Eric Sesterhenn
|
|
Caught by checking sparse with itself.
|
|
The only remaining place was the magic constant "0" "1" number
token generated by "defined(xxx)". And since we never actually
modify number tokens (which would have broken that code anyway),
let's just make that const'ness explicit.
|
|
|
|
|
|
warn->warning
error->error_die
new error
lib.h:
warn->warning
error->error_die
new error
Add gcc format checking to warning/error/...
|
|
Add s(char|short|int|long|longlong)_ctype.
show-parse.c:
Print "signed" as part of the type names when needed.
parse.c:
Add separate ctypes for signed char, short, int, long, and long long.
Make ctype_integer pick the explicitly signed type as needed.
|
|
Warn for "int foo (...);".
|
|
NS_PREPROCESSOR doesn't have any sym->ctype at all.
|
|
It's also used by SYM_MACRO preprocessor symbols (the
regular "lookup_symbol()" sets it), and thus it has to
be shared, not in a private part of a union.
|
|
Make "label_type" be a real ctype, rather than an uninitialized
mess.
|
|
It _used_ to be initialized to zero (SYM_BASETYPE) automatically,
but Chris added SYM_PREPROCESSOR at the beginning, without realizing
that there was a magic reason for SYM_BASETYPE being zero.
Rather than just re-instate the magic, let's just do the sane thing
instead and initialize the base types properly.
|
|
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.
|
|
This all started with I want to remove match_string_ident in preprocessor.
I decide that I don't want to search a pointer in the list. There is faster
way which is register a symbol with a new name space which contain the
handler.
This changes:
1) changed name of NS_PRECESSOR to NS_MACRO and give it a new meaning
for preprocessor command. Now NS_MACRO means a macro name, and the
new NS_PREPROCESSOR means a preprocessor command.
2) The ctype and preprocessor can put into one union. They are on
different name space so they _should_ never collapse. I did that and
made struct symbol 8 bytes smaller. Nothing blew up for me so it
must be correct ;)
And a question:
3) When to initialize the preprocessor command symbol. Should we make
it part of the init_symbol or let the caller(check.c) initialize it?
Do we want to remove the preprocessor command afterwords?
|
|
Our current PREPARE_PTR_LIST/RESET_PTR_LIST implementation
has a bug: if we ever hit a block of pointers where every
single pointer has been deleted, it doesn't understand to
skip over it, and instead uses the first (deleted) entry.
This at least causes a nice SIGSEGV rather than random
behaviour. I'll have to think about how to do the PTR list
traversal fix nicely.
|
|
Here is the second step to get ride of the old list iterator using
the new infrastructure.
|
|
|
|
..and switch us entirely over to the new naming scheme.
All the nasty work of going through the users thanks to Chris Li.
|
|
This prepares for the next stage, which is to make sure
that we can name nested FOR_EACH_PTR() levels.
|
|
Use the existing access macro instead.
|
|
modify the list.
Pointed out by Chris Li.
|
|
packing blocks.
The entrypoint doesn't necessarily end up being the first
basic block in the list of blocks after we have packed them.
|
|
Noticed by Chris Li.
|
|
Handling of __attribute__((bitwise)) in a way that should be easy to extend
afterwards. Example of use:
typedef __u32 __attribute__((bitwise)) __le32;
That will create a new 32bit type that will be assignment-incompatible with
anything else. The set of allowed operations is restricted to bitwise ones,
the only allowed constant is 0 right now. Forced casts are allowed, so is
cast from type to itself and cast to void. Any other cast will give a warning.
Checks are triggered by -Wbitwise in command line; if it's not there,
attribute will be silently ignored.
|
|
* handling of bitfields taken to a helper function.
* reading and handling list of attributes taken to a helper function.
* caller became readable...
|
|
The unary operation allowed for integers but not for floats is ~, not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to dependency related.
|
|
|
|
Identifiers are unique objects, so we can just compare the pointers
directly, if we just set up the identifiers first.
Identifier setup simplified as suggested by Linus.
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
It's kind of redundant to check for integer constants twice. "Just
to make sure" doesn't cut it ;)
Noted by Morten Welinder <terra@gnome.org>
|
|
Make eval_init_table static.
pre-process.c:
Fix match_string_ident.
|
|
|
|
Check for unterminated #if on a per-stream basis.
Check for #else after #else or #elif.
Check for unmatched #else/#elif/#endif on a per-stream basis.
|
|
is not constant. Not that it really matters, but still...
|
|
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
Also add some infrastructure to make it easier to add new
random command line options.
|
|
Maybe this makes us gcc-compatible. Maybe it doesn't.
|
|
It's trivial now with the re-organized include path handling.
|
|
This is a cunning plan to make "include_next" work. This
is just the infrastructure. Actual include_next handling
in the next patch.
|
|
From Dave Jones <davej@redhat.com>.
|
|
into ppc970.osdl.org:/home/torvalds/BK/sparse
|
|
Fix file-is-const for #define, #undef, C-code inside
the #ifndef.
Make it easy to debug file-is-const.
tokenize.c:
Fix check for identical-file.
token.h:
Introduce symbolic names for the stream->constant states
and comment those states.
|
|
declarations.
Complain about extraneous bogus declarations, and make
a better warning for missing ones.
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
My silly test file was a bit _too_ simple, and missed the
fact that the parser would have missed the first token in
the function body ;)
|
|
We used to require the "void" thing, but if we parse
K&R we can no longer do that. So just silently allow
an empty parameter type list.
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
I didn't even realize that K&R allowed the declaration of the
types to be in a different order than the arguments themselves.
Anyway, that's easy to handle, although we should probably also
check that we don't declare some name that doesn't exist.
|
|
char/short types promote to "int" in K&R function declarations.
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
Hey, this is still wrong. A "char" should be promoted
to "int" etc, and we don't do that. So it's kind of
half-K&R, half-ANSI.
|
|
HOWEVER! We don't actually go and apply the types to the
arguments yet, so this is purely a "parse only" fix. To
actually make K&R functions work, we'd need to match up
the re-declared arguments against the argument list.
All the information is there now, though. Somebody more
interestedin K&R could fix it up.
|
|
|
|
A "might take an exception" expression may not be re-ordered very
much wrt other expressions, but it _can_ be dropped entirely if it
is part of an expression that has no other effect.
In contrast, a real side effect obviously can't be dropped.
|
|
|
|
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
They are used by the Linux kernel for referring to assembler
symbols without a type (you can obviously only take the address
of such a symbol, not use it for anything else).
|
|
|
|
Check tags when naming tagged types.
This catches things like...
enum Foo { FOO };
struct Foo x;
|
|
When we don't have bugs all the time, we can strip it
again, but for now it just makes debugging harder.
|
|
|
|
|
|
When dereferencing an array, it degenerates into a pointer
to the first entry of the array. We did all that correctly
from a type standpoint, but we didn't actually do the
"addressof" operation on the tree itself.
This fixes up the tree properly.
Problem noticed by Chris Li.
|
|
Chris Wedgwood pointed these out.
|
|
have accepted them in the first place.
|
|
|
|
|
|
With help from Christopher Li <sparse@chrisli.org>.
|
|
|
|
|
|
Get the right signedness (which broke when the code moved here).
|
|
into troll.com:/scratch/welinder/sparse-for-linus
|
|
Don't bail out if left argument of , has type error - we can continue
just fine at that point. Reduces cascades of bogus warnings and allows
to catch real ones in the right argument.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Unless the cast is to void, both argument and result should be
scalars. Checks added.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
<op>= handling. Basically, we rewrite
*p += v
into
(temp = p, *temp = *temp + v)
and similar for bitfield lvalues.
evaluate_assignment() adjusted accordingly.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
1) Eliminate double evaluate_conditional() on loop condition -
we get the same reference both in ->iterator_post_condition and
->iterator_pre_condition and evaluate_statement() didn't take that
into account.
2) In handling of if() do not bail if evaluate_conditional()
had failed - that way we'll catch what there is to catch in ->if_true
and ->if_false (their evaluation doesn't depend on type errors in
condition) _and_ won't get noise from linearizer confused by unevaluated
statements.
3) In <expr>; do not try to degenerate the expression if
evaluate_expression() had failed - again, less noise that way.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Ignore MOD_EXPLICITLY_SIGNED for type comparisons.
|
|
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
When we copy the body of inlined function, we leave more nodes shared
than we should - they might be mangled by evaluation of copy. Fixed.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Found by Dave Jones and 'valgrind'.
|
|
|
|
Cset exclude: welinder@troll.com|ChangeSet|20040812190029|57250
Cset exclude: welinder@troll.com|ChangeSet|20040812184608|57271
Cset exclude: welinder@troll.com|ChangeSet|20040812175907|57697
Cset exclude: welinder@troll.com|ChangeSet|20040812160921|53242
|
|
|
|
evaluate_comparison()
Fix handling of replaced comparisons in expression. We are handling
unsigned comparisons by replacing the expr->op with new special values
(SPECIAL_UNSIGNED_{LT,GT,LTE,GTE}) which works fine, but confuses the
hell out of show_special(). As the result, test-linearize simply
segfaults on any code that contains unsigned comparison.
This patch fixes that by teaching show_special() to handle these guys
and making sure that tokenizer doesn't get confused (it uses the same
set of strings to recognize punctuators).
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Handling of non-lvalue compound objects:
We introduce a new primitive - EXPR_SLICE. Meaning is "that many bits
from that offset in that non-lvalue struct or union". It is used when
we try to get a member out of a non-lvalue struct or union (subsequent .<field>
just narrow the slice). And as far as scalar, struct and union fields count,
that's it. The only subtle point is handling of array fields. And there
I'm doing what C99 requires - they *do* decay to real, honest pointers,
causing a copy of object to memory if needed. We get an anonymous object
that lives until the next sequence point; optimizer is certainly free to
get rid of it completely if it can make do with the value we'd copied there.
Note that you _are_ allowed to say
foo().a[1] = 0;
It doesn't make sense, since the value you've assigned will be immediately
lost (and any optimizer will turn that into f()), but it is legitimate and
it avoids a *lot* of PITA in describing semantics.
It covers only array decay - any other member of non-lvalue struct or union
is *not* an lvalue and in
struct foo {int x; int y[2];};
struct foo a(void);
...
a().x = 0; /* not allowed, non-lvalue */
a().y[0] = 1; /* allowed, but pointless */
you will get an error from the first assignment, but not from the second
one.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Muck with solaris predefines to suit solaris libc.
|
|
Fix double warnings on type mismatch in inline arguments; once we'd got
a warning, cast the damn thing and be done with that.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Bitfields in structure declarations can have attributes; teach
parser to handle them.
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
Linux/Solaris split. Keep it minimal for now.
|
|
Don't complain over undefined preprocessor symbols that start
with an underscore.
This helps quiet a gazillion errors with _cplusplus and others
used by solaris' system headers.
This change may or may not be approapriate on a glibc system.
|
|
Use __SIZE_TYPE__
Define __builtin_alloca.
lib.c:
Pre-define __SIZE_TYPE__
|
|
Add __unix__ and variants to create_builtin_stream.
|
|
Under __sun__, implement a strtold.
|
|
Don't clear MOD_EXPLICITLY_SIGNED in indirect.\
symbol.c:
Add modifier MOD_EXPLICITLY_SIGNED to all versions of "signed".
check for integer bitfields that are just "int foo : 42".
symbol.h:
Define MOD_EXPLICITLY_SIGNED.
This will be used to distinguish "int" and "signed int".
show-parse.c:
Show MOD_EXPLICITLY_SIGNED as "[explicitly-signed]".
|
|
Move bitfield parsing into struct/union parsing where it belongs.
Sanity check bitfield widths.
|
|
Check for signed one-bit bitfields.
|
|
Handle __noreturn__ as noreturn (==ignore).
|
|
Disallow "void" parameters and "void" variables.
|
|
Check that "signed", "unsigned", "long", ... only occur where they may.
Notably not as "signed double" or "long struct { ... }".
|
|
Never call isdigit/isspace on type char, use unsigned char only.
|
|
Check for multiple storage classes such as "static extern".
|
|
Handle -MF foo, -MQ foo, and -MT foo.
|
|
Handle integer overflow in unary minus.
|
|
Gnome needs lots of -Ipath -- just up the limit a whole lot.
|
|
Lack of __word__ noted by Dave Jones.
|
|
|
|
check.o doesn't have LIB_H dep, trival fix below. with this you can:
make clean
bk -r clean
make -j install
and it works as expected
|
|
MW prefs.
|
|
This would be handy. ("visibility" is a linkage directive.)
|
|
Don't allow nonsensical type descriptions like
signed unsigned x;
short long x;
double x : 4;
int y : 1 : 2;
|
|
Another case of prematurely loading floating point values.
|
|
Ideally we should probably allocate an error code for recursive expand,
so the caller can know that the inline did not expand at all.
But the evaluate_symbol_call don't care about that so I just make it
reutrn 0.
|
|
In particular:
- we should only test (and not mark busy) the things a
register aliases when we allocate it. This bug kept
us from using %edx, because when we used %eax, we
bogusly marked the 64-bit combination %eax:%edx as
being busy, and refused to use %edx later.
- "get_reg_value()" should take a regclass, so that we
can allocate a new reg from a valid class.
|
|
into a 16-bit one, and into the "high byte" version.
|
|
|
|
If we are loading something into a register, and another
register has that value already cached, used the cached
register value.
|
|
(And ignore the ACCESSED bit when comparing types)
|
|
|
|
This still does just mainly EXPR_SELECT, since that
is what I'm familiar with. It's also extremely lazy
about invalidating register content info, since any
code that hasn't been moved to the new format won't
do things properly.
Very much a work-in-progress, designed to eventually
allow us to generate some kind of half-readable code
from the SSA form.
|
|
Instead of using fixed register names, we keep track of
busy registers, and allocate them as needed.
Also changed EXPR_SELECT to actually use this.
|
|
|
|
We don't actually _use_ any of them yet, but this lists them,
and adds the information about which register conflicts with
which register (eg %al conflicts with %eax, but not with %ah)
|
|
code emitter. Don't make the code emission have to know
about symbol lists etc.
Thus the code emitter can do whatever it wants to do to
the symbols as they are encountered, as part of the main loop
rather than as a separate phase afterwards. Straightforward.
|
|
Since the "struct instruction" format doesn't allow for
all the data a select needs, we create two pseudo-instructions
instead, and generate a select as a combination of the two:
OP_SETCC + OP_SEL.
We should possibly do the same thing for conditional branches.
|
|
It gets them wrong right now: we can't just use "and" and "or",
we need to convert to canonical logical form (0/1) too.
But it's documentation.
|
|
They are valid now that we have a EXPR_SELECT type for
safe conditionals.
|
|
"constantness" is probably not a word.
|
|
Make linearize.h show the right ops for the logical (as opposed to
binary) and/or EXPR_BINOP.
|
|
expression.
This is just a very high-level cost, mainly distinguishing
between "safe" and "unsafe" operations, so that we can
determine if we can turn a C conditional into a select
statement, or a logical op into one without short-ciruiting.
|
|
It's the same as a regular C conditional, except you could
evaluate both sides first. Right now we treat it exactly
the same as an EXPR_CONDITIONAL.
|
|
By virtue of attempting to be too smart, the conditional expression
handling ("x ? foo : bar") would evaluate both 'foo' and 'bar', and
then use the cmov instruction to determine the result, avoiding a
branch in the process.
Unfortunately this only makes sense for simple things (EXPR_VALUE,
EXPR_SYMBOL) and is quite wrong for everything else.
Changed so that 'if' statements and conditional expressions use
largely the same code.
|
|
* Mostly revert function call stack frame construction
("correctly generate push* instruction")
* Add comment regarding ABI-dictated function call argument size
* Clamp function call arg size to 32-bit minimum. This will copy
the correct value to the stack at the correct alignment, but
(SECURITY/FIXME) will also copy extra bits (24 bits for an
8-bit value, 16 bits for a 16-bit value).
* Add EXPR_FVALUE to the 'unhandled' portion of the master
emit-expression 'switch' statement.
|
|
into ppc970.osdl.org:/home/torvalds/BK/sparse
|
|
Assumptions that values are 32-bit still remain in places, but
some simple test cases involving 8-bit and 16-bit variables
seem much more sane now.
|
|
Goto's of the form "goto *&&label" might actually end up
happening as part of constant folding. And even if they
don't, this is the RightThing(tm) to do.
|
|
I really don't know why we didn't do this before. Not
copying all fields is a bug, but maybe there was a reason
that isn't immediately obvious. If so, maybe we'd comment
on it next time.
|
|
Stupid stupid bugs. This makes inlining work a lot better.
|
|
We need to emit an OP_COMPUTEDGOTO instruction with a
full list of potential targets.
|
|
Associate them with each computed goto, and copy them properly
when inlining.
|
|
This is the format gcc will output the line information in, for example.
We still don't actually _use_ the information, and perhaps never will,
but at least we'll silently ignore it rather than complain.
|
|
Stuff from bison contains #line directives. This makes sparse ignore
such lines. This helps but doesn't exactly make sparse happy over such
.c files.
(Ignoring isn't quite right because, arguably, later error messages should
refer to the file from which the c code was generated, not from the c code
itself.)
|
|
Pay attention to size of function arguments when pushing them to stack.
Generate "pushb" for char, "pushw" for short, ...
[ Linus' note: this is likely "wrong". In a real x86 compiler, we'd
expand the width of the argument to 32 bits regardless, but from
a demonstration standpoint this is better ]
|
|
We already have a function that adds correct {b,w,l,q} suffix.
|
|
{'b', 'w', 'l', 'q'} instead of {ascii 8, ascii 16, ' ', '@'}
|