summaryrefslogtreecommitdiff
path: root/lib/arg-nonnull.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-08-11 01:53:13 +0200
committerBruno Haible <bruno@clisp.org>2020-08-11 01:53:13 +0200
commit01b5720b10727306c043327c0693203a6f77379b (patch)
treee32c03cb7f5411f7d570b7de9f81825cbddb0194 /lib/arg-nonnull.h
parent81d65ad9b9df5cdfd4dd1deb7b712b6e907dd9db (diff)
downloadgnulib-01b5720b10727306c043327c0693203a6f77379b.tar.gz
Use many __attribute__s with clang.
* m4/gnulib-common.m4 (_Noreturn): Use __attribute__ __noreturn__ also on clang. * lib/cdefs.h (__glibc_clang_has_attribute, __glibc_clang_has_builtin): New macros. (__THROW, __THROWNL, __NTH, __NTHNL): Use __attribute__ __nothrow__ also on clang. (__warndecl, __warnattr, __errordecl): Use __attribute__ __diagnose_if__ also on older clang versions. (__attribute__): Don't define to empty on clang. (__attribute_malloc__): Use __attribute__ __malloc__ also on clang. (__attribute_pure__): Use __attribute__ __pure__ also on clang. (__attribute_const__): Use __attribute__ __const__ also on clang. (__attribute_used__): Use __attribute__ __used__ also on clang. (__attribute_noinline__): Use __attribute__ __noinline__ also on clang. (__attribute_deprecated__): Use __attribute__ __deprecated__ also on clang. (__attribute_format_arg__): Use __attribute__ __format_arg__ also on clang. (__attribute_format_strfmon__): Use __attribute__ __format__ __strfmon__ also on clang. (__nonnull): Use __attribute__ __nonnull__ also on clang. (__attribute_warn_unused_result__): Use __attribute__ __warn_unused_result__ also on clang. (__always_inline): Use __attribute__ __always_inline__ also on clang. (__attribute_artificial__): Use __attribute__ __artificial__ also on clang >= 7. (__glibc_unlikely, __glibc_likely): Use __builtin_expect also on older clang versions. (_Noreturn): Don't redefine on clang >= 3.5. * lib/arg-nonnull.h (_GL_ARG_NONNULL): Use __attribute__ __nonnull__ also on clang. * lib/dirent.in.h (_GL_ATTRIBUTE_PURE): Use __attribute__ __pure__ also on clang. * lib/stdlib.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/string.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/wchar.in.h (_GL_ATTRIBUTE_PURE): Likewise. * lib/stdio.in.h (_GL_ATTRIBUTE_FORMAT): Use __attribute__ __format__ also on clang. * lib/monetary.in.h (_GL_ATTRIBUTE_FORMAT): Likewise. * lib/textstyle.in.h (ostream_printf, ostream_vprintf): Likewise. * lib/unitypes.in.h (_UC_ATTRIBUTE_CONST): Use __attribute__ __const__ also on clang. (_UC_ATTRIBUTE_PURE): Use __attribute__ __pure__ also on clang. * lib/noreturn.h (_GL_NORETURN_FUNC, _GL_NORETURN_FUNCPTR): Use __attribute__ __noreturn__ also on clang. * lib/obstack.h (__attribute_noreturn__): Likewise. * lib/file-set.h (record_file): Use __attribute__ __nonnull__ also on clang. * lib/argp-help.c (hol_entry_long_iterate): Use __attribute__ always_inline also on clang. * tests/test-printf-posix.c (func1, func2, func3, func4): Test also on clang.
Diffstat (limited to 'lib/arg-nonnull.h')
-rw-r--r--lib/arg-nonnull.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h
index d4d195a1af..42d7e70b3a 100644
--- a/lib/arg-nonnull.h
+++ b/lib/arg-nonnull.h
@@ -18,7 +18,7 @@
that the values passed as arguments n, ..., m must be non-NULL pointers.
n = 1 stands for the first argument, n = 2 for the second argument etc. */
#ifndef _GL_ARG_NONNULL
-# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
# else
# define _GL_ARG_NONNULL(params)