[Winpcap-users] [PATCH] mingw build

Guy Harris guy at alum.mit.edu
Wed Oct 6 17:02:27 PDT 2010

On Sep 14, 2010, at 9:17 AM, Alon Bar-Lev wrote:

> 4. grammar.y - any idea why we need pcap_parse if yacc defines it
> anyway instead of yyparse?


	1) WinPcap is based on libpcap;

	2) libpcap was originally written back when many UN*Xes had only the old AT&T YACC, which only defined yyparse().

The current top-of-trunk version of grammar.y, at least, defines pcap_parse() only if YYBISON is not defined, which presumably means "not Bison".

> 5. yacc does not accept -y argument.

Earlier versions of GNUmakefile mirrored the UN*X Makefile.in, and had a YACC variable that ran Bison, rather than YACC, with the "-y" flag (which, for Bison, means "act like YACC and produce y.tab.c and y.tab.h files").

The 4.1.2 version runs whatever make sets YACC to refer to, with the YFLAGS flag.  Is there some reason why that was done?  Was this to support parser-generators *other* than Bison?  Unless there's a compelling reason not to run Bison, it should probably go back to the way it was, using Bison - that'll fix that problem *and* the previous problem, with no changes required to grammar.y.

If there *is* a compelling reason not to run Bison, then

	1) it should not include "-y"


	2) either it should not do "-p pcap_", if whatever version of YACC is being used doesn't support "-p", or:

		2a) grammar.y should check for YYBISON *and* some other #define named appropriately for whatever parser-generator is being used


		2b) it should do "-D{that #define name}".

> 7. Minor modification of (char*)A += code.

(I.e., "casting lvalues considered harmful - and possibly rejected by some compilers.")

More information about the Winpcap-users mailing list