Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Jul 2016 11:42:36 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Baptiste Daroussin <bapt@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r303524 - in head: include lib/libc/stdio
Message-ID:  <20160730111943.B1526@besplex.bde.org>
In-Reply-To: <201607300100.u6U10GNt056755@repo.freebsd.org>
References:  <201607300100.u6U10GNt056755@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 30 Jul 2016, Baptiste Daroussin wrote:

> Log:
>  Remove _WITH_GETLINE and _WITH_DPRINTF guards
>
>  When adding getline(3) and dprintf(3) into libc, those guards were added
>  to prevent breaking too many ports.
>
>  7 years later the ports tree have been fixed, it is time to remove this
>  FreeBSDism

This increases style bugs related to the ifdefs.

>  While here remove the extra parenthesis surrounding dprintf(3)

Perhaps they weren't extra.  They allowed applications that to #define
dprintf and still get the function if they also #define suitable magic
_WITH* macros.  Now that dprintf() is fully reserved for the implementation,
they are just extra because the implementation doesn't have a macro version.

> Modified: head/include/stdio.h
> ==============================================================================
> --- head/include/stdio.h	Fri Jul 29 23:30:33 2016	(r303523)
> +++ head/include/stdio.h	Sat Jul 30 01:00:16 2016	(r303524)
> @@ -357,44 +357,8 @@ ssize_t	 getdelim(char ** __restrict, si
> FILE	*open_memstream(char **, size_t *);
> int	 renameat(int, const char *, int, const char *);
> int	 vdprintf(int, const char * __restrict, __va_list);
> -
> -/*
> - * Every programmer and his dog wrote functions called getline() and dprintf()
> - * before POSIX.1-2008 came along and decided to usurp the names, so we
> - * don't prototype them by default unless one of the following is true:
> - *   a) the app has requested them specifically by defining _WITH_GETLINE or
> - *      _WITH_DPRINTF, respectively
> - *   b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE
> - *   c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE
> - */
> -#ifndef _WITH_GETLINE
> -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
> -#define	_WITH_GETLINE
> -#elif defined(_POSIX_C_SOURCE)
> -#if _POSIX_C_SOURCE >= 200809
> -#define	_WITH_GETLINE
> -#endif
> -#endif
> -#endif
> -
> -#ifdef _WITH_GETLINE
> ssize_t	 getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
> -#endif
> -
> -#ifndef _WITH_DPRINTF
> -#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
> -#define	_WITH_DPRINTF
> -#elif defined(_POSIX_C_SOURCE)
> -#if _POSIX_C_SOURCE >= 200809
> -#define	_WITH_DPRINTF
> -#endif
> -#endif
> -#endif
> -
> -#ifdef _WITH_DPRINTF
> -int	 (dprintf)(int, const char * __restrict, ...);
> -#endif
> -
> +int	 dprintf(int, const char * __restrict, ...);
> #endif /* __POSIX_VISIBLE >= 200809 */

getline and dprintf are still int this POSIX section, so they are not
exposed to earlier POSIXes or C99 or C90, but they still are unsorted
within this section.  The unsorting made the ifdefs less unreadable
(except g before d was just backwards).  Now it is just an expecially
bad historical order.

> Modified: head/lib/libc/stdio/printf.3

This man page is almost unreadable since it has many functions in it
organised in a strange order that is approximately on decreasing age
and standardness. So you need grep to find anything in it.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160730111943.B1526>