Bug 1074180

Summary: Don't warn about _BSD_SOURCE if _GNU_SOURCE is also defined
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: codonell, fweimer, hdegoede, jakub, law, pfrankli, spoyarek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-25 14:18:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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 ***