svn commit: r303524 - in head: include lib/libc/stdio

Baptiste Daroussin bapt at FreeBSD.org
Sat Jul 30 01:00:18 UTC 2016


Author: bapt
Date: Sat Jul 30 01:00:16 2016
New Revision: 303524
URL: https://svnweb.freebsd.org/changeset/base/303524

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
  
  While here remove the extra parenthesis surrounding dprintf(3)

Modified:
  head/include/stdio.h
  head/lib/libc/stdio/getline.3
  head/lib/libc/stdio/printf.3

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

Modified: head/lib/libc/stdio/getline.3
==============================================================================
--- head/lib/libc/stdio/getline.3	Fri Jul 29 23:30:33 2016	(r303523)
+++ head/lib/libc/stdio/getline.3	Sat Jul 30 01:00:16 2016	(r303524)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 30, 2012
+.Dd July 30, 2016
 .Dt GETLINE 3
 .Os
 .Sh NAME
@@ -34,7 +34,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.Fd "#define _WITH_GETLINE"
 .In stdio.h
 .Ft ssize_t
 .Fn getdelim "char ** restrict linep" "size_t * restrict linecapp" "int delimiter" " FILE * restrict stream"
@@ -97,34 +96,6 @@ while ((linelen = getline(&line, &lineca
 	fwrite(line, linelen, 1, stdout);
 free(line);
 .Ed
-.Sh COMPATIBILITY
-Many application writers used the name
-.Va getline
-before the
-.Fn getline
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn getline
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_GETLINE ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn getline
-available.
 .Sh ERRORS
 These functions may fail if:
 .Bl -tag -width Er

Modified: head/lib/libc/stdio/printf.3
==============================================================================
--- head/lib/libc/stdio/printf.3	Fri Jul 29 23:30:33 2016	(r303523)
+++ head/lib/libc/stdio/printf.3	Sat Jul 30 01:00:16 2016	(r303524)
@@ -32,7 +32,7 @@
 .\"     @(#)printf.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd December 2, 2009
+.Dd July 30, 2016
 .Dt PRINTF 3
 .Os
 .Sh NAME
@@ -42,7 +42,6 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.Fd "#define _WITH_DPRINTF"
 .In stdio.h
 .Ft int
 .Fn printf "const char * restrict format" ...
@@ -715,34 +714,6 @@ char *newfmt(const char *fmt, ...)
 }
 .Ed
 .Sh COMPATIBILITY
-Many application writers used the name
-.Va dprintf
-before the
-.Fn dprintf
-function was introduced in
-.St -p1003.1 ,
-so a prototype is not provided by default in order to avoid
-compatibility problems.
-Applications that wish to use the
-.Fn dprintf
-function described herein should either request a strict
-.St -p1003.1-2008
-environment by defining the macro
-.Dv _POSIX_C_SOURCE
-to the value 200809 or greater, or by defining the macro
-.Dv _WITH_DPRINTF ,
-prior to the inclusion of
-.In stdio.h .
-For compatibility with GNU libc, defining either
-.Dv _BSD_SOURCE
-or
-.Dv _GNU_SOURCE
-prior to the inclusion of
-.In stdio.h
-will also make
-.Fn dprintf
-available.
-.Pp
 The conversion formats
 .Cm \&%D , \&%O ,
 and


More information about the svn-src-head mailing list