Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 195687 - Generated code does not compile cleanly as C99
Generated code does not compile cleanly as C99
Product: Fedora
Classification: Fedora
Component: flex (Show other bugs)
i386 Linux
medium Severity low
: ---
: ---
Assigned To: Petr Machata
Depends On:
  Show dependency treegraph
Reported: 2006-06-16 12:09 EDT by Pawel Salek
Modified: 2015-05-04 21:32 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-07-14 09:50:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pawel Salek 2006-06-16 12:09:52 EDT
Description of problem:
Code generated by flex generates warnings when C99 support of gcc is enabled:

Version-Release number of selected component (if applicable):

How reproducible:

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.
Comment 1 Petr Machata 2006-07-12 06:00:04 EDT
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.
Comment 2 Petr Machata 2006-07-12 06:16:15 EDT
But thinking about it, adding _POSIX_SOURCE would probably be the right solution.
Comment 3 Petr Machata 2006-07-14 09:50:49 EDT
The patch is in rawhide, and I've also pushed it for fc5.
Comment 4 Simon Wilkinson 2006-07-18 17:17:27 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.