[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] [PATCH] Fix WIDE_CHAR_DEVICE_IO option group on PowerPC



ello,

The attached patch fixes build of EGLIBC on PowerPC in configurations without WIDE_CHAR_DEVICE_IO option group.

The patch conditions declarations and definitions of __nldbl_v[sf]w{printf, scanf} functions in sysdeps/ieee754/ldbl-opt/nldbl-compat.[ch] files on this option group. These functions are for handling wide characters (note 'w' before 'printf' or 'scanf' in function names) and, hence, should be conditioned on WIDE_CHAR_DEVICE_IO.

Tested by building EGLIBC with and without WIDE_CHAR_DEVICE_IO option group on PowerPC and ARM.

OK for trunk?

Thanks,

--
Maxim K.
CodeSourcery
2009-01-20  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>

	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Handle
	WIDE_CHAR_DEVICE_IO option group.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.c (__nldbl_vfwscanf)
	(__nldbl_vswscanf, __nldbl_vfwprintf, __nldbl_vswprintf)
	(__nldbl___vfwprintf_chk, __nldbl___vswprintf_chk): Condition
	declarations and defitions on WIDE_CHAR_DEVICE_IO option group.
	* sysdeps/ieee754/ldbl-opt/nldbl-compat.h (vfwscanf, vfwprintf)
	(vswprintf, vswscanf, __nldbl___vfwprintf_chk, __nldbl___vswprintf_chk):
	Condition declarations on WIDE_CHAR_DEVICE_IO option group.

	
Index: sysdeps/ieee754/ldbl-opt/Makefile
===================================================================
--- sysdeps/ieee754/ldbl-opt/Makefile	(revision 7763)
+++ sysdeps/ieee754/ldbl-opt/Makefile	(working copy)
@@ -11,16 +11,16 @@ libm-routines += s_nexttowardfd
 routines += math_ldbl_opt nldbl-compat
 
 extra-libs += libnldbl
-libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
+libnldbl-calls = asprintf dprintf fprintf fscanf iovfscanf \
 		 obstack_printf obstack_vprintf printf scanf snprintf \
-		 sprintf sscanf swprintf swscanf vasprintf vdprintf vfprintf \
-		 vfscanf vfwprintf vfwscanf vprintf vscanf vsnprintf \
-		 vsprintf vsscanf vswprintf vswscanf vwprintf vwscanf \
-		 wprintf wscanf printf_fp printf_size \
-		 fprintf_chk fwprintf_chk printf_chk snprintf_chk sprintf_chk \
-		 swprintf_chk vfprintf_chk vfwprintf_chk vprintf_chk \
-		 vsnprintf_chk vsprintf_chk vswprintf_chk vwprintf_chk \
-		 wprintf_chk asprintf_chk vasprintf_chk dprintf_chk \
+		 sprintf sscanf vasprintf vdprintf vfprintf \
+		 vfscanf vprintf vscanf vsnprintf \
+		 vsprintf vsscanf \
+		 printf_fp printf_size \
+		 fprintf_chk printf_chk snprintf_chk sprintf_chk \
+		 vfprintf_chk vprintf_chk \
+		 vsnprintf_chk vsprintf_chk \
+		 asprintf_chk vasprintf_chk dprintf_chk \
 		 vdprintf_chk obstack_printf_chk obstack_vprintf_chk \
 		 syslog syslog_chk vsyslog vsyslog_chk \
 		 strtold strtold_l strtoldint wcstold wcstold_l wcstoldint \
@@ -37,10 +37,14 @@ libnldbl-calls = asprintf dprintf fprint
 		 casinh cexp clog cproj csin csinh csqrt ctan ctanh cpow \
 		 cabs carg cimag creal clog10 \
 		 isoc99_scanf isoc99_fscanf isoc99_sscanf \
