Bug 28364

Summary: [patch] flex(1) generated files fail to compile cleanly with -Wconversion
Product: Base System Reporter: avn <avn>
Component: binAssignee: Jung-uk Kim <jkim>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description avn 2001-06-23 12:40:02 UTC
lex(1) generates files which do not pass -Wconversion either with -ansi or
without it. This means, they won't compile under BDECFLAGS.

Fix: The patch below makes this sample to go cleanly under -Wconversion with
or without -ansi.
How-To-Repeat: --- Makefile ---
SRCS = a.l
PROG = a
NOMAN = yes
NOOBJ = yes
CFLAGS = -Wconversion -ansi -pedantic

.include <bsd.prog.mk>
--- a.l ---
%option noyywrap
%{
#include <stdio.h>
%}
%%
.		{ }
%%
int main(void)
{
	return 0;
}
--- end ---
produce the following warnings:
a.l: In function `yylex':
a.l:7: warning: passing arg 2 of `fwrite' as unsigned due to prototype
a.l: In function `yy_get_next_buffer':
a.l:246: warning: passing arg 3 of `fread' as unsigned due to prototype

Also, these warnings point to 'a.l' which is erroneous (obviously, a.l
does not have line 246 :).
Comment 1 ru freebsd_committer freebsd_triage 2001-06-23 12:57:57 UTC
Hello Alexey!

Could you please try to coordinate the acceptance of your
patch with the Flex maintainers?  (See lex/README.)

This way, we could import your fix as a vendor fix onto
the LBL branch.


Thanks,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 2 Rebecca Cran freebsd_committer freebsd_triage 2008-07-14 12:34:01 UTC
I suspect this bug has already been fixed in newer releases of flex: I
know I've come across similar bugs in 2.5.4 which are fixed even in
2.5.33 (the newest being 2.5.35).  Is there any chance that a newer
version could be imported into FreeBSD?

-- 
Bruce Cran
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-01-21 20:56:25 UTC
Responsible Changed
From-To: freebsd-bugs->bapt

please don't hate me
Comment 4 Baptiste Daroussin freebsd_committer freebsd_triage 2013-08-25 11:14:08 UTC
Responsible Changed
From-To: bapt->jkim

Over to new flex maintainer
Comment 5 Jung-uk Kim freebsd_committer freebsd_triage 2013-08-26 23:32:23 UTC
State Changed
From-To: open->closed

It is very easy to fix for WARNS=6, aka "BDECFLAGS". 

--- a.l 
+++ a.l 
@@ -1,4 +1,4 @@ 
-%option noyywrap 
+%option noyywrap noinput nounput 
%{ 
#include <stdio.h> 
%}