summaryrefslogtreecommitdiff
path: root/lib/se-context.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/se-context.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/se-context.in.h')
-rw-r--r--lib/se-context.in.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/se-context.in.h b/lib/se-context.in.h
index d4ed6a4c1a..a6c178ad68 100644
--- a/lib/se-context.in.h
+++ b/lib/se-context.in.h
@@ -29,6 +29,19 @@ _GL_INLINE_HEADER_BEGIN
# 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)