[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
vfprintf on Solaris
From: |
Bruno Haible |
Subject: |
vfprintf on Solaris |
Date: |
Sun, 4 Apr 2010 21:43:22 +0100 |
User-agent: |
KMail/1.9.9 |
On Solaris 8, with GCC 4.3.3, I'm seeing these errors in the C++ tests:
g++ -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I../gllib -I./../gllib
-I/home/haible/prefix-x86/include -Wall -MT test-stdio-c++.o -MD -MP -MF
.deps/test-stdio-c++.Tpo -c -o test-stdio-c++.o test-stdio-c++.cc
In file included from test-stdio-c++.cc:22:
../gllib/stdio.h:1232: error: invalid conversion from 'int (*)(FILE*, const
char*, void*)' to 'int (*)(FILE*, const char*, char*)'
../gllib/stdio.h:1258: error: invalid conversion from 'int (*)(const char*,
void*)' to 'int (*)(const char*, char*)'
*** Error code 1
These lines correspond to the aliasing of vfprintf and vprintf.
The reason is that these functions take a 'va_list' argument in POSIX, which
for GCC is equivalent to a '__gnuc_va_list' or 'char *'. But Solaris declares
these functions as taking a '__va_list' argument, which is equivalent to
'void *'. For the function vsnprintf, this is corrected by GCC's "fixincludes",
but not for vfprintf and vprintf.
This fixes the error.
2010-04-04 Bruno Haible <address@hidden>
stdio: Fix some C++ test errors on Solaris 8 with GCC.
* lib/stdio.in.h (vdprintf, vfprintf, vprintf, vsprintf): Use
_GL_CXXALIAS_SYS_CAST.
--- lib/stdio.in.h.orig Sun Apr 4 22:36:42 2010
+++ lib/stdio.in.h Sun Apr 4 22:34:46 2010
@@ -921,7 +921,10 @@
__attribute__ ((__format__ (__printf__, 2,
0)))
_GL_ARG_NONNULL ((2)));
# endif
-_GL_CXXALIAS_SYS (vdprintf, int, (int fd, const char *format, va_list args));
+/* Need to cast, because on Solaris, the third parameter will likely be
+ __va_list args. */
+_GL_CXXALIAS_SYS_CAST (vdprintf, int,
+ (int fd, const char *format, va_list args));
# endif
_GL_CXXALIASWARN (vdprintf);
#elif defined GNULIB_POSIXCHECK
@@ -944,7 +947,11 @@
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (vfprintf, int, (FILE *fp, const char *format, va_list args));
# else
-_GL_CXXALIAS_SYS (vfprintf, int, (FILE *fp, const char *format, va_list args));
+/* Need to cast, because on Solaris, the third parameter is
+ __va_list args
+ and GCC's fixincludes did not change this to __gnuc_va_list. */
+_GL_CXXALIAS_SYS_CAST (vfprintf, int,
+ (FILE *fp, const char *format, va_list args));
# endif
_GL_CXXALIASWARN (vfprintf);
#endif
@@ -970,7 +977,10 @@
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (vprintf, int, (const char *format, va_list args));
# else
-_GL_CXXALIAS_SYS (vprintf, int, (const char *format, va_list args));
+/* Need to cast, because on Solaris, the second parameter is
+ __va_list args
+ and GCC's fixincludes did not change this to __gnuc_va_list. */
+_GL_CXXALIAS_SYS_CAST (vprintf, int, (const char *format, va_list args));
# endif
_GL_CXXALIASWARN (vprintf);
#endif
@@ -1026,8 +1036,11 @@
_GL_CXXALIAS_RPL (vsprintf, int,
(char *str, const char *format, va_list args));
# else
-_GL_CXXALIAS_SYS (vsprintf, int,
- (char *str, const char *format, va_list args));
+/* Need to cast, because on Solaris, the third parameter is
+ __va_list args
+ and GCC's fixincludes did not change this to __gnuc_va_list. */
+_GL_CXXALIAS_SYS_CAST (vsprintf, int,
+ (char *str, const char *format, va_list args));
# endif
_GL_CXXALIASWARN (vsprintf);
#elif defined GNULIB_POSIXCHECK
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- vfprintf on Solaris,
Bruno Haible <=