Bug 199316 - defining _POSIX_SOURCE breaks builds
defining _POSIX_SOURCE breaks builds
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: flex (Show other bugs)
rawhide
All Linux
high Severity high
: ---
: ---
Assigned To: Petr Machata
:
: 199320 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-18 16:38 EDT by Jason Vas Dias
Modified: 2015-05-04 21:32 EDT (History)
2 users (show)

See Also:
Fixed In Version: FC-6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-07-19 01:00:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2006-07-18 16:38:17 EDT
Description of problem:

The latest flex-2.5.4a version unconditionally defines _POSIX_SOURCE to 1
in the skeleton #defines of all flex generated code, with the new
flex-2.5.4a-posix.patch:

--- flex-2.5.4/skel.c   2006-07-14 15:30:18.000000000 +0200
+++ flex-2.5.4-pm/skel.c        2006-07-14 15:29:43.000000000 +0200
@@ -14,6 +14,8 @@ const char *skel[] = {
   "#define YY_FLEX_MINOR_VERSION 5",
   "",
   "%-",
+  "/* Use posix source, to silent c99 warnings about fileno. */",
+  "#define _POSIX_SOURCE 1",
   "#include <stdio.h>",
   "#include <unistd.h>",
   "%*",


I think this is a VERY bad idea, as it breaks builds that for instance 
use such constructs as 'u_long' ( if _POSIX_SOURCE is defined, then
_USE_BSD is undefined, and the 'u_long' typedef is not defined by 
sys/types.h ).

This has broken the dhcpv6 build so far (and possibly others) - I
now have to patch dhcpv6's flex code to '#undef _POSIX_SOURCE'
before including sys/types.h in order to get it to build.

I don't think avoiding any compiler warning warrants such a major
API change as defining _POSIX_SOURCE=1 by default - couldn't the code
be reworked so that the C99 compiler doesn't complain ?


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

How reproducible:
100%

Steps to Reproduce:
Generate any flex code that uses the 'u_long' type

  
Actual results:
The code won't compile

Expected results:
Code should be able to use flex and u_long and still compile.
Comment 1 Petr Machata 2006-07-18 17:11:23 EDT
So without posix, you don't have fileno.  With posix, you don't have u_long. 
This or that way you end up with invalid source.  I can't drop using fileno, as
someone else would miss /that/.

Hmm, ok, imposing posix because of warning is too much of a restriction.  I'm
reverting the patch and will look for better workaround to that warning.
Comment 2 Petr Machata 2006-07-18 17:20:38 EDT
*** Bug 199320 has been marked as a duplicate of this bug. ***
Comment 3 Petr Machata 2006-07-19 01:00:12 EDT
Just did a build. Should be available later today for fc4/5/6.
Comment 4 Jason Vas Dias 2006-07-19 02:45:44 EDT
Thank you! The new flex-2.5.4a-41.fc6 version now works OK.

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