]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - libio/stdio.h
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / libio / stdio.h
index 85542b1cfdbd50941d288dde8e22e678b10b1333..19ab0ae0b994f446d4eaac57839d0ad2b804c678 100644 (file)
@@ -1,5 +1,5 @@
 /* Define ISO C stdio on top of C++ iostreams.
-   Copyright (C) 1991, 1994-2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 1991-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -13,9 +13,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /*
  *     ISO C99 Standard: 7.19 Input/output     <stdio.h>
@@ -48,8 +47,8 @@ __BEGIN_NAMESPACE_STD
 /* The opaque type of streams.  This is the definition used elsewhere.  */
 typedef struct _IO_FILE FILE;
 __END_NAMESPACE_STD
-#if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
-    || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
+#if defined __USE_LARGEFILE64 || defined __USE_POSIX \
+    || defined __USE_ISOC99 || defined __USE_XOPEN \
     || defined __USE_POSIX2
 __USING_NAMESPACE_STD(FILE)
 #endif
@@ -118,7 +117,7 @@ typedef _G_fpos64_t fpos64_t;
 #endif
 
 /* The possibilities for the third argument to `setvbuf'.  */
-#define _IOFBF 0               /* Fully buffered.  */
+#define _IOFBF 0               /* Fully buffered.  */
 #define _IOLBF 1               /* Line buffered.  */
 #define _IONBF 2               /* No buffering.  */
 
@@ -141,9 +140,13 @@ typedef _G_fpos64_t fpos64_t;
 #define SEEK_SET       0       /* Seek from beginning of file.  */
 #define SEEK_CUR       1       /* Seek from current position.  */
 #define SEEK_END       2       /* Seek from end of file.  */
+#ifdef __USE_GNU
+# define SEEK_DATA     3       /* Seek to next data.  */
+# define SEEK_HOLE     4       /* Seek to next hole.  */
+#endif
 
 
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_MISC || defined __USE_XOPEN
 /* Default path prefix for `tempnam' and `tmpnam'.  */
 # define P_tmpdir      "/tmp"
 #endif
@@ -152,7 +155,7 @@ typedef _G_fpos64_t fpos64_t;
 /* Get the values:
    L_tmpnam    How long an array of chars must be to be passed to `tmpnam'.
    TMP_MAX     The minimum number of unique filenames generated by tmpnam
-               (and tempnam when it uses tmpnam's name space),
+               (and tempnam when it uses tmpnam's name space),
                or tempnam (the two are separate).
    L_ctermid   How long an array to pass to `ctermid'.
    L_cuserid   How long an array to pass to `cuserid'.
@@ -172,21 +175,21 @@ extern struct _IO_FILE *stderr;           /* Standard error output stream.  */
 
 __BEGIN_NAMESPACE_STD
 /* Remove file FILENAME.  */
-extern int remove (__const char *__filename) __THROW;
+extern int remove (const char *__filename) __THROW;
 /* Rename file OLD to NEW.  */
-extern int rename (__const char *__old, __const char *__new) __THROW;
+extern int rename (const char *__old, const char *__new) __THROW;
 __END_NAMESPACE_STD
 
 #ifdef __USE_ATFILE
 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
-extern int renameat (int __oldfd, __const char *__old, int __newfd,
-                    __const char *__new) __THROW;
+extern int renameat (int __oldfd, const char *__old, int __newfd,
+                    const char *__new) __THROW;
 #endif
 
 __BEGIN_NAMESPACE_STD
 /* Create a temporary file and open it read/write.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 #ifndef __USE_FILE_OFFSET64
 extern FILE *tmpfile (void) __wur;
@@ -213,7 +216,7 @@ extern char *tmpnam_r (char *__s) __THROW __wur;
 #endif
 
 
-#if defined __USE_SVID || defined __USE_XOPEN
+#if defined __USE_MISC || defined __USE_XOPEN
 /* Generate a unique temporary filename using up to five characters of PFX
    if it is not NULL.  The directory to put this file in is searched for
    as follows: First the environment variable "TMPDIR" is checked.
@@ -221,7 +224,7 @@ extern char *tmpnam_r (char *__s) __THROW __wur;
    If not and if DIR is not NULL, that value is checked.  If that fails,
    P_tmpdir is tried and finally "/tmp".  The storage for the filename
    is allocated by `malloc'.  */
