Description of problem: Code generated by flex generates warnings when C99 support of gcc is enabled: Version-Release number of selected component (if applicable): flex-2.5.4a-37.4 How reproducible: always Steps to Reproduce: 1. Create file: %{ #define EOFTAG 1 %} eoftag ^EOF$ %% {eoftag} return EOFTAG; 2. Compile $ flex flextest.l && gcc -c -std=c99 lex.yy.c lex.yy.c: In function âyy_init_bufferâ: lex.yy.c:1219: warning: implicit declaration of function âfilenoâ Additional info: adding #define _POSIX_SOURCE 1 at the top of the generated file silences the warning.
This bugs me, too, but I have no idea how to fix it. Flex needs fileno to find out, if it's attached to terminal, in which case it uses interactive mode. So either we give up interactive mode, or we find out a way how to do isatty on FILE*. Now giving up interactive mode is fine for me, but I'm afraid it's not very good general solution.
But thinking about it, adding _POSIX_SOURCE would probably be the right solution.
The patch is in rawhide, and I've also pushed it for fc5.
This fix breaks code which expects to be able to use BSD symbols (such as u_short) from within code included by the lexer. See bug #199320.