Ethereal-dev: [Ethereal-dev] fix "parse error" with Debian's flex

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Martin Pool <mbp@xxxxxxxxx>
Date: Mon, 7 Jul 2003 17:25:18 +1000
When I build ethereal's CVS head under Debian unstable, I get a "parse
error" when building ascend-scanner.  For reasons I don't fully
understand, the .c file is somehow getting a macro definition of
ascendwrap() generated by flex, plus a function definition from
ascend-scanner.l.  I suspect the behaviour differs between different
flex versions because the same code works for other people.

Anyhow, this patch seems to fix it.

--- ascend-scanner.l.~1.23.~	2001-12-06 19:25:52.000000000 +1100
+++ ascend-scanner.l	2003-07-07 17:19:04.000000000 +1000
@@ -281,7 +281,15 @@ task:|task|at|time:|octets { return KEYW
 
 %%
 
+/* Some versions of flex seem to create a function-style macro
+ * ascendwrap(n) which returns 1.  (At least Debian's flex 2.5.31-12
+ * does.)  That clashes nastily with this function when the function
+ * name is replaced by the number 1, typically giving a parse error.
+ * -- mbp@xxxxxxxxx
+ */
+#ifndef ascendwrap
 int ascendwrap() { return 1; }
+#endif
 
 void ascend_init_lexer(FILE_T fh)
 {


-- 
Martin