-extern char *tempnam (__const char *__dir, __const char *__pfx)
+extern char *tempnam (const char *__dir, const char *__pfx)
      __THROW __attribute_malloc__ __wur;
 #endif
 
@@ -266,22 +269,22 @@ __BEGIN_NAMESPACE_STD
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern FILE *fopen (__const char *__restrict __filename,
-                   __const char *__restrict __modes) __wur;
+extern FILE *fopen (const char *__restrict __filename,
+                   const char *__restrict __modes) __wur;
 /* Open a file, replacing an existing stream with it.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern FILE *freopen (__const char *__restrict __filename,
-                     __const char *__restrict __modes,
+extern FILE *freopen (const char *__restrict __filename,
+                     const char *__restrict __modes,
                      FILE *__restrict __stream) __wur;
 #else
 # ifdef __REDIRECT
-extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
-                                __const char *__restrict __modes), fopen64)
+extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
+                                const char *__restrict __modes), fopen64)
   __wur;
-extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
-                                  __const char *__restrict __modes,
+extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
+                                  const char *__restrict __modes,
                                   FILE *__restrict __stream), freopen64)
   __wur;
 # else
@@ -291,29 +294,29 @@ extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
 #endif
 __END_NAMESPACE_STD
 #ifdef __USE_LARGEFILE64
-extern FILE *fopen64 (__const char *__restrict __filename,
-                     __const char *__restrict __modes) __wur;
-extern FILE *freopen64 (__const char *__restrict __filename,
-                       __const char *__restrict __modes,
+extern FILE *fopen64 (const char *__restrict __filename,
+                     const char *__restrict __modes) __wur;
+extern FILE *freopen64 (const char *__restrict __filename,
+                       const char *__restrict __modes,
                        FILE *__restrict __stream) __wur;
 #endif
 
 #ifdef __USE_POSIX
 /* Create a new stream that refers to an existing system file descriptor.  */
-extern FILE *fdopen (int __fd, __const char *__modes) __THROW __wur;
+extern FILE *fdopen (int __fd, const char *__modes) __THROW __wur;
 #endif
 
 #ifdef __USE_GNU
 /* Create a new stream that refers to the given magic cookie,
    and uses the given functions for input and output.  */
 extern FILE *fopencookie (void *__restrict __magic_cookie,
-                         __const char *__restrict __modes,
+                         const char *__restrict __modes,
                          _IO_cookie_io_functions_t __io_funcs) __THROW __wur;
 #endif
 
 #ifdef __USE_XOPEN2K8
 /* Create a new stream that refers to a memory buffer.  */
-extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes)
+extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
   __THROW __wur;
 
 /* Open a stream that writes into a malloc'd buffer that is expanded as
@@ -334,7 +337,7 @@ extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) __THROW;
 __END_NAMESPACE_STD
 
-#ifdef __USE_BSD
+#ifdef __USE_MISC
 /* If BUF is NULL, make STREAM unbuffered.
    Else make it use SIZE bytes of BUF for buffering.  */
 extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
@@ -351,70 +354,65 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fprintf (FILE *__restrict __stream,
-                   __const char *__restrict __format, ...);
+                   const char *__restrict __format, ...);
 /* Write formatted output to stdout.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int printf (__const char *__restrict __format, ...);
+extern int printf (const char *__restrict __format, ...);
 /* Write formatted output to S.  */
 extern int sprintf (char *__restrict __s,
-                   __const char *__restrict __format, ...) __THROW;
+                   const char *__restrict __format, ...) __THROWNL;
 
 /* Write formatted output to S from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
+extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
                     _G_va_list __arg);
 /* Write formatted output to stdout from argument list ARG.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vprintf (__const char *__restrict __format, _G_va_list __arg);
+extern int vprintf (const char *__restrict __format, _G_va_list __arg);
 /* Write formatted output to S from argument list ARG.  */
-extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
-                    _G_va_list __arg) __THROW;
+extern int vsprintf (char *__restrict __s, const char *__restrict __format,
+                    _G_va_list __arg) __THROWNL;
 __END_NAMESPACE_STD
 
