Package: flex Version: 2.6.4-8.2 Severity: minor Tags: patch The flex binary package comes with examples under /usr/share/doc/flex/examples/fastw .
These were from 2016 and don't work as expected with current gcc and flex. Attached patch fix these issues. * need "int" for main * need tailing "%%" I think these may have been OK with old tool chain but they cause trouble these days. Now these can be compiled with ``` gcc -lfl mywc.c -o mywc for f in 1 2 3 4 5; do flex wc$f.l gcc -lfl lex.yy.c -o wc$f rm -f lex.yy.c done ``` These example files are from upstream source under https://salsa.debian.org/srivasta/flex/-/tree/master/examples/fastwc/ -- System Information: Debian Release: 12.2 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 6.4.0-0.deb12.2-amd64 (SMP w/12 CPU threads; PREEMPT) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages flex depends on: ii debconf [debconf-2.0] 1.5.82 ii libc6 2.36-9+deb12u3 ii m4 1.4.19-3 Versions of packages flex recommends: ii gcc [c-compiler] 4:12.2.0-3 ii gcc-12 [c-compiler] 12.2.0-14 ii libfl-dev 2.6.4-8.2 Versions of packages flex suggests: ii bison 2:3.8.2+dfsg-1+b1 ii build-essential 12.9 ii flex-doc 2.6.4-8.2 -- no debconf information
diff -Nru fastwc-orig/mywc.c fastwc/mywc.c --- fastwc-orig/mywc.c 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/mywc.c 2023-10-31 13:23:40.545931128 +0900 @@ -3,7 +3,7 @@ #include <stdio.h> #include <ctype.h> -main() +int main() { int c, cc = 0, wc = 0, lc = 0; FILE *f = stdin; diff -Nru fastwc-orig/wc1.l fastwc/wc1.l --- fastwc-orig/wc1.l 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/wc1.l 2023-10-31 13:23:48.742047498 +0900 @@ -17,3 +17,4 @@ printf( "%8d %8d %8d\n", lc, wc, cc ); yyterminate(); } +%% diff -Nru fastwc-orig/wc2.l fastwc/wc2.l --- fastwc-orig/wc2.l 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/wc2.l 2023-10-31 13:23:58.150181074 +0900 @@ -19,3 +19,4 @@ printf( "%8d %8d %8d\n", lc, wc, cc ); yyterminate(); } +%% diff -Nru fastwc-orig/wc3.l fastwc/wc3.l --- fastwc-orig/wc3.l 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/wc3.l 2023-10-31 13:24:06.806303970 +0900 @@ -23,3 +23,4 @@ printf( "%8d %8d %8d\n", lc, wc, cc ); yyterminate(); } +%% diff -Nru fastwc-orig/wc4.l fastwc/wc4.l --- fastwc-orig/wc4.l 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/wc4.l 2023-10-31 13:24:21.638514548 +0900 @@ -26,3 +26,4 @@ printf( "%8d %8d %8d\n", lc, wc, cc ); yyterminate(); } +%% diff -Nru fastwc-orig/wc5.l fastwc/wc5.l --- fastwc-orig/wc5.l 2016-10-21 09:43:44.000000000 +0900 +++ fastwc/wc5.l 2023-10-31 13:24:32.578669865 +0900 @@ -23,3 +23,4 @@ printf( "%8d %8d %8d\n", lc, wc, cc ); yyterminate(); } +%%