-		 isoc99_vscanf isoc99_vfscanf isoc99_vsscanf \
+		 isoc99_vscanf isoc99_vfscanf isoc99_vsscanf
+libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
+libnldbl-calls-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += fwprintf fwscanf \
+		 swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
+		 vwprintf vwscanf wprintf wscanf fwprintf_chk swprintf_chk \
+		 vfwprintf_chk vswprintf_chk vwprintf_chk wprintf_chk \
 		 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
 		 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf
-libnldbl-calls-$(OPTION_EGLIBC_LOCALE_CODE) += strfmon strfmon_l
 libnldbl-calls += $(libnldbl-calls-y)
 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
 libnldbl-inhibit-o = $(object-suffixes)
Index: sysdeps/ieee754/ldbl-opt/nldbl-compat.c
===================================================================
--- sysdeps/ieee754/ldbl-opt/nldbl-compat.c	(revision 7763)
+++ sysdeps/ieee754/ldbl-opt/nldbl-compat.c	(working copy)
@@ -34,20 +34,14 @@ libc_hidden_proto (__nldbl_vfprintf)
 libc_hidden_proto (__nldbl_vsscanf)
 libc_hidden_proto (__nldbl_vsprintf)
 libc_hidden_proto (__nldbl_vfscanf)
-libc_hidden_proto (__nldbl_vfwscanf)
 libc_hidden_proto (__nldbl_vdprintf)
-libc_hidden_proto (__nldbl_vswscanf)
-libc_hidden_proto (__nldbl_vfwprintf)
-libc_hidden_proto (__nldbl_vswprintf)
 libc_hidden_proto (__nldbl_vsnprintf)
 libc_hidden_proto (__nldbl_vasprintf)
 libc_hidden_proto (__nldbl_obstack_vprintf)
-libc_hidden_proto (__nldbl___vfwprintf_chk)
 libc_hidden_proto (__nldbl___vsnprintf_chk)
 libc_hidden_proto (__nldbl___vfprintf_chk)
 libc_hidden_proto (__nldbl___vsyslog_chk)
 libc_hidden_proto (__nldbl___vsprintf_chk)
-libc_hidden_proto (__nldbl___vswprintf_chk)
 libc_hidden_proto (__nldbl___vasprintf_chk)
 libc_hidden_proto (__nldbl___vdprintf_chk)
 libc_hidden_proto (__nldbl___obstack_vprintf_chk)
@@ -55,8 +49,17 @@ libc_hidden_proto (__nldbl___vstrfmon)
 libc_hidden_proto (__nldbl___vstrfmon_l)
 libc_hidden_proto (__nldbl___isoc99_vsscanf)
 libc_hidden_proto (__nldbl___isoc99_vfscanf)
+
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+libc_hidden_proto (__nldbl_vfwscanf)
+libc_hidden_proto (__nldbl_vswscanf)
+libc_hidden_proto (__nldbl_vfwprintf)
+libc_hidden_proto (__nldbl_vswprintf)
+libc_hidden_proto (__nldbl___vfwprintf_chk)
+libc_hidden_proto (__nldbl___vswprintf_chk)
 libc_hidden_proto (__nldbl___isoc99_vswscanf)
 libc_hidden_proto (__nldbl___isoc99_vfwscanf)
+#endif
 
 static void
 __nldbl_cleanup (void *arg)
@@ -118,6 +121,7 @@ __nldbl_fprintf (FILE *stream, const cha
 }
 weak_alias (__nldbl_fprintf, __nldbl__IO_fprintf)
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section weak_function
 __nldbl_fwprintf (FILE *stream, const wchar_t *fmt, ...)