-#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
+#if defined __USE_ISOC99 || defined __USE_UNIX98
 __BEGIN_NAMESPACE_C99
 /* Maximum chars of output to write in MAXLEN.  */
 extern int snprintf (char *__restrict __s, size_t __maxlen,
-                    __const char *__restrict __format, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
+                    const char *__restrict __format, ...)
+     __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
 
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
-                     __const char *__restrict __format, _G_va_list __arg)
-     __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
+                     const char *__restrict __format, _G_va_list __arg)
+     __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
 __END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_GNU
 /* Write formatted output to a string dynamically allocated with `malloc'.
    Store the address of the string in *PTR.  */
-extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
+extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
                      _G_va_list __arg)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
+     __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
 extern int __asprintf (char **__restrict __ptr,
-                      __const char *__restrict __fmt, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+                      const char *__restrict __fmt, ...)
+     __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
 extern int asprintf (char **__restrict __ptr,
-                    __const char *__restrict __fmt, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
+                    const char *__restrict __fmt, ...)
+     __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
 #endif
 
 #ifdef __USE_XOPEN2K8
-/* Write formatted output to a file descriptor.
-
-   These functions are not part of POSIX and therefore no official
-   cancellation point.  But due to similarity with an POSIX interface
-   or due to the implementation they are cancellation points and
-   therefore not marked with __THROW.  */
-extern int vdprintf (int __fd, __const char *__restrict __fmt,
+/* Write formatted output to a file descriptor.  */
+extern int vdprintf (int __fd, const char *__restrict __fmt,
                     _G_va_list __arg)
      __attribute__ ((__format__ (__printf__, 2, 0)));
-extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
+extern int dprintf (int __fd, const char *__restrict __fmt, ...)
      __attribute__ ((__format__ (__printf__, 2, 3)));
 #endif
 
@@ -425,15 +423,15 @@ __BEGIN_NAMESPACE_STD
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fscanf (FILE *__restrict __stream,
-                  __const char *__restrict __format, ...) __wur;
+                  const char *__restrict __format, ...) __wur;
 /* Read formatted input from stdin.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int scanf (__const char *__restrict __format, ...) __wur;
+extern int scanf (const char *__restrict __format, ...) __wur;
 /* Read formatted input from S.  */
-extern int sscanf (__const char *__restrict __s,
-                  __const char *__restrict __format, ...) __THROW;
+extern int sscanf (const char *__restrict __s,
+                  const char *__restrict __format, ...) __THROW;
 
 #if defined __USE_ISOC99 && !defined __USE_GNU \
     && (!defined __LDBL_COMPAT || !defined __REDIRECT) \
@@ -443,19 +441,19 @@ extern int sscanf (__const char *__restrict __s,
    GNU extension which conflicts with valid %a followed by letter
    s, S or [.  */
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
-                               __const char *__restrict __format, ...),
+                               const char *__restrict __format, ...),
                       __isoc99_fscanf) __wur;
-extern int __REDIRECT (scanf, (__const char *__restrict __format, ...),
+extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
                       __isoc99_scanf) __wur;
-extern int __REDIRECT (sscanf, (__const char *__restrict __s,
-                               __const char *__restrict __format, ...),
-                      __isoc99_sscanf) __THROW;
+extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
+                                   const char *__restrict __format, ...),
+                          __isoc99_sscanf);
 # else
 extern int __isoc99_fscanf (FILE *__restrict __stream,
-                           __const char *__restrict __format, ...) __wur;
-extern int __isoc99_scanf (__const char *__restrict __format, ...) __wur;
-extern int __isoc99_sscanf (__const char *__restrict __s,
-                           __const char *__restrict __format, ...) __THROW;
+                           const char *__restrict __format, ...) __wur;
+extern int __isoc99_scanf (const char *__restrict __format, ...) __wur;
+extern int __isoc99_sscanf (const char *__restrict __s,
+                           const char *__restrict __format, ...) __THROW;
 #  define fscanf __isoc99_fscanf
 #  define scanf __isoc99_scanf
 #  define sscanf __isoc99_sscanf
@@ -470,7 +468,7 @@ __BEGIN_NAMESPACE_C99
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
+extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
                    _G_va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
 
@@ -478,12 +476,12 @@ extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
+extern int vscanf (const char *__restrict __format, _G_va_list __arg)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
 
 /* Read formatted input from S into argument list ARG.  */
-extern int vsscanf (__const char *__restrict __s,
-                   __const char *__restrict __format, _G_va_list __arg)
+extern int vsscanf (const char *__restrict __s,
+                   const char *__restrict __format, _G_va_list __arg)
      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
 
 # if !defined __USE_GNU \
@@ -495,25 +493,25 @@ extern int vsscanf (__const char *__restrict __s,
    s, S or [.  */
 extern int __REDIRECT (vfscanf,
                       (FILE *__restrict __s,
-                       __const char *__restrict __format, _G_va_list __arg),
+                       const char *__restrict __format, _G_va_list __arg),
                       __isoc99_vfscanf)
      __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
-extern int __REDIRECT (vscanf, (__const char *__restrict __format,
+extern int __REDIRECT (vscanf, (const char *__restrict __format,
                                _G_va_list __arg), __isoc99_vscanf)
      __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
-extern int __REDIRECT (vsscanf,
-                      (__const char *__restrict __s,
-                       __const char *__restrict __format, _G_va_list __arg),
-                      __isoc99_vsscanf)
-     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
+extern int __REDIRECT_NTH (vsscanf,
+                          (const char *__restrict __s,
+                           const char *__restrict __format,
+                           _G_va_list __arg), __isoc99_vsscanf)
+     __attribute__ ((__format__ (__scanf__, 2, 0)));
 #  else
 extern int __isoc99_vfscanf (FILE *__restrict __s,
-                            __const char *__restrict __format,
+                            const char *__restrict __format,
                             _G_va_list __arg) __wur;
-extern int __isoc99_vscanf (__const char *__restrict __format,
+extern int __isoc99_vscanf (const char *__restrict __format,
                            _G_va_list __arg) __wur;
-extern int __isoc99_vsscanf (__const char *__restrict __s,
-                            __const char *__restrict __format,
+extern int __isoc99_vsscanf (const char *__restrict __s,
+                            const char *__restrict __format,
                             _G_va_list __arg) __THROW;
 #   define vfscanf __isoc99_vfscanf
 #   define vscanf __isoc99_vscanf
@@ -544,14 +542,14 @@ __END_NAMESPACE_STD
    optimization for it.  */
 #define getc(_fp) _IO_getc (_fp)
 
-#if defined __USE_POSIX || defined __USE_MISC
+#ifdef __USE_POSIX
 /* These are defined in POSIX.1:1996.
 
    These functions are possible cancellation points and therefore not
    marked with __THROW.  */
 extern int getc_unlocked (FILE *__stream);
 extern int getchar_unlocked (void);
-#endif /* Use POSIX or MISC.  */
+#endif /* Use POSIX.  */
 
 #ifdef __USE_MISC
 /* Faster version when locking is not necessary.
@@ -596,17 +594,17 @@ __END_NAMESPACE_STD
 extern int fputc_unlocked (int __c, FILE *__stream);
 #endif /* Use MISC.  */
 
-#if defined __USE_POSIX || defined __USE_MISC
+#ifdef __USE_POSIX
 /* These are defined in POSIX.1:1996.
 
    These functions are possible cancellation points and therefore not
    marked with __THROW.  */
 extern int putc_unlocked (int __c, FILE *__stream);
 extern int putchar_unlocked (int __c);
-#endif /* Use POSIX or MISC.  */
+#endif /* Use POSIX.  */
 
 
-#if defined __USE_SVID || defined __USE_MISC \
+#if defined __USE_MISC \
     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
 /* Get a word (int) from STREAM.  */
 extern int getw (FILE *__stream);
@@ -624,12 +622,21 @@ __BEGIN_NAMESPACE_STD
 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
      __wur;
 
+#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;
+extern char *gets (char *__s) __wur __attribute_deprecated__;
+#endif
 __END_NAMESPACE_STD
 
 #ifdef __USE_GNU
@@ -677,36 +684,36 @@ extern _IO_ssize_t getline (char **__restrict __lineptr,
 __BEGIN_NAMESPACE_STD
 /* Write a string to STREAM.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
+extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
 
 /* Write a string, followed by a newline, to stdout.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int puts (__const char *__s);
+extern int puts (const char *__s);
 
 
 /* Push a character back onto the input buffer of STREAM.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int ungetc (int __c, FILE *__stream);
 
 
 /* Read chunks of generic data from STREAM.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern size_t fread (void *__restrict __ptr, size_t __size,
                     size_t __n, FILE *__restrict __stream) __wur;
 /* Write chunks of generic data to STREAM.
 
-   This function is a possible cancellation points and therefore not
+   This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
-                     size_t __n, FILE *__restrict __s) __wur;
+extern size_t fwrite (const void *__restrict __ptr, size_t __size,
+                     size_t __n, FILE *__restrict __s);
 __END_NAMESPACE_STD
 
 #ifdef __USE_GNU
@@ -716,7 +723,7 @@ __END_NAMESPACE_STD
    cancellation point.  But due to similarity with an POSIX interface
    or due to the implementation it is a cancellation point and
    therefore not marked with __THROW.  */
-extern int fputs_unlocked (__const char *__restrict __s,
+extern int fputs_unlocked (const char *__restrict __s,
                           FILE *__restrict __stream);
 #endif
 
@@ -729,8 +736,8 @@ extern int fputs_unlocked (__const char *__restrict __s,
    therefore not marked with __THROW.  */
 extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
                              size_t __n, FILE *__restrict __stream) __wur;
-extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
-                              size_t __n, FILE *__restrict __stream) __wur;
+extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
+                              size_t __n, FILE *__restrict __stream);
 #endif
 
 
@@ -793,13 +800,13 @@ extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
+extern int fsetpos (FILE *__stream, const fpos_t *__pos);
 #else
 # ifdef __REDIRECT
 extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
                                 fpos_t *__restrict __pos), fgetpos64);
 extern int __REDIRECT (fsetpos,
-                      (FILE *__stream, __const fpos_t *__pos), fsetpos64);
+                      (FILE *__stream, const fpos_t *__pos), fsetpos64);
 # else
 #  define fgetpos fgetpos64
 #  define fsetpos fsetpos64
@@ -811,7 +818,7 @@ __END_NAMESPACE_STD
 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
 extern __off64_t ftello64 (FILE *__stream) __wur;
 extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
-extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
+extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
 #endif
 
 __BEGIN_NAMESPACE_STD
@@ -836,7 +843,7 @@ __BEGIN_NAMESPACE_STD
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern void perror (__const char *__s);
+extern void perror (const char *__s);
 __END_NAMESPACE_STD
 
 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
@@ -857,13 +864,12 @@ extern int fileno_unlocked (FILE *__stream) __THROW __wur;
 #endif
 
 
-#if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
-     defined __USE_MISC)
+#ifdef __USE_POSIX2
 /* Create a new stream connected to a pipe running the given command.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
-extern FILE *popen (__const char *__command, __const char *__modes) __wur;
+extern FILE *popen (const char *__command, const char *__modes) __wur;
 
 /* Close a stream opened by popen and return the status of its child.
 
@@ -890,16 +896,16 @@ struct obstack;                   /* See <obstack.h>.  */
 
 /* Write formatted output to an obstack.  */
 extern int obstack_printf (struct obstack *__restrict __obstack,
-                          __const char *__restrict __format, ...)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
+                          const char *__restrict __format, ...)
+     __THROWNL __attribute__ ((__format__ (__printf__, 2, 3)));
 extern int obstack_vprintf (struct obstack *__restrict __obstack,
-                           __const char *__restrict __format,
+                           const char *__restrict __format,
                            _G_va_list __args)
-     __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
+     __THROWNL __attribute__ ((__format__ (__printf__, 2, 0)));
 #endif /* Use GNU.  */
 
 
-#if defined __USE_POSIX || defined __USE_MISC
+#ifdef __USE_POSIX
 /* These are defined in POSIX.1:1996.  */
 
 /* Acquire ownership of STREAM.  */
@@ -911,7 +917,7 @@ extern int ftrylockfile (FILE *__stream) __THROW __wur;
 
 /* Relinquish the ownership granted for STREAM.  */
 extern void funlockfile (FILE *__stream) __THROW;
-#endif /* POSIX || misc */
+#endif /* POSIX */
 
 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
 /* The X/Open standard requires some functions and variables to be
@@ -926,7 +932,7 @@ extern void funlockfile (FILE *__stream) __THROW;
 #ifdef __USE_EXTERN_INLINES
 # include <bits/stdio.h>
 #endif
-#if __USE_FORTIFY_LEVEL > 0 && defined __extern_always_inline
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
 # include <bits/stdio2.h>
 #endif
 #ifdef __LDBL_COMPAT