[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers
From: |
Peter O'Gorman |
Subject: |
Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers |
Date: |
Tue, 25 Dec 2007 21:06:14 -0600 |
User-agent: |
Thunderbird 2.0.0.9 (X11/20071115) |
Paul Eggert wrote:
> "Peter O'Gorman" <address@hidden> writes:
>
>> -e { yyless (input () != 0); }
>> +e { yyless ((input () != 0)); }
>
> Why is this patch necessary? yyless is supposed to take an int
> parameter, and another set of parentheses shouldn't affect the
> parameter's type or value.
After macro expansion that line turns into:
{ do { *yy_cp = yy_hold_char; yy_c_buf_p = yy_cp = yy_bp + input () !=
0 - 0; yytext = yy_bp; yyleng = (int) (yy_cp - yy_bp); yy_hold_char =
*yy_cp; *yy_cp = '\0'; yy_c_buf_p = yy_cp;; } while ( 0 ); }
The compiler barfs an error with:
yy_c_buf_p = yy_cp = yy_bp + input () != 0 - 0;
Reducing to:
yy_cp = yy_bp + input () != 0;
The compiler errors out with:
A value of type "int" cannot be assigned to an entity of type "char *".
yy_cp = yy_bp + input () != 0;
^
1 error detected in the compilation of "cpp.c"
Now, I am not sure if the compiler is right or wrong, and am not really
bothered either way, the AC_PROG_LEX test is producing incorrect results
on irix6.5 because of this error.
Now, looking at the expanded version, I am unsure if my patch is
correct, is the test supposed to be that input() != 0 or that (yy_bp +
input ()) != 0 ? At the moment, due to operator precedence, it is
testing that yy_bp + input () is non-zero, is that intentional?
Peter
--
Peter O'Gorman
http://pogma.com
- AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Peter O'Gorman, 2007/12/23
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Paul Eggert, 2007/12/25
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers,
Peter O'Gorman <=
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Peter O'Gorman, 2007/12/26
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Paul Eggert, 2007/12/29
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Peter O'Gorman, 2007/12/29
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Paul Eggert, 2007/12/29
- Re: AC_PROG_LEX broken on IRIX with MIPSpro Compilers, Peter O'Gorman, 2007/12/29