1 /* Wrapper around <monetary.h>.
2 Copyright (C) 2017-2024 Free Software Foundation, Inc.
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 #ifndef _@GUARD_PREFIX@_MONETARY_H
20 @PRAGMA_SYSTEM_HEADER@
24 /* The include_next requires a split double-inclusion guard. */
26 # @INCLUDE_NEXT@ @NEXT_MONETARY_H@
29 #ifndef _@GUARD_PREFIX@_MONETARY_H
30 #define _@GUARD_PREFIX@_MONETARY_H
32 /* This file uses _GL_ATTRIBUTE_FORMAT, GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
33 #if !_GL_CONFIG_H_INCLUDED
34 #error "Please include config.h first."
37 #if @GNULIB_STRFMON_L@
39 /* Get locale_t on Mac OS X 10.12. */
42 /* Get locale_t on glibc 2.5. */
46 /* Like in <stdio.h>. */
47 #ifndef _GL_ATTRIBUTE_FORMAT
48 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__
49 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
51 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
55 /* _GL_ATTRIBUTE_FORMAT_STRFMON
56 indicates to GCC that the function takes a format string and arguments,
57 where the format string directives are the ones standardized by ISO C99
59 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
60 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
61 _GL_ATTRIBUTE_FORMAT ((__gnu_strfmon__, formatstring_parameter, first_argument))
63 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
64 _GL_ATTRIBUTE_FORMAT ((__strfmon__, formatstring_parameter, first_argument))
66 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) /* empty */
70 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
72 /* The definition of _GL_ARG_NONNULL is copied here. */
74 /* The definition of _GL_WARN_ON_USE is copied here. */
81 #if @GNULIB_STRFMON_L@
82 /* Converts a monetary value to a string.
83 See the POSIX:2008 specification
84 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon_l.html. */
85 # if @REPLACE_STRFMON_L@
86 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
87 # define strfmon_l rpl_strfmon_l
89 _GL_FUNCDECL_RPL (strfmon_l
, ssize_t
,
90 (char *restrict s
, size_t maxsize
, locale_t locale
,
91 const char *restrict format
, ...),
92 _GL_ATTRIBUTE_FORMAT_STRFMON (4, 5)
93 _GL_ARG_NONNULL ((4)));
94 _GL_CXXALIAS_RPL (strfmon_l
, ssize_t
,
95 (char *restrict s
, size_t maxsize
, locale_t locale
,
96 const char *restrict format
, ...));
99 _GL_CXXALIAS_SYS (strfmon_l
, ssize_t
,
100 (char *restrict s
, size_t maxsize
, locale_t locale
,
101 const char *restrict format
, ...));
105 _GL_CXXALIASWARN (strfmon_l
);
107 #elif defined GNULIB_POSIXCHECK
109 # if HAVE_RAW_DECL_STRFMON_L
110 _GL_WARN_ON_USE (strfmon_l
, "strfmon_l is buggy on older glibc systems - "
111 "use gnulib module chown for portability");
120 #endif /* _@GUARD_PREFIX@_MONETARY_H */
121 #endif /* _@GUARD_PREFIX@_MONETARY_H */