[RFC,2/5] Do not define and undefine vfprintf in vfprintf.c
Commit Message
In preparation for the transition of the long double format on
powerpc64le, this patch replaces the uses of 'vfprintf' with
'___vfprintf', thus avoiding the need to '#undef vfprintf' before
creating the externally visible symbols. In a future, powerpc64le
specific patch, a new file will define 'vfprintf' to an alternate name
to be used by the long double implementation with binary128 format.
Tested for powerpc64le.
* stdio-common/vfprintf.c (vfprintf): Rename function name to
___vfprintf, which is redefined to _IO_vfprintf or
_IO_vfprintf_internal, depending on whether support for wide or
regular characters is being built.
---
stdio-common/vfprintf.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
Comments
"Gabriel F. T. Gomes" <gabriel@inconstante.eti.br> writes:
> diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
> index ae412e4b84..0ab7ade1d6 100644
> --- a/stdio-common/vfprintf.c
> +++ b/stdio-common/vfprintf.c
> @@ -2321,7 +2321,7 @@ buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args)
> #ifndef COMPILE_WPRINTF
> result = _IO_vfprintf (hp, format, args);
> #else
> - result = vfprintf (hp, format, args);
> + result = _IO_vfwprintf (hp, format, args);
This should be using ___vfprintf.
It won't change the binary, but it's going to reuse the macro defined earliear.
@@ -78,7 +78,7 @@
} while (0)
#ifndef COMPILE_WPRINTF
-# define vfprintf _IO_vfprintf_internal
+# define ___vfprintf _IO_vfprintf_internal
# define CHAR_T char
# define UCHAR_T unsigned char
# define INT_T int
@@ -105,7 +105,7 @@ typedef const char *THOUSANDS_SEP_T;
# define ORIENT if (_IO_vtable_offset (s) == 0 && _IO_fwide (s, -1) != -1)\
return -1
#else
-# define vfprintf _IO_vfwprintf
+# define ___vfprintf _IO_vfwprintf
# define CHAR_T wchar_t
/* This is a hack!!! There should be a type uwchar_t. */
# define UCHAR_T unsigned int /* uwchar_t */
@@ -1235,7 +1235,7 @@ static CHAR_T *group_number (CHAR_T *, CHAR_T *, CHAR_T *, const char *,
/* The function itself. */
int
-vfprintf (FILE *s, const CHAR_T *format, va_list ap)
+___vfprintf (FILE *s, const CHAR_T *format, va_list ap)
{
/* The character used as thousands separator. */
THOUSANDS_SEP_T thousands_sep = 0;
@@ -2321,7 +2321,7 @@ buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args)
#ifndef COMPILE_WPRINTF
result = _IO_vfprintf (hp, format, args);
#else
- result = vfprintf (hp, format, args);
+ result = _IO_vfwprintf (hp, format, args);
#endif
/* Lock stream. */
@@ -2352,7 +2352,6 @@ buffered_vfprintf (FILE *s, const CHAR_T *format, va_list args)
return result;
}
-#undef vfprintf
#ifdef COMPILE_WPRINTF
strong_alias (_IO_vfwprintf, __vfwprintf);
ldbl_weak_alias (_IO_vfwprintf, vfwprintf);