[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix LEXLIB and YYTEXT_POINTER with IRIX 6.5 flex 2.5.4.
From: |
Ralf Wildenhues |
Subject: |
Fix LEXLIB and YYTEXT_POINTER with IRIX 6.5 flex 2.5.4. |
Date: |
Fri, 21 Jan 2011 21:57:04 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
http://autobuild.josefsson.org/automake/log-201101181921817456000.txt
On IRIX, the code from AC_PROG_LEX sees something like this:
$ cc -o conf lex.yy.c -ll
cc-1042 cc: ERROR File = conf.l, Line = 6
The types of operands "char *" and "int" are incompatible.
{ yyless (input () != 0); }
^
caused by something ugly like this:
| #define yyless(n) \
| do \
| { \
| /* Undo effects of setting up yytext. */ \
| *yy_cp = yy_hold_char; \
| YY_RESTORE_YY_MORE_OFFSET \
| yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
| YY_DO_BEFORE_ACTION; /* set up yytext again */ \
| } \
| while ( 0 )
|
[...]
| /* Redefine yyless() so it works in section 3 code. */
|
| #undef yyless
| #define yyless(n) \
| do \
| { \
| /* Undo effects of setting up yytext. */ \
| yytext[yyleng] = yy_hold_char; \
| yy_c_buf_p = yytext + n; \
| yy_hold_char = *yy_c_buf_p; \
| *yy_c_buf_p = '\0'; \
| yyleng = n; \
| } \
| while ( 0 )
which in turn causes an Automake test failure.
OK to push the fix below, even if it's to work around decade
old bugs?
Thanks,
Ralf
Fix LEXLIB and YYTEXT_POINTER with IRIX 6.5 flex 2.5.4.
* lib/autoconf/programs.m4 (_AC_PROG_LEX_YYTEXT_DECL):
Overquote nontrivial yyless argument, to compensate for
underquoted macro definition in IRIX 6.5 flex 2.5.4
leading to compile failure due to incompatible operands.
Fixes Automake silent-lex-generic.test failure.
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 0def8b2..fb3d8b9 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -724,7 +724,8 @@ a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
-e { yyless (input () != 0); }
+e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */
+ yyless ((input () != 0)); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
- Fix LEXLIB and YYTEXT_POINTER with IRIX 6.5 flex 2.5.4.,
Ralf Wildenhues <=