/* A GNU-like <stdio.h>.
- Copyright (C) 2004, 2007-2010 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
+@PRAGMA_COLUMNS@
-#if defined __need_FILE || defined __need___FILE
-/* Special invocation convention inside glibc header files. */
+#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
+/* Special invocation convention:
+ - Inside glibc header files.
+ - On OSF/1 5.1 we have a sequence of nested includes
+ <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
+ <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
+ In this situation, the functions are not yet declared, therefore we cannot
+ provide the C++ aliases. */
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
#ifndef _GL_STDIO_H
+#define _GL_ALREADY_INCLUDING_STDIO_H
+
/* The include_next requires a split double-inclusion guard. */
#@INCLUDE_NEXT@ @NEXT_STDIO_H@
+#undef _GL_ALREADY_INCLUDING_STDIO_H
+
#ifndef _GL_STDIO_H
#define _GL_STDIO_H
# endif
#endif
+/* Solaris 10 declares renameat in <unistd.h>, not in <stdio.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __sun \
+ && ! defined __GLIBC__
+# include <unistd.h>
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
#elif defined GNULIB_POSIXCHECK
# undef freopen
/* Assume freopen is always declared. */
-_GL_WARN_ON_USE (freopen, "freopen on Win32 platforms is not POSIX compatible - "
+_GL_WARN_ON_USE (freopen,
+ "freopen on Win32 platforms is not POSIX compatible - "
"use gnulib module freopen for portability");
#endif
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
# else
-# if ! @HAVE_FSEEKO@
+# if ! @HAVE_DECL_FSEEKO@
_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
_GL_ARG_NONNULL ((1)));
# endif
_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
# else
-# if ! @HAVE_FTELLO@
+# if ! @HAVE_DECL_FTELLO@
_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
# else
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define printf rpl_printf
+# endif
_GL_FUNCDECL_RPL (printf, int,
(const char *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)))
_GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (printf, printf, int, (const char *format, ...));
+_GL_CXXALIAS_RPL (printf, int, (const char *format, ...));
# endif
# define GNULIB_overrides_printf 1
# else