gnupic: Patch for "invalid lvalue in assignment" in scan.l
Subject:
Patch for "invalid lvalue in assignment" in scan.l
From:
Marco Pantaleoni ####@####.####
Date:
31 Oct 2004 15:56:19 +0000
Message-Id: <20041031155549.GB23129@lucifero>
Hi,
I've encountered a problem building the CVS version of gputils
on debian testing (with all released versions up to 0.12.4 everything
worked).
Here is a dump of the relevant make output:
flex -i scan.l
scan.l:122: warning, the character range [-ÿ] is ambiguous in a case-insensitive scanner
scan.l:122: warning, the character range [-ÿ] is ambiguous in a case-insensitive scanner
scan.l:304: warning, the character range [-ÿ] is ambiguous in a case-insensitive scanner
sed '/^#/ s|lex.yy\.c|scan.c|' lex.yy.c >scan.c
rm -f lex.yy.c
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../libgputils -I../include -Wall -pedantic -g -O2 -MT scan.o -MD -MP -MF ".deps/scan.Tpo" -c -o scan.o scan.c; \
then mv -f ".deps/scan.Tpo" ".deps/scan.Po"; else rm -f ".deps/scan.Tpo"; exit 1; fi
scan.l: In function `execute_macro':
scan.l:614: warning: use of conditional expressions as lvalues is deprecated
scan.l:614: error: invalid lvalue in assignment
scan.l: In function `repeat_while':
scan.l:635: warning: use of conditional expressions as lvalues is deprecated
scan.l:635: error: invalid lvalue in assignment
scan.l: At top level:
scan.c:2323: warning: `yyunput' defined but not used
make: *** [scan.o] Error 1
I've tried with gcc 3.3.3, 3.0.4 and 2.7.2.3 (on debian testing).
flex is 2.5.31
It seems that the problem is related to scan.l trying to assign to
YY_CURRENT_BUFFER.
Substituting YY_CURRENT_BUFFER_LVALUE in place of YY_CURRENT_BUFFER
in lines 614 and 635 solves the problem.
I attach a patch, hoping it could be useful to someone else.
Cheers,
Marco
--
========================================================================
Marco Pantaleoni ####@####.####
Padova, Italy
elastiC language developer http://www.elasticworld.org
diff -Naur gputils.orig/gpasm/scan.l gputils/gpasm/scan.l
--- gputils.orig/gpasm/scan.l 2004-10-18 02:59:25.000000000 +0200
+++ gputils/gpasm/scan.l 2004-10-31 15:52:18.000000000 +0100
@@ -610,7 +610,7 @@
state.src = new;
state.src->fc = add_file(ft_src, new->name); /* scan list for fc */
- YY_CURRENT_BUFFER = yy_scan_buffer(macro_src, macro_src_size);
+ YY_CURRENT_BUFFER_LVALUE = yy_scan_buffer(macro_src, macro_src_size);
}
@@ -631,7 +631,7 @@
state.src->lst.m = h->body;
yy_delete_buffer(YY_CURRENT_BUFFER);
- YY_CURRENT_BUFFER = yy_scan_buffer(macro_src, macro_src_size);
+ YY_CURRENT_BUFFER_LVALUE = yy_scan_buffer(macro_src, macro_src_size);
}