From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- libio/bits/libio-ldbl.h | 25 +++++++++++++++++ libio/bits/stdio-ldbl.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ libio/bits/stdio.h | 12 +++++++- libio/bits/stdio2.h | 69 ++++++++++++++++++++++++++++++++++++++------- 4 files changed, 169 insertions(+), 11 deletions(-) create mode 100644 libio/bits/libio-ldbl.h create mode 100644 libio/bits/stdio-ldbl.h (limited to 'libio/bits') diff --git a/libio/bits/libio-ldbl.h b/libio/bits/libio-ldbl.h new file mode 100644 index 0000000..8674bcb --- /dev/null +++ b/libio/bits/libio-ldbl.h @@ -0,0 +1,25 @@ +/* -mlong-double-64 compatibility mode for libio functions. + Copyright (C) 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + 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. */ + +#ifndef _IO_STDIO_H +# error "Never include directly; use instead." +#endif + +__LDBL_REDIR_DECL (_IO_vfscanf) +__LDBL_REDIR_DECL (_IO_vfprintf) diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h new file mode 100644 index 0000000..7a42912 --- /dev/null +++ b/libio/bits/stdio-ldbl.h @@ -0,0 +1,74 @@ +/* -mlong-double-64 compatibility mode for stdio functions. + Copyright (C) 2006 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + 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. */ + +#ifndef _STDIO_H +# error "Never include directly; use instead." +#endif + +__BEGIN_NAMESPACE_STD +__LDBL_REDIR_DECL (fprintf) +__LDBL_REDIR_DECL (printf) +__LDBL_REDIR_DECL (sprintf) +__LDBL_REDIR_DECL (vfprintf) +__LDBL_REDIR_DECL (vprintf) +__LDBL_REDIR_DECL (vsprintf) +__LDBL_REDIR_DECL (fscanf) +__LDBL_REDIR_DECL (scanf) +__LDBL_REDIR_DECL (sscanf) +__END_NAMESPACE_STD + +#if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 +__BEGIN_NAMESPACE_C99 +__LDBL_REDIR_DECL (snprintf) +__LDBL_REDIR_DECL (vsnprintf) +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_ISOC99 +__BEGIN_NAMESPACE_C99 +__LDBL_REDIR_DECL (vfscanf) +__LDBL_REDIR_DECL (vsscanf) +__LDBL_REDIR_DECL (vscanf) +__END_NAMESPACE_C99 +#endif + +#ifdef __USE_GNU +__LDBL_REDIR_DECL (vdprintf) +__LDBL_REDIR_DECL (dprintf) +__LDBL_REDIR_DECL (vasprintf) +__LDBL_REDIR_DECL (__asprintf) +__LDBL_REDIR_DECL (asprintf) +__LDBL_REDIR_DECL (obstack_printf) +__LDBL_REDIR_DECL (obstack_vprintf) +#endif + +#if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus +__LDBL_REDIR_DECL (__sprintf_chk) +__LDBL_REDIR_DECL (__vsprintf_chk) +# if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 +__LDBL_REDIR_DECL (__snprintf_chk) +__LDBL_REDIR_DECL (__vsnprintf_chk) +# endif +# if __USE_FORTIFY_LEVEL > 1 +__LDBL_REDIR_DECL (__fprintf_chk) +__LDBL_REDIR_DECL (__printf_chk) +__LDBL_REDIR_DECL (__vfprintf_chk) +__LDBL_REDIR_DECL (__vprintf_chk) +# endif +#endif diff --git a/libio/bits/stdio.h b/libio/bits/stdio.h index 9e951ad..2d44fad 100644 --- a/libio/bits/stdio.h +++ b/libio/bits/stdio.h @@ -1,5 +1,5 @@ /* Optimizing macros and inline functions for stdio functions. - Copyright (C) 1998, 2000, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001, 2004, 2007 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 @@ -44,6 +44,16 @@ getchar (void) } +# ifdef __USE_MISC +/* Faster version when locking is not necessary. */ +__STDIO_INLINE int +fgetc_unlocked (FILE *__fp) +{ + return _IO_getc_unlocked (__fp); +} +# endif /* misc */ + + # if defined __USE_POSIX || defined __USE_MISC /* This is defined in POSIX.1:1996. */ __STDIO_INLINE int diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h index acf07ea..f1d745c 100644 --- a/libio/bits/stdio2.h +++ b/libio/bits/stdio2.h @@ -1,5 +1,5 @@ /* Checking macros for stdio functions. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 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 @@ -49,7 +49,7 @@ extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag, __builtin___vsnprintf_chk (str, len, __USE_FORTIFY_LEVEL - 1, __bos (str), \ fmt, ap) -#endif +#endif #if __USE_FORTIFY_LEVEL > 1 @@ -61,18 +61,67 @@ extern int __vfprintf_chk (FILE *__restrict __stream, int __flag, extern int __vprintf_chk (int __flag, __const char *__restrict __format, _G_va_list __ap); -# define printf(...) \ +# if __GNUC_PREREQ (4, 0) +# define printf(...) \ __printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define fprintf(stream, ...) \ +# define fprintf(stream, ...) \ __fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) -# define vprintf(format, ap) \ +# define vprintf(format, ap) \ __vprintf_chk (__USE_FORTIFY_LEVEL - 1, format, ap) -# define vfprintf(stream, format, ap) \ +# define vfprintf(stream, format, ap) \ __vfprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, format, ap) +# else +# define printf(...) \ + __builtin___printf_chk (__USE_FORTIFY_LEVEL - 1, __VA_ARGS__) +# define fprintf(stream, ...) \ + __builtin___fprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, __VA_ARGS__) +# define vprintf(format, ap) \ + __builtin___vprintf_chk (__USE_FORTIFY_LEVEL - 1, format, ap) +# define vfprintf(stream, format, ap) \ + __builtin___vfprintf_chk (stream, __USE_FORTIFY_LEVEL - 1, format, ap) +# endif #endif -extern char *__gets_chk (char *__str, size_t); -#define gets(__str) \ - ((__bos (__str) == (size_t) -1) \ - ? (gets) (__str) : __gets_chk (__str, __bos (__str))) +extern char *__gets_chk (char *__str, size_t) __wur; +extern char *__REDIRECT (__gets_alias, (char *__str), gets) __wur; + +extern __always_inline __wur char * +gets (char *__str) +{ + if (__bos (__str) != (size_t) -1) + return __gets_chk (__str, __bos (__str)); + return __gets_alias (__str); +} + +extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n, + FILE *__restrict __stream) __wur; +extern char *__REDIRECT (__fgets_alias, + (char *__restrict __s, int __n, + FILE *__restrict __stream), fgets) __wur; + +extern __always_inline __wur char * +fgets (char *__restrict __s, int __n, FILE *__restrict __stream) +{ + if (__bos (__s) != (size_t) -1 + && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s))) + return __fgets_chk (__s, __bos (__s), __n, __stream); + return __fgets_alias (__s, __n, __stream); +} + +#ifdef __USE_GNU +extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size, + int __n, FILE *__restrict __stream) __wur; +extern char *__REDIRECT (__fgets_unlocked_alias, + (char *__restrict __s, int __n, + FILE *__restrict __stream), fgets_unlocked) __wur; + +extern __always_inline __wur char * +fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) +{ + if (__bos (__s) != (size_t) -1 + && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s))) + return __fgets_unlocked_chk (__s, __bos (__s), __n, __stream); + return __fgets_unlocked_alias (__s, __n, __stream); +} +#endif -- cgit v1.1