Hash :
01b5720b
Author :
Date :
2020-08-11T01:53:13
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
/* Wrapper around <monetary.h>.
Copyright (C) 2017-2020 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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <https://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_MONETARY_H
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_MONETARY_H@
# @INCLUDE_NEXT@ @NEXT_MONETARY_H@
#endif
#ifndef _@GUARD_PREFIX@_MONETARY_H
#define _@GUARD_PREFIX@_MONETARY_H
#if @GNULIB_STRFMON_L@
# if @HAVE_XLOCALE_H@
/* Get locale_t on Mac OS X 10.12. */
# include <xlocale.h>
# endif
/* Get locale_t on glibc 2.5. */
# include <locale.h>
#endif
/* Like in <stdio.h>. */
#ifndef _GL_ATTRIBUTE_FORMAT
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
# else
# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
# endif
#endif
/* _GL_ATTRIBUTE_FORMAT_STRFMON
indicates to GCC that the function takes a format string and arguments,
where the format string directives are the ones standardized by ISO C99
and POSIX. */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__gnu_strfmon__, formatstring_parameter, first_argument))
#elif __GNUC__ >= 3
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
_GL_ATTRIBUTE_FORMAT ((__strfmon__, formatstring_parameter, first_argument))
#else
# define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) /* empty */
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
#ifdef __cplusplus
extern "C" {
#endif
#if @GNULIB_STRFMON_L@
/* Converts a monetary value to a string.
See the POSIX:2008 specification
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon_l.html. */
# if @REPLACE_STRFMON_L@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define strfmon_l rpl_strfmon_l
# endif
_GL_FUNCDECL_RPL (strfmon_l, ssize_t,
(char *restrict s, size_t maxsize, locale_t locale,
const char *restrict format, ...)
_GL_ATTRIBUTE_FORMAT_STRFMON (4, 5)
_GL_ARG_NONNULL ((4)));
_GL_CXXALIAS_RPL (strfmon_l, ssize_t,
(char *restrict s, size_t maxsize, locale_t locale,
const char *restrict format, ...));
# else
# if @HAVE_STRFMON_L@
_GL_CXXALIAS_SYS (strfmon_l, ssize_t,
(char *restrict s, size_t maxsize, locale_t locale,
const char *restrict format, ...));
# endif
# endif
# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strfmon_l);
# endif
#elif defined GNULIB_POSIXCHECK
# undef strfmon_l
# if HAVE_RAW_DECL_STRFMON_L
_GL_WARN_ON_USE (strfmon_l, "strfmon_l is buggy on older glibc systems - "
"use gnulib module chown for portability");
# endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* _@GUARD_PREFIX@_MONETARY_H */
#endif /* _@GUARD_PREFIX@_MONETARY_H */