summaryrefslogtreecommitdiff
path: root/lib/stdio.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-08-22 23:54:40 +0200
committerBruno Haible <bruno@clisp.org>2021-08-22 23:54:40 +0200
commit354f27fea9bd4ecb53980de6bd374434a204afc5 (patch)
treea44a75d96097c2ee3e2e679e55cba42f2bf39dc6 /lib/stdio.in.h
parent63f9565f371b2ad9060a0cfa4c40c90dfc4bd5e7 (diff)
downloadgnulib-354f27fea9bd4ecb53980de6bd374434a204afc5.tar.gz
Make generated .in.h files as standalone as possible.
Reported by Jan Engelhardt <jengelh@inai.de>. * lib/stdlib.in.h (_GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_DEALLOC_FREE, _GL_ATTRIBUTE_MALLOC): Add fallback definitions. * lib/dirent.in.h (_GL_ATTRIBUTE_DEALLOC, _GL_ATTRIBUTE_MALLOC): Add fallback definitions. * lib/stdio.in.h (_GL_ATTRIBUTE_DEALLOC): Add fallback definition. * lib/math.in.h (_GL_ATTRIBUTE_CONST): Add fallback definition. * lib/pthread.in.h (_GL_ATTRIBUTE_PURE): Add fallback definition. * lib/threads.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/uchar.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/string.in.h (_GL_ATTRIBUTE_PURE): Move definition, for consistency with the other *.in.h files. * lib/se-context.in.h (_GL_ATTRIBUTE_MAYBE_UNUSED): Add fallback definition. * lib/se-label.in.h (_GL_ATTRIBUTE_MAYBE_UNUSED): Likewise. * lib/se-selinux.in.h (_GL_ATTRIBUTE_MAYBE_UNUSED): Likewise. * lib/textstyle.in.h: Use _GL_ATTRIBUTE_MAYBE_UNUSED instead of _GL_UNUSED. (_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_MAYBE_UNUSED): Add fallback definitions.
Diffstat (limited to 'lib/stdio.in.h')
-rw-r--r--lib/stdio.in.h81
1 files changed, 46 insertions, 35 deletions
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index f1bf817322..0ca2c8e10c 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -56,6 +56,52 @@
May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
+/* Solaris 10 and NetBSD 7.0 declare 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 __NetBSD__) \
+ && ! defined __GLIBC__
+# include <unistd.h>
+#endif
+
+/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+ && ! defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
+/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
+ it before we #define perror rpl_perror. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
+ && (defined _WIN32 && ! defined __CYGWIN__) \
+ && ! defined __GLIBC__
+# include <stdlib.h>
+#endif
+
+/* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include
+ it before we #define remove rpl_remove. */
+/* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include
+ it before we #define rename rpl_rename. */
+/* But in any case avoid namespace pollution on glibc systems. */
+#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
+ && (defined _WIN32 && ! defined __CYGWIN__) \
+ && ! defined __GLIBC__
+# include <io.h>
+#endif
+
+
+/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
+ that can be freed by passing them as the Ith argument to the
+ function F. */
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if __GNUC__ >= 11
+# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+# define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
+#endif
+
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The __-protected variants of the attributes 'format' and 'printf' are
accepted by gcc versions 2.6.4 (effectively 2.7) and later.
@@ -127,41 +173,6 @@
#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
-/* Solaris 10 and NetBSD 7.0 declare 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 __NetBSD__) \
- && ! defined __GLIBC__
-# include <unistd.h>
-#endif
-
-/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>. */
-/* But in any case avoid namespace pollution on glibc systems. */
-#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
- && ! defined __GLIBC__
-# include <sys/stat.h>
-#endif
-
-/* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>. We must include
- it before we #define perror rpl_perror. */
-/* But in any case avoid namespace pollution on glibc systems. */
-#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
- && (defined _WIN32 && ! defined __CYGWIN__) \
- && ! defined __GLIBC__
-# include <stdlib.h>
-#endif
-
-/* MSVC declares 'remove' in <io.h>, not in <stdio.h>. We must include
- it before we #define remove rpl_remove. */
-/* MSVC declares 'rename' in <io.h>, not in <stdio.h>. We must include
- it before we #define rename rpl_rename. */
-/* But in any case avoid namespace pollution on glibc systems. */
-#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
- && (defined _WIN32 && ! defined __CYGWIN__) \
- && ! defined __GLIBC__
-# include <io.h>
-#endif
-
-
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */