1 /* Wrapper around <monetary.h>.
2 Copyright (C) 2017-2019 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program 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 General Public License for more details.
14 You should have received a copy of the GNU 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 #if @GNULIB_STRFMON_L@
34 /* Get locale_t on Mac OS X 10.12. */
37 /* Get locale_t on glibc 2.5. */
41 /* Like in <stdio.h>. */
42 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
43 # define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
45 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
48 /* _GL_ATTRIBUTE_FORMAT_STRFMON
49 indicates to GCC that the function takes a format string and arguments,
50 where the format string directives are the ones standardized by ISO C99
52 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
53 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
54 _GL_ATTRIBUTE_FORMAT ((__gnu_strfmon__, formatstring_parameter, first_argument))
56 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
57 _GL_ATTRIBUTE_FORMAT ((__strfmon__, formatstring_parameter, first_argument))
59 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) /* empty */
63 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
65 /* The definition of _GL_ARG_NONNULL is copied here. */
67 /* The definition of _GL_WARN_ON_USE is copied here. */
74 #if @GNULIB_STRFMON_L@
75 /* Converts a monetary value to a string.
76 See the POSIX:2008 specification
77 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon_l.html. */
78 # if @REPLACE_STRFMON_L@
79 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
80 # define strfmon_l rpl_strfmon_l
82 _GL_FUNCDECL_RPL (strfmon_l
, ssize_t
, (char *s
, size_t maxsize
, locale_t locale
,
83 const char *format
, ...)
84 _GL_ATTRIBUTE_FORMAT_STRFMON (4, 5)
85 _GL_ARG_NONNULL ((4)));
86 _GL_CXXALIAS_RPL (strfmon_l
, ssize_t
, (char *s
, size_t maxsize
, locale_t locale
,
87 const char *format
, ...));
90 _GL_CXXALIAS_SYS (strfmon_l
, ssize_t
, (char *s
, size_t maxsize
, locale_t locale
,
91 const char *format
, ...));
94 _GL_CXXALIASWARN (strfmon_l
);
95 #elif defined GNULIB_POSIXCHECK
97 # if HAVE_RAW_DECL_STRFMON_L
98 _GL_WARN_ON_USE (strfmon_l
, "strfmon_l is buggy on older glibc systems - "
99 "use gnulib module chown for portability");
108 #endif /* _@GUARD_PREFIX@_MONETARY_H */
109 #endif /* _@GUARD_PREFIX@_MONETARY_H */