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.
+2021-08-22 Bruno Haible <bruno@clisp.org>
+
+ 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.
+
2021-08-22 Bruno Haible <bruno@clisp.org>
gnulib-common.m4: Clarify logic behind _GL_UNUSED_LABEL.
# endif
#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
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+ allocated memory. */
+/* Applies to: functions. */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#ifndef _GL_ATTRIBUTE_PURE
# define _GL_MATH_INLINE _GL_INLINE
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __const__ was added in gcc 2.95. */
+#ifndef _GL_ATTRIBUTE_CONST
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) || defined __clang__
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+# define _GL_ATTRIBUTE_CONST /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
#include <sys/types.h>
#include <time.h>
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _Noreturn is copied here. */
# define SE_CONTEXT_INLINE _GL_INLINE
#endif
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+ the entity is not used. The compiler should not warn if the entity is not
+ used. */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+#endif
+
typedef int context_t;
SE_CONTEXT_INLINE context_t
context_new (_GL_ATTRIBUTE_MAYBE_UNUSED char const *s)
# define SE_LABEL_INLINE _GL_INLINE
#endif
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+ the entity is not used. The compiler should not warn if the entity is not
+ used. */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+#endif
+
#define SELABEL_CTX_FILE 0
struct selabel_handle;
# define SE_SELINUX_INLINE _GL_INLINE
# endif
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+ the entity is not used. The compiler should not warn if the entity is not
+ used. */
+# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+# endif
+
# if !GNULIB_defined_security_types
typedef unsigned short security_class_t;
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.
#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. */
# include <unistd.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
+
+/* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
+ can be freed via 'free'; it can be used only after including <stdlib.h>. */
+/* Applies to: functions. Cannot be used on inline functions. */
+#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
+# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
+#endif
+
+/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
+ allocated memory. */
+/* Applies to: functions. */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if __GNUC__ >= 3 || defined __clang__
+# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define _GL_ATTRIBUTE_MALLOC
+# endif
+#endif
+
/* The __attribute__ feature is available in gcc versions 2.5 and later.
The attribute __pure__ was added in gcc 2.96. */
#ifndef _GL_ATTRIBUTE_PURE
# include <wchar.h>
#endif
-/* The __attribute__ feature is available in gcc versions 2.5 and later.
- The attribute __pure__ was added in gcc 2.96. */
-#ifndef _GL_ATTRIBUTE_PURE
-# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-# else
-# define _GL_ATTRIBUTE_PURE /* empty */
-# endif
-#endif
-
/* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>. */
/* But in any case avoid namespace pollution on glibc systems. */
#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
# include <strings.h>
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
# include <termios.h>
#endif
+/* An __attribute__ __format__ specifier for a function that takes a format
+ string and arguments, where the format string directives are the ones
+ standardized by ISO C99 and POSIX.
+ _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */
+/* __gnu_printf__ is supported in GCC >= 4.4. */
+#ifndef _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
+# else
+# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
+# endif
+#endif
+
+/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
+ the entity is not used. The compiler should not warn if the entity is not
+ used. */
+#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# if 0 /* no GCC or clang version supports this yet */
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# elif defined __GNUC__ || defined __clang__
+# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__))
+# else
+# define _GL_ATTRIBUTE_MAYBE_UNUSED
+# endif
+#endif
+
/* ----------------------------- From ostream.h ----------------------------- */
/* Describes the scope of a flush operation. */
#define styled_ostream_free ostream_free
static inline void
-styled_ostream_begin_use_class (_GL_UNUSED styled_ostream_t stream,
- _GL_UNUSED const char *classname)
+styled_ostream_begin_use_class (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
{
}
static inline void
-styled_ostream_end_use_class (_GL_UNUSED styled_ostream_t stream,
- _GL_UNUSED const char *classname)
+styled_ostream_end_use_class (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *classname)
{
}
static inline const char *
-styled_ostream_get_hyperlink_ref (_GL_UNUSED styled_ostream_t stream)
+styled_ostream_get_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
{
return NULL;
}
static inline const char *
-styled_ostream_get_hyperlink_id (_GL_UNUSED styled_ostream_t stream)
+styled_ostream_get_hyperlink_id (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
{
return NULL;
}
static inline void
-styled_ostream_set_hyperlink (_GL_UNUSED styled_ostream_t stream,
- _GL_UNUSED const char *ref,
- _GL_UNUSED const char *id)
+styled_ostream_set_hyperlink (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *ref,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *id)
{
}
static inline void
-styled_ostream_flush_to_current_style (_GL_UNUSED styled_ostream_t stream)
+styled_ostream_flush_to_current_style (_GL_ATTRIBUTE_MAYBE_UNUSED styled_ostream_t stream)
{
}
#define fd_ostream_free ostream_free
static inline fd_ostream_t
-fd_ostream_create (int fd, _GL_UNUSED const char *filename,
- _GL_UNUSED bool buffered)
+fd_ostream_create (int fd, _GL_ATTRIBUTE_MAYBE_UNUSED const char *filename,
+ _GL_ATTRIBUTE_MAYBE_UNUSED bool buffered)
{
if (fd == 1)
return stdout;
#define term_ostream_free ostream_free
static inline term_color_t
-term_ostream_get_color (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_color (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return COLOR_DEFAULT;
}
static inline void
-term_ostream_set_color (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED term_color_t color)
+term_ostream_set_color (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED term_color_t color)
{
}
static inline term_color_t
-term_ostream_get_bgcolor (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_bgcolor (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return COLOR_DEFAULT;
}
static inline void
-term_ostream_set_bgcolor (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED term_color_t color)
+term_ostream_set_bgcolor (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED term_color_t color)
{
}
static inline term_weight_t
-term_ostream_get_weight (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_weight (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return WEIGHT_DEFAULT;
}
static inline void
-term_ostream_set_weight (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED term_weight_t weight)
+term_ostream_set_weight (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED term_weight_t weight)
{
}
static inline term_posture_t
-term_ostream_get_posture (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_posture (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return POSTURE_DEFAULT;
}
static inline void
-term_ostream_set_posture (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED term_posture_t posture)
+term_ostream_set_posture (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED term_posture_t posture)
{
}
static inline term_underline_t
-term_ostream_get_underline (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_underline (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return UNDERLINE_DEFAULT;
}
static inline void
-term_ostream_set_underline (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED term_underline_t underline)
+term_ostream_set_underline (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED term_underline_t underline)
{
}
static inline const char *
-term_ostream_get_hyperlink_ref (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_hyperlink_ref (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return NULL;
}
static inline const char *
-term_ostream_get_hyperlink_id (_GL_UNUSED term_ostream_t stream)
+term_ostream_get_hyperlink_id (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream)
{
return NULL;
}
static inline void
-term_ostream_set_hyperlink (_GL_UNUSED term_ostream_t stream,
- _GL_UNUSED const char *ref,
- _GL_UNUSED const char *id)
+term_ostream_set_hyperlink (_GL_ATTRIBUTE_MAYBE_UNUSED term_ostream_t stream,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *ref,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *id)
{
}
static inline term_ostream_t
term_ostream_create (int fd, const char *filename,
- _GL_UNUSED ttyctl_t tty_control)
+ _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control)
{
return fd_ostream_create (fd, filename, true);
}
static inline term_styled_ostream_t
term_styled_ostream_create (int fd, const char *filename,
- _GL_UNUSED ttyctl_t tty_control,
- _GL_UNUSED const char *css_filename)
+ _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
{
return fd_ostream_create (fd, filename, true);
}
typedef styled_ostream_t html_styled_ostream_t;
static inline html_styled_ostream_t
-html_styled_ostream_create (_GL_UNUSED ostream_t destination,
- _GL_UNUSED const char *css_filename)
+html_styled_ostream_create (_GL_ATTRIBUTE_MAYBE_UNUSED ostream_t destination,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
{
abort ();
return NULL;
#define style_file_name NULL
static inline bool
-handle_color_option (_GL_UNUSED const char *option)
+handle_color_option (_GL_ATTRIBUTE_MAYBE_UNUSED const char *option)
{
return false;
}
static inline void
-handle_style_option (_GL_UNUSED const char *option)
+handle_style_option (_GL_ATTRIBUTE_MAYBE_UNUSED const char *option)
{
}
}
static inline void
-style_file_prepare (_GL_UNUSED const char *style_file_envvar,
- _GL_UNUSED const char *stylesdir_envvar,
- _GL_UNUSED const char *stylesdir_after_install,
- _GL_UNUSED const char *default_style_file)
+style_file_prepare (_GL_ATTRIBUTE_MAYBE_UNUSED const char *style_file_envvar,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *stylesdir_envvar,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *stylesdir_after_install,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *default_style_file)
{
}
static inline styled_ostream_t
styled_ostream_create (int fd, const char *filename,
- _GL_UNUSED ttyctl_t tty_control,
- _GL_UNUSED const char *css_filename)
+ _GL_ATTRIBUTE_MAYBE_UNUSED ttyctl_t tty_control,
+ _GL_ATTRIBUTE_MAYBE_UNUSED const char *css_filename)
{
return fd_ostream_create (fd, filename, true);
}
static inline void
-libtextstyle_set_failure_exit_code (_GL_UNUSED int exit_code)
+libtextstyle_set_failure_exit_code (_GL_ATTRIBUTE_MAYBE_UNUSED int exit_code)
{
}
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _Noreturn is copied here. */
/* Get mbstate_t, size_t. */
#include <wchar.h>
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#ifndef _GL_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE /* empty */
+# endif
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */