Obsolete and Removed POSIX Functions

Eric Blake eblake@redhat.com
Wed Feb 17 16:58:00 GMT 2016


On 02/17/2016 09:53 AM, Corinna Vinschen wrote:

>> Technically it would be possible to mark these
>> __attribute__((__deprecated__)) if __POSIX2008_VISIBLE.  I'm not sure if
>> that *should* be done or not.
> 
> I'm really not sure about that.  How's that handled in BSDs or GLibc?
> I think none of them adds the deprecated attribute to functions still
> implemented and mentioned in *some* standard.
> 
>> There are some cases where __CYGWIN__ and/or __rtems__ are used because that
>> feature is only implemented on those system(s) and other cases where they
>> are clearly in place of a proper feature test.  The question is if the
>> headers really need to reflect the former.
> 
> Probably not, unless it's required to guard against contradicting
> definitions (e.g., in rtems/Cygwin-only headers).

glibc actively removes gets() unless you specifically request an older
standard, and meanwhile marks it as deprecated even for the standards
where it is fully defined:

> #if !defined __USE_ISOC11 \
> || (defined __cplusplus && __cplusplus <= 201103L)
> /* Get a newline-terminated string from stdin, removing the newline.
> DO NOT USE THIS FUNCTION!! There is no limit on how much it will read.
> 
> The function has been officially removed in ISO C11. This opportunity
> is used to also remove it from the GNU feature list. It is now only
> available when explicitly using an old ISO C, Unix, or POSIX standard.
> GCC defines _GNU_SOURCE when building C++ code and the function is still
> in C++11, so it is also available for C++.
> 
> This function is a possible cancellation point and therefore not
> marked with __THROW. */
> extern char *gets (char *__s) __wur __attribute_deprecated__;
> #endif


> 
> 
> Corinna
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20160217/5a49d1ef/attachment.sig>


More information about the Newlib mailing list