@@ -131,6 +135,7 @@ __nldbl_fwprintf (FILE *stream, const wc
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -227,6 +232,7 @@ __nldbl_snprintf (char *s, size_t maxlen
   return done;
 }
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl_swprintf (wchar_t *s, size_t n, const wchar_t *fmt, ...)
@@ -240,6 +246,7 @@ __nldbl_swprintf (wchar_t *s, size_t n, 
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section weak_function
@@ -265,6 +272,7 @@ __nldbl_vdprintf (int d, const char *fmt
 }
 libc_hidden_def (__nldbl_vdprintf)
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section weak_function
 __nldbl_vfwprintf (FILE *s, const wchar_t *fmt, va_list ap)
@@ -276,6 +284,7 @@ __nldbl_vfwprintf (FILE *s, const wchar_
   return res;
 }
 libc_hidden_def (__nldbl_vfwprintf)
+#endif
 
 int
 attribute_compat_text_section
@@ -298,6 +307,7 @@ __nldbl_vsnprintf (char *string, size_t 
 libc_hidden_def (__nldbl_vsnprintf)
 weak_alias (__nldbl_vsnprintf, __nldbl___vsnprintf)
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section weak_function
 __nldbl_vswprintf (wchar_t *string, size_t maxlen, const wchar_t *fmt,
@@ -331,6 +341,7 @@ __nldbl_wprintf (const wchar_t *fmt, ...
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -420,6 +431,7 @@ __nldbl_scanf (const char *fmt, ...)
   return done;
 }
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
@@ -492,6 +504,7 @@ __nldbl_wscanf (const wchar_t *fmt, ...)
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -507,6 +520,7 @@ __nldbl___fprintf_chk (FILE *stream, int
   return done;
 }
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl___fwprintf_chk (FILE *stream, int flag, const wchar_t *fmt, ...)
@@ -520,6 +534,7 @@ __nldbl___fwprintf_chk (FILE *stream, in
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -564,6 +579,7 @@ __nldbl___sprintf_chk (char *s, int flag
   return done;
 }
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl___swprintf_chk (wchar_t *s, size_t n, int flag, size_t slen,
@@ -578,6 +594,7 @@ __nldbl___swprintf_chk (wchar_t *s, size
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -591,6 +608,7 @@ __nldbl___vfprintf_chk (FILE *s, int fla
 }
 libc_hidden_def (__nldbl___vfprintf_chk)
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl___vfwprintf_chk (FILE *s, int flag, const wchar_t *fmt, va_list ap)
@@ -602,6 +620,7 @@ __nldbl___vfwprintf_chk (FILE *s, int fl
   return res;
 }
 libc_hidden_def (__nldbl___vfwprintf_chk)
+#endif
 
 int
 attribute_compat_text_section
@@ -636,6 +655,7 @@ __nldbl___vsprintf_chk (char *string, in
 }
 libc_hidden_def (__nldbl___vsprintf_chk)
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl___vswprintf_chk (wchar_t *string, size_t maxlen, int flag, size_t slen,
@@ -669,6 +689,7 @@ __nldbl___wprintf_chk (int flag, const w
 
   return done;
 }
+#endif
 
 int
 attribute_compat_text_section
@@ -944,6 +965,7 @@ __nldbl___isoc99_scanf (const char *fmt,
   return done;
 }
 
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 int
 attribute_compat_text_section
 __nldbl___isoc99_vfwscanf (FILE *s, const wchar_t *fmt, va_list ap)
@@ -1017,6 +1039,7 @@ __nldbl___isoc99_wscanf (const wchar_t *
 
   return done;
 }
+#endif
 
 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
 compat_symbol (libc, __nldbl__IO_printf, _IO_printf, GLIBC_2_0);
@@ -1060,6 +1083,7 @@ compat_symbol (libc, __nldbl_printf_size
 compat_symbol (libc, __nldbl___strfmon_l, __strfmon_l, GLIBC_2_1);
 #endif
 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_2)
+# ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 compat_symbol (libc, __nldbl_swprintf, swprintf, GLIBC_2_2);
 compat_symbol (libc, __nldbl_vwprintf, vwprintf, GLIBC_2_2);
 compat_symbol (libc, __nldbl_wprintf, wprintf, GLIBC_2_2);
@@ -1072,6 +1096,7 @@ compat_symbol (libc, __nldbl_vfwscanf, v
 compat_symbol (libc, __nldbl_vswscanf, vswscanf, GLIBC_2_2);
 compat_symbol (libc, __nldbl_vwscanf, vwscanf, GLIBC_2_2);
 compat_symbol (libc, __nldbl_wscanf, wscanf, GLIBC_2_2);
+# endif
 #endif
 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_3)
 compat_symbol (libc, __nldbl_strfmon_l, strfmon_l, GLIBC_2_3);
Index: sysdeps/ieee754/ldbl-opt/nldbl-compat.h
===================================================================
--- sysdeps/ieee754/ldbl-opt/nldbl-compat.h	(revision 7763)
+++ sysdeps/ieee754/ldbl-opt/nldbl-compat.h	(working copy)
@@ -38,19 +38,15 @@
 
 NLDBL_DECL (_IO_vfscanf);
 NLDBL_DECL (vfscanf);
-NLDBL_DECL (vfwscanf);
 NLDBL_DECL (obstack_vprintf);
 NLDBL_DECL (vasprintf);
 NLDBL_DECL (dprintf);
 NLDBL_DECL (vdprintf);
 NLDBL_DECL (fprintf);
 NLDBL_DECL (vfprintf);
-NLDBL_DECL (vfwprintf);
 NLDBL_DECL (vsnprintf);
 NLDBL_DECL (vsprintf);
 NLDBL_DECL (vsscanf);
-NLDBL_DECL (vswprintf);
-NLDBL_DECL (vswscanf);
 NLDBL_DECL (__asprintf);
 NLDBL_DECL (asprintf);
 NLDBL_DECL (__printf_fp);
@@ -67,12 +63,18 @@ NLDBL_DECL (__isoc99_sscanf);
 NLDBL_DECL (__isoc99_vscanf);
 NLDBL_DECL (__isoc99_vfscanf);
 NLDBL_DECL (__isoc99_vsscanf);
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+NLDBL_DECL (vfwscanf);
+NLDBL_DECL (vfwprintf);
+NLDBL_DECL (vswprintf);
+NLDBL_DECL (vswscanf);
 NLDBL_DECL (__isoc99_wscanf);
 NLDBL_DECL (__isoc99_fwscanf);
 NLDBL_DECL (__isoc99_swscanf);
 NLDBL_DECL (__isoc99_vwscanf);
 NLDBL_DECL (__isoc99_vfwscanf);
 NLDBL_DECL (__isoc99_vswscanf);
+#endif
 
 /* This one does not exist in the normal interface, only
    __nldbl___vstrfmon really exists.  */
@@ -83,22 +85,23 @@ extern ssize_t __nldbl___vstrfmon (char 
    since we don't compile with _FORTIFY_SOURCE.  */
 extern int __nldbl___vfprintf_chk (FILE *__restrict, int,
 				   const char *__restrict, _G_va_list);
-extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
-				    const wchar_t *__restrict, __gnuc_va_list);
 extern int __nldbl___vsprintf_chk (char *__restrict, int, size_t,
 				   const char *__restrict, _G_va_list) __THROW;
 extern int __nldbl___vsnprintf_chk (char *__restrict, size_t, int, size_t,
 				    const char *__restrict, _G_va_list)
   __THROW;
-extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
-				    const wchar_t *__restrict, __gnuc_va_list)
-  __THROW;
 extern int __nldbl___vasprintf_chk (char **, int, const char *, _G_va_list)
   __THROW;
 extern int __nldbl___vdprintf_chk (int, int, const char *, _G_va_list);
 extern int __nldbl___obstack_vprintf_chk (struct obstack *, int, const char *,
 					  _G_va_list) __THROW;
 extern void __nldbl___vsyslog_chk (int, int, const char *, va_list);
-
+#ifdef __OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+extern int __nldbl___vfwprintf_chk (FILE *__restrict, int,
+				    const wchar_t *__restrict, __gnuc_va_list);
+extern int __nldbl___vswprintf_chk (wchar_t *__restrict, size_t, int, size_t,
+				    const wchar_t *__restrict, __gnuc_va_list)
+  __THROW;
+#endif
 
 #endif /* __NLDBL_COMPAT_H */