exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / monetary.in.h
blob1e654d981f58d79d805c885ec46ac744efa704a2
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
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
24 /* The include_next requires a split double-inclusion guard. */
25 #if @HAVE_MONETARY_H@
26 # @INCLUDE_NEXT@ @NEXT_MONETARY_H@
27 #endif
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."
35 #endif
37 #if @GNULIB_STRFMON_L@
38 # if @HAVE_XLOCALE_H@
39 /* Get locale_t on Mac OS X 10.12. */
40 # include <xlocale.h>
41 # endif
42 /* Get locale_t on glibc 2.5. */
43 # include <locale.h>
44 #endif
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))
50 # else
51 # define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
52 # endif
53 #endif
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
58 and POSIX. */
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))
62 #elif __GNUC__ >= 3
63 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) \
64 _GL_ATTRIBUTE_FORMAT ((__strfmon__, formatstring_parameter, first_argument))
65 #else
66 # define _GL_ATTRIBUTE_FORMAT_STRFMON(formatstring_parameter, first_argument) /* empty */
67 #endif
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. */
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
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
88 # endif
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, ...));
97 # else
98 # if @HAVE_STRFMON_L@
99 _GL_CXXALIAS_SYS (strfmon_l, ssize_t,
100 (char *restrict s, size_t maxsize, locale_t locale,
101 const char *restrict format, ...));
102 # endif
103 # endif
104 # if __GLIBC__ >= 2
105 _GL_CXXALIASWARN (strfmon_l);
106 # endif
107 #elif defined GNULIB_POSIXCHECK
108 # undef strfmon_l
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");
112 # endif
113 #endif
116 #ifdef __cplusplus
118 #endif
120 #endif /* _@GUARD_PREFIX@_MONETARY_H */
121 #endif /* _@GUARD_PREFIX@_MONETARY_H */