2009/1/15 Francois Gouget fgouget@free.fr
On Wed, 14 Jan 2009, Eric Pouech wrote:
Francois Gouget a écrit :
Hi,
I have noticed that expr_alloc_uconstant() is unused in winedbg. Is that normal?
the main point is that the lexer only returns signed integers, while it should return both signed and unsigned integers
Actually, as far as I can tell, the lexer can only match unsigned integers:
DIGIT [0-9] HEXDIGIT [0-9a-fA-F] "0x"{HEXDIGIT}+ { sscanf(yytext, "%x", &dbg_lval.integer); return tNUM; } {DIGIT}+ { sscanf(yytext, "%d", &dbg_lval.integer); return tNUM; }
Both 'regexps' only match unsigned integers. And yet they are scanned with %d instead of %u. And then this continues in the grammar:
tNUM { $$ = expr_alloc_sconstant($1); }
So maybe we should treat all these as unsigned, use expr_alloc_uconstant(), and then it is expr_alloc_sconstant() that would be unused?
Or should we really accept negative integers in the lexer?
actually, doing what you suggest would help the lexer, but will put the issue a bit later in the expression computation package, where only signed ints are computed (and moreover that code is likely to be broken on a 64bit CPU) so, moving to a unsigned requipes also to fix expr.c A+
--
Eric Pouech