Bug 1074180 - Don't warn about _BSD_SOURCE if _GNU_SOURCE is also defined
Summary: Don't warn about _BSD_SOURCE if _GNU_SOURCE is also defined
Keywords:
Status: CLOSED DUPLICATE of bug 1067110
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-08 18:32 UTC by Hans de Goede
Modified: 2016-11-24 12:45 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-25 14:18:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hans de Goede 2014-03-08 18:32:14 UTC
Hi,

When compiling xorg code on rawhide, I get a ton of:

/usr/include/features.h:145:3: error: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

This is caused by xtrans.pc adding _BSD_SOURCE to cflags, so I wrote a patch to stop it from doing this:
http://lists.x.org/archives/xorg-devel/2014-March/040840.html

This has resulted in some discussion about this, and here:
http://lists.x.org/archives/xorg-devel/2014-March/040941.html

It was suggested that it would be better if glibc would not issue this warning in some other feature define which also encompasses all the features of the old define is also present. In the xorg case that would be _GNU_SOURCE, but the same argument could be made for _DEFAULT_SOURCE.

This way makefiles can simply add, ie: "-D_BSD_SOURCE -D_GNU_SOURCE" and simply have the code work
everywhere.

Thanks & Regards,

Hans

Comment 1 Carlos O'Donell 2014-03-14 22:25:08 UTC
The lists.x.org server seems to be down, so I haven't read the discussions.

In general we attempted to do what you suggest.

For example if you define _DEFAULT_SOURCE the warnins about _BSD_SOURCE will go away. That is to say that this works without warning: "-D_BSD_SOURCE -D_DEFAULT_SOURCE".

See:
https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes

Your suggestion seems to be that any feature test macro that encompasses whatever is in _BSD_SOURCE should disable the warning?

Comment 2 Hans de Goede 2014-03-15 09:21:18 UTC
(In reply to Carlos O'Donell from comment #1)
> Your suggestion seems to be that any feature test macro that encompasses
> whatever is in _BSD_SOURCE should disable the warning?

Yes more or less, I can understand if that is going to be a pain to maintain though, but it would be nice if at least the ubiquitous _GNU_SOURCE would turn of the warning.

If I understand you and  https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes correctly, I can also get rid of the warning by replacing "-D_BSD_SOURCE" with  "-D_BSD_SOURCE -D_DEFAULT_SOURCE" in the cflags in the pc file, correct ?

And yes I know it is weird to set these from a pc file, long story.

Comment 3 Hans de Goede 2014-03-25 14:18:22 UTC
(In reply to Hans de Goede from comment #2)
> If I understand you and 
> https://sourceware.org/glibc/wiki/Release/2.20#Packaging_Changes correctly,
> I can also get rid of the warning by replacing "-D_BSD_SOURCE" with 
> "-D_BSD_SOURCE -D_DEFAULT_SOURCE" in the cflags in the pc file, correct ?

That indeed fixes things, closing this.

*** This bug has been marked as a duplicate of bug 1067110 ***


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