Modify

Opened 4 years ago

Last modified 3 years ago

#1754 new task

_BSD_SOURCE in glibc apparently going away

Reported by: Roland Haas Owned by:
Priority: unset Milestone:
Component: SimFactory Version: development version
Keywords: Cc:

Description

I just stumbled accross https://lwn.net/Articles/634207/ which states:

--8<--
Also in 2.20, the _BSD_SOURCE and _SVID_SOURCE feature test macros have been removed. The declarations formerly available under those macros are now under _DEFAULT_SOURCE, but, since it's the default, one need not set it explicitly. Roland's suggestion, though, was that most code would (continue to) want to use _GNU_SOURCE or one of the POSIX-specific macros. (See this article for an introduction to glibc feature test macros).
--8<--

We use this in some of our option lists to make M_PI and strdup visible.

Attachments (0)

Change History (4)

comment:1 Changed 3 years ago by Roland Haas

For alternative options see #1712 which suggests _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED.

comment:2 in reply to:  description Changed 3 years ago by Frank Löffler

Replying to rhaas:

I just stumbled accross https://lwn.net/Articles/634207/ which states:

--8<--
Also in 2.20, the _BSD_SOURCE and _SVID_SOURCE feature test macros have been removed. The declarations formerly available under those macros are now under _DEFAULT_SOURCE, but, since it's the default, one need not set it explicitly. Roland's suggestion, though, was that most code would (continue to) want to use _GNU_SOURCE or one of the POSIX-specific macros. (See this article for an introduction to glibc feature test macros).
--8<--

Worth mentioning (should be obvious due to the quote, but wasn't for me), that this "Roland" isn't "our" Roland. :)

So, in order for us to support all glibc versions, should we define _BSD_SOURCE _and_ _DEFAULT_SOURCE?

Frank

comment:3 Changed 3 years ago by Roland Haas

Yes the "Roland" in the quote is not me.

We'd have to check. It is not clear to me what happens if one defines both say _DEFAULT_SOURCE and _POSIX_SOURCE, it may depend on how exactly things appear in feature.h. We may not have to do anything other than setting _BSD_SOURCE which will work for old glibc and new glibc will give us M_PI independent of whether or not _BSD_SOURCE is set (though maybe __STRICT_ANSI__ may cause issues). The help text spit out by configure when it finds that M_PI is not defined now says to use _XOPEN_SOURCE, since the actual definition of M_PI directly depends on __USE_BSD and __USE_XOPEN though that may be changed to something else of course. I'd say we leave things as they are for now until we actually encounter a system that has issues.

comment:4 Changed 3 years ago by Frank Löffler

Just defining _BSD_SOURCE I think will trigger a warning, unless _DEFAULT_SOURCE isn't defined as well.
https://lwn.net/Articles/590381/ :

The first of these patches converts _BSD_SOURCE and _SVID_SOURCE into synonyms for
_DEFAULT_SOURCE. The deprecated macros remain effective, but cause compile-time
warnings to be generated if they are used (unless _DEFAULT_SOURCE is also defined).

Last edited 3 years ago by Frank Löffler (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
Next status will be 'review'.
as The resolution will be set.
to The owner will be changed from (none) to the specified user.
Next status will be 'confirmed'.
The owner will be changed from (none) to anonymous.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.