1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A POSIX <locale.h>.
3    Copyright (C) 2007-2020 Free Software Foundation, Inc.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 #if __GNUC__ >= 3
19 #pragma GCC system_header
20 #endif
21 
22 
23 #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \
24     || defined _GL_ALREADY_INCLUDING_LOCALE_H
25 
26 /* Special invocation convention:
27    - Inside mingw header files,
28    - To handle Solaris header files (through Solaris 10) when combined
29      with gettext's libintl.h.  */
30 
31 #include_next <locale.h>
32 
33 #else
34 /* Normal invocation convention.  */
35 
36 #ifndef _GL_LOCALE_H
37 
38 #define _GL_ALREADY_INCLUDING_LOCALE_H
39 
40 /* The include_next requires a split double-inclusion guard.  */
41 #include_next <locale.h>
42 
43 #undef _GL_ALREADY_INCLUDING_LOCALE_H
44 
45 #ifndef _GL_LOCALE_H
46 #define _GL_LOCALE_H
47 
48 /* NetBSD 5.0 mis-defines NULL.  */
49 #include <stddef.h>
50 
51 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
52 #if 1
53 # include <xlocale.h>
54 #endif
55 
56 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
57 /* C++ compatible function declaration macros.
58    Copyright (C) 2010-2020 Free Software Foundation, Inc.
59 
60    This program is free software: you can redistribute it and/or modify it
61    under the terms of the GNU General Public License as published
62    by the Free Software Foundation; either version 3 of the License, or
63    (at your option) any later version.
64 
65    This program is distributed in the hope that it will be useful,
66    but WITHOUT ANY WARRANTY; without even the implied warranty of
67    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
68    General Public License for more details.
69 
70    You should have received a copy of the GNU General Public License
71    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
72 
73 #ifndef _GL_CXXDEFS_H
74 #define _GL_CXXDEFS_H
75 
76 /* Begin/end the GNULIB_NAMESPACE namespace.  */
77 #if defined __cplusplus && defined GNULIB_NAMESPACE
78 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
79 # define _GL_END_NAMESPACE }
80 #else
81 # define _GL_BEGIN_NAMESPACE
82 # define _GL_END_NAMESPACE
83 #endif
84 
85 /* The three most frequent use cases of these macros are:
86 
87    * For providing a substitute for a function that is missing on some
88      platforms, but is declared and works fine on the platforms on which
89      it exists:
90 
91        #if @GNULIB_FOO@
92        # if !@HAVE_FOO@
93        _GL_FUNCDECL_SYS (foo, ...);
94        # endif
95        _GL_CXXALIAS_SYS (foo, ...);
96        _GL_CXXALIASWARN (foo);
97        #elif defined GNULIB_POSIXCHECK
98        ...
99        #endif
100 
101    * For providing a replacement for a function that exists on all platforms,
102      but is broken/insufficient and needs to be replaced on some platforms:
103 
104        #if @GNULIB_FOO@
105        # if @REPLACE_FOO@
106        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
107        #   undef foo
108        #   define foo rpl_foo
109        #  endif
110        _GL_FUNCDECL_RPL (foo, ...);
111        _GL_CXXALIAS_RPL (foo, ...);
112        # else
113        _GL_CXXALIAS_SYS (foo, ...);
114        # endif
115        _GL_CXXALIASWARN (foo);
116        #elif defined GNULIB_POSIXCHECK
117        ...
118        #endif
119 
120    * For providing a replacement for a function that exists on some platforms
121      but is broken/insufficient and needs to be replaced on some of them and
122      is additionally either missing or undeclared on some other platforms:
123 
124        #if @GNULIB_FOO@
125        # if @REPLACE_FOO@
126        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
127        #   undef foo
128        #   define foo rpl_foo
129        #  endif
130        _GL_FUNCDECL_RPL (foo, ...);
131        _GL_CXXALIAS_RPL (foo, ...);
132        # else
133        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
134        _GL_FUNCDECL_SYS (foo, ...);
135        #  endif
136        _GL_CXXALIAS_SYS (foo, ...);
137        # endif
138        _GL_CXXALIASWARN (foo);
139        #elif defined GNULIB_POSIXCHECK
140        ...
141        #endif
142 */
143 
144 /* _GL_EXTERN_C declaration;
145    performs the declaration with C linkage.  */
146 #if defined __cplusplus
147 # define _GL_EXTERN_C extern "C"
148 #else
149 # define _GL_EXTERN_C extern
150 #endif
151 
152 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
153    declares a replacement function, named rpl_func, with the given prototype,
154    consisting of return type, parameters, and attributes.
155    Example:
156      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
157                                   _GL_ARG_NONNULL ((1)));
158  */
159 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
160   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
161 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
162   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
163 
164 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
165    declares the system function, named func, with the given prototype,
166    consisting of return type, parameters, and attributes.
167    Example:
168      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
169                                   _GL_ARG_NONNULL ((1)));
170  */
171 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
172   _GL_EXTERN_C rettype func parameters_and_attributes
173 
174 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
175    declares a C++ alias called GNULIB_NAMESPACE::func
176    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
177    Example:
178      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
179 
180    Wrapping rpl_func in an object with an inline conversion operator
181    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
182    actually used in the program.  */
183 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
184   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
185 #if defined __cplusplus && defined GNULIB_NAMESPACE
186 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
187     namespace GNULIB_NAMESPACE                                \
188     {                                                         \
189       static const struct _gl_ ## func ## _wrapper            \
190       {                                                       \
191         typedef rettype (*type) parameters;                   \
192                                                               \
193         inline operator type () const                         \
194         {                                                     \
195           return ::rpl_func;                                  \
196         }                                                     \
197       } func = {};                                            \
198     }                                                         \
199     _GL_EXTERN_C int _gl_cxxalias_dummy
200 #else
201 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
202     _GL_EXTERN_C int _gl_cxxalias_dummy
203 #endif
204 
205 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
206    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
207    except that the C function rpl_func may have a slightly different
208    declaration.  A cast is used to silence the "invalid conversion" error
209    that would otherwise occur.  */
210 #if defined __cplusplus && defined GNULIB_NAMESPACE
211 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
212     namespace GNULIB_NAMESPACE                                     \
213     {                                                              \
214       static const struct _gl_ ## func ## _wrapper                 \
215       {                                                            \
216         typedef rettype (*type) parameters;                        \
217                                                                    \
218         inline operator type () const                              \
219         {                                                          \
220           return reinterpret_cast<type>(::rpl_func);               \
221         }                                                          \
222       } func = {};                                                 \
223     }                                                              \
224     _GL_EXTERN_C int _gl_cxxalias_dummy
225 #else
226 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
227     _GL_EXTERN_C int _gl_cxxalias_dummy
228 #endif
229 
230 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
231    declares a C++ alias called GNULIB_NAMESPACE::func
232    that redirects to the system provided function func, if GNULIB_NAMESPACE
233    is defined.
234    Example:
235      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
236 
237    Wrapping func in an object with an inline conversion operator
238    avoids a reference to func unless GNULIB_NAMESPACE::func is
239    actually used in the program.  */
240 #if defined __cplusplus && defined GNULIB_NAMESPACE
241 # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
242     namespace GNULIB_NAMESPACE                                \
243     {                                                         \
244       static const struct _gl_ ## func ## _wrapper            \
245       {                                                       \
246         typedef rettype (*type) parameters;                   \
247                                                               \
248         inline operator type () const                         \
249         {                                                     \
250           return ::func;                                      \
251         }                                                     \
252       } func = {};                                            \
253     }                                                         \
254     _GL_EXTERN_C int _gl_cxxalias_dummy
255 #else
256 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
257     _GL_EXTERN_C int _gl_cxxalias_dummy
258 #endif
259 
260 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
261    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
262    except that the C function func may have a slightly different declaration.
263    A cast is used to silence the "invalid conversion" error that would
264    otherwise occur.  */
265 #if defined __cplusplus && defined GNULIB_NAMESPACE
266 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
267     namespace GNULIB_NAMESPACE                          \
268     {                                                   \
269       static const struct _gl_ ## func ## _wrapper      \
270       {                                                 \
271         typedef rettype (*type) parameters;             \
272                                                         \
273         inline operator type () const                   \
274         {                                               \
275           return reinterpret_cast<type>(::func);        \
276         }                                               \
277       } func = {};                                      \
278     }                                                   \
279     _GL_EXTERN_C int _gl_cxxalias_dummy
280 #else
281 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
282     _GL_EXTERN_C int _gl_cxxalias_dummy
283 #endif
284 
285 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
286    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
287    except that the C function is picked among a set of overloaded functions,
288    namely the one with rettype2 and parameters2.  Two consecutive casts
289    are used to silence the "cannot find a match" and "invalid conversion"
290    errors that would otherwise occur.  */
291 #if defined __cplusplus && defined GNULIB_NAMESPACE
292   /* The outer cast must be a reinterpret_cast.
293      The inner cast: When the function is defined as a set of overloaded
294      functions, it works as a static_cast<>, choosing the designated variant.
295      When the function is defined as a single variant, it works as a
296      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
297 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
298     namespace GNULIB_NAMESPACE                                                \
299     {                                                                         \
300       static const struct _gl_ ## func ## _wrapper                            \
301       {                                                                       \
302         typedef rettype (*type) parameters;                                   \
303                                                                               \
304         inline operator type () const                                         \
305         {                                                                     \
306           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
307         }                                                                     \
308       } func = {};                                                            \
309     }                                                                         \
310     _GL_EXTERN_C int _gl_cxxalias_dummy
311 #else
312 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
313     _GL_EXTERN_C int _gl_cxxalias_dummy
314 #endif
315 
316 /* _GL_CXXALIASWARN (func);
317    causes a warning to be emitted when ::func is used but not when
318    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
319    variants.  */
320 #if defined __cplusplus && defined GNULIB_NAMESPACE
321 # define _GL_CXXALIASWARN(func) \
322    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
323 # define _GL_CXXALIASWARN_1(func,namespace) \
324    _GL_CXXALIASWARN_2 (func, namespace)
325 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
326    we enable the warning only when not optimizing.  */
327 # if !__OPTIMIZE__
328 #  define _GL_CXXALIASWARN_2(func,namespace) \
329     _GL_WARN_ON_USE (func, \
330                      "The symbol ::" #func " refers to the system function. " \
331                      "Use " #namespace "::" #func " instead.")
332 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
333 #  define _GL_CXXALIASWARN_2(func,namespace) \
334      extern __typeof__ (func) func
335 # else
336 #  define _GL_CXXALIASWARN_2(func,namespace) \
337      _GL_EXTERN_C int _gl_cxxalias_dummy
338 # endif
339 #else
340 # define _GL_CXXALIASWARN(func) \
341     _GL_EXTERN_C int _gl_cxxalias_dummy
342 #endif
343 
344 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
345    causes a warning to be emitted when the given overloaded variant of ::func
346    is used but not when GNULIB_NAMESPACE::func is used.  */
347 #if defined __cplusplus && defined GNULIB_NAMESPACE
348 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
349    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
350                         GNULIB_NAMESPACE)
351 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
352    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
353 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
354    we enable the warning only when not optimizing.  */
355 # if !__OPTIMIZE__
356 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
357     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
358                          "The symbol ::" #func " refers to the system function. " \
359                          "Use " #namespace "::" #func " instead.")
360 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
361 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
362      extern __typeof__ (func) func
363 # else
364 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
365      _GL_EXTERN_C int _gl_cxxalias_dummy
366 # endif
367 #else
368 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
369     _GL_EXTERN_C int _gl_cxxalias_dummy
370 #endif
371 
372 #endif /* _GL_CXXDEFS_H */
373 
374 /* The definition of _GL_ARG_NONNULL is copied here.  */
375 /* A C macro for declaring that specific arguments must not be NULL.
376    Copyright (C) 2009-2020 Free Software Foundation, Inc.
377 
378    This program is free software: you can redistribute it and/or modify it
379    under the terms of the GNU General Public License as published
380    by the Free Software Foundation; either version 3 of the License, or
381    (at your option) any later version.
382 
383    This program is distributed in the hope that it will be useful,
384    but WITHOUT ANY WARRANTY; without even the implied warranty of
385    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
386    General Public License for more details.
387 
388    You should have received a copy of the GNU General Public License
389    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
390 
391 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
392    that the values passed as arguments n, ..., m must be non-NULL pointers.
393    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
394 #ifndef _GL_ARG_NONNULL
395 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
396 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
397 # else
398 #  define _GL_ARG_NONNULL(params)
399 # endif
400 #endif
401 
402 /* The definition of _GL_WARN_ON_USE is copied here.  */
403 /* A C macro for emitting warnings if a function is used.
404    Copyright (C) 2010-2020 Free Software Foundation, Inc.
405 
406    This program is free software: you can redistribute it and/or modify it
407    under the terms of the GNU General Public License as published
408    by the Free Software Foundation; either version 3 of the License, or
409    (at your option) any later version.
410 
411    This program is distributed in the hope that it will be useful,
412    but WITHOUT ANY WARRANTY; without even the implied warranty of
413    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
414    General Public License for more details.
415 
416    You should have received a copy of the GNU General Public License
417    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
418 
419 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
420    for FUNCTION which will then trigger a compiler warning containing
421    the text of "literal string" anywhere that function is called, if
422    supported by the compiler.  If the compiler does not support this
423    feature, the macro expands to an unused extern declaration.
424 
425    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
426    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
427    this feature, it expands to empty.
428 
429    These macros are useful for marking a function as a potential
430    portability trap, with the intent that "literal string" include
431    instructions on the replacement function that should be used
432    instead.
433    _GL_WARN_ON_USE is for functions with 'extern' linkage.
434    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
435    linkage.
436 
437    However, one of the reasons that a function is a portability trap is
438    if it has the wrong signature.  Declaring FUNCTION with a different
439    signature in C is a compilation error, so this macro must use the
440    same type as any existing declaration so that programs that avoid
441    the problematic FUNCTION do not fail to compile merely because they
442    included a header that poisoned the function.  But this implies that
443    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
444    have a declaration.  Use of this macro implies that there must not
445    be any other macro hiding the declaration of FUNCTION; but
446    undefining FUNCTION first is part of the poisoning process anyway
447    (although for symbols that are provided only via a macro, the result
448    is a compilation error rather than a warning containing
449    "literal string").  Also note that in C++, it is only safe to use if
450    FUNCTION has no overloads.
451 
452    For an example, it is possible to poison 'getline' by:
453    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
454      [getline]) in configure.ac, which potentially defines
455      HAVE_RAW_DECL_GETLINE
456    - adding this code to a header that wraps the system <stdio.h>:
457      #undef getline
458      #if HAVE_RAW_DECL_GETLINE
459      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
460        "not universally present; use the gnulib module getline");
461      #endif
462 
463    It is not possible to directly poison global variables.  But it is
464    possible to write a wrapper accessor function, and poison that
465    (less common usage, like &environ, will cause a compilation error
466    rather than issue the nice warning, but the end result of informing
467    the developer about their portability problem is still achieved):
468      #if HAVE_RAW_DECL_ENVIRON
469      static char ***
470      rpl_environ (void) { return &environ; }
471      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
472      # undef environ
473      # define environ (*rpl_environ ())
474      #endif
475    or better (avoiding contradictory use of 'static' and 'extern'):
476      #if HAVE_RAW_DECL_ENVIRON
477      static char ***
478      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
479      rpl_environ (void) { return &environ; }
480      # undef environ
481      # define environ (*rpl_environ ())
482      #endif
483    */
484 #ifndef _GL_WARN_ON_USE
485 
486 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
487 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
488 #  define _GL_WARN_ON_USE(function, message) \
489 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
490 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
491   __attribute__ ((__warning__ (message)))
492 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
493 /* Verify the existence of the function.  */
494 #  define _GL_WARN_ON_USE(function, message) \
495 extern __typeof__ (function) function
496 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
497 # else /* Unsupported.  */
498 #  define _GL_WARN_ON_USE(function, message) \
499 _GL_WARN_EXTERN_C int _gl_warn_on_use
500 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
501 # endif
502 #endif
503 
504 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
505    is like _GL_WARN_ON_USE (function, "string"), except that the function is
506    declared with the given prototype, consisting of return type, parameters,
507    and attributes.
508    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
509    not work in this case.  */
510 #ifndef _GL_WARN_ON_USE_CXX
511 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
512 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
513 extern rettype function parameters_and_attributes \
514      __attribute__ ((__warning__ (msg)))
515 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
516 /* Verify the existence of the function.  */
517 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
518 extern rettype function parameters_and_attributes
519 # else /* Unsupported.  */
520 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
521 _GL_WARN_EXTERN_C int _gl_warn_on_use
522 # endif
523 #endif
524 
525 /* _GL_WARN_EXTERN_C declaration;
526    performs the declaration with C linkage.  */
527 #ifndef _GL_WARN_EXTERN_C
528 # if defined __cplusplus
529 #  define _GL_WARN_EXTERN_C extern "C"
530 # else
531 #  define _GL_WARN_EXTERN_C extern
532 # endif
533 #endif
534 
535 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
536    On systems that don't define it, use the same value as GNU libintl.  */
537 #if !defined LC_MESSAGES
538 # define LC_MESSAGES 1729
539 #endif
540 
541 /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
542    int_n_*.  Instead of overriding 'struct lconv', merely define these member
543    names as macros.  This avoids trouble in C++ mode.  */
544 #if defined _MSC_VER
545 # define int_p_cs_precedes   p_cs_precedes
546 # define int_p_sign_posn     p_sign_posn
547 # define int_p_sep_by_space  p_sep_by_space
548 # define int_n_cs_precedes   n_cs_precedes
549 # define int_n_sign_posn     n_sign_posn
550 # define int_n_sep_by_space  n_sep_by_space
551 #endif
552 
553 /* Bionic libc's 'struct lconv' is just a dummy.  */
554 #if 0
555 # define lconv rpl_lconv
556 struct lconv
557 {
558   /* All 'char *' are actually 'const char *'.  */
559 
560   /* Members that depend on the LC_NUMERIC category of the locale.  See
561      <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
562 
563   /* Symbol used as decimal point.  */
564   char *decimal_point;
565   /* Symbol used to separate groups of digits to the left of the decimal
566      point.  */
567   char *thousands_sep;
568   /* Definition of the size of groups of digits to the left of the decimal
569      point.  */
570   char *grouping;
571 
572   /* Members that depend on the LC_MONETARY category of the locale.  See
573      <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
574 
575   /* Symbol used as decimal point.  */
576   char *mon_decimal_point;
577   /* Symbol used to separate groups of digits to the left of the decimal
578      point.  */
579   char *mon_thousands_sep;
580   /* Definition of the size of groups of digits to the left of the decimal
581      point.  */
582   char *mon_grouping;
583   /* Sign used to indicate a value >= 0.  */
584   char *positive_sign;
585   /* Sign used to indicate a value < 0.  */
586   char *negative_sign;
587 
588   /* For formatting local currency.  */
589   /* Currency symbol (3 characters) followed by separator (1 character).  */
590   char *currency_symbol;
591   /* Number of digits after the decimal point.  */
592   char frac_digits;
593   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
594      comes after the number.  */
595   char p_cs_precedes;
596   /* For values >= 0: Position of the sign.  */
597   char p_sign_posn;
598   /* For values >= 0: Placement of spaces between currency symbol, sign, and
599      number.  */
600   char p_sep_by_space;
601   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
602      comes after the number.  */
603   char n_cs_precedes;
604   /* For values < 0: Position of the sign.  */
605   char n_sign_posn;
606   /* For values < 0: Placement of spaces between currency symbol, sign, and
607      number.  */
608   char n_sep_by_space;
609 
610   /* For formatting international currency.  */
611   /* Currency symbol (3 characters) followed by separator (1 character).  */
612   char *int_curr_symbol;
613   /* Number of digits after the decimal point.  */
614   char int_frac_digits;
615   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
616      comes after the number.  */
617   char int_p_cs_precedes;
618   /* For values >= 0: Position of the sign.  */
619   char int_p_sign_posn;
620   /* For values >= 0: Placement of spaces between currency symbol, sign, and
621      number.  */
622   char int_p_sep_by_space;
623   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
624      comes after the number.  */
625   char int_n_cs_precedes;
626   /* For values < 0: Position of the sign.  */
627   char int_n_sign_posn;
628   /* For values < 0: Placement of spaces between currency symbol, sign, and
629      number.  */
630   char int_n_sep_by_space;
631 };
632 #endif
633 
634 #if 1
635 # if 0
636 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
637 #   undef localeconv
638 #   define localeconv rpl_localeconv
639 #  endif
640 _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
641 _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
642 # else
643 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
644 # endif
645 # if __GLIBC__ >= 2
646 _GL_CXXALIASWARN (localeconv);
647 # endif
648 #elif 0
649 # undef localeconv
650 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
651 #elif defined GNULIB_POSIXCHECK
652 # undef localeconv
653 # if HAVE_RAW_DECL_LOCALECONV
654 _GL_WARN_ON_USE (localeconv,
655                  "localeconv returns too few information on some platforms - "
656                  "use gnulib module localeconv for portability");
657 # endif
658 #endif
659 
660 #if IN_GREP_GNULIB_TESTS
661 # if 1
662 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
663 #   undef setlocale
664 #   define setlocale rpl_setlocale
665 #   define GNULIB_defined_setlocale 1
666 #  endif
667 _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
668 _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
669 # else
670 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
671 # endif
672 # if __GLIBC__ >= 2
673 _GL_CXXALIASWARN (setlocale);
674 # endif
675 #elif defined GNULIB_POSIXCHECK
676 # undef setlocale
677 # if HAVE_RAW_DECL_SETLOCALE
678 _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
679                  "use gnulib module setlocale for portability");
680 # endif
681 #endif
682 
683 #if 1
684 /* Included here for convenience.  */
685 # include "setlocale_null.h"
686 #endif
687 
688 #if /*@GNULIB_NEWLOCALE@ ||*/ (IN_GREP_GNULIB_TESTS && 1)
689 # if 0
690 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
691 #   undef newlocale
692 #   define newlocale rpl_newlocale
693 #   define GNULIB_defined_newlocale 1
694 #  endif
695 _GL_FUNCDECL_RPL (newlocale, locale_t,
696                   (int category_mask, const char *name, locale_t base)
697                   _GL_ARG_NONNULL ((2)));
698 _GL_CXXALIAS_RPL (newlocale, locale_t,
699                   (int category_mask, const char *name, locale_t base));
700 # else
701 #  if 1
702 _GL_CXXALIAS_SYS (newlocale, locale_t,
703                   (int category_mask, const char *name, locale_t base));
704 #  endif
705 # endif
706 # if 1
707 _GL_CXXALIASWARN (newlocale);
708 # endif
709 # if 1 || 0
710 #  ifndef HAVE_WORKING_NEWLOCALE
711 #   define HAVE_WORKING_NEWLOCALE 1
712 #  endif
713 # endif
714 #elif defined GNULIB_POSIXCHECK
715 # undef newlocale
716 # if HAVE_RAW_DECL_NEWLOCALE
717 _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
718 # endif
719 #endif
720 
721 #if 0 || (IN_GREP_GNULIB_TESTS && 1)
722 # if 0
723 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
724 #   undef duplocale
725 #   define duplocale rpl_duplocale
726 #   define GNULIB_defined_duplocale 1
727 #  endif
728 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
729 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
730 # else
731 #  if 1
732 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
733 #  endif
734 # endif
735 # if 1
736 _GL_CXXALIASWARN (duplocale);
737 # endif
738 # if 1 || 0
739 #  ifndef HAVE_WORKING_DUPLOCALE
740 #   define HAVE_WORKING_DUPLOCALE 1
741 #  endif
742 # endif
743 #elif defined GNULIB_POSIXCHECK
744 # undef duplocale
745 # if HAVE_RAW_DECL_DUPLOCALE
746 _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
747                  "use gnulib module duplocale for portability");
748 # endif
749 #endif
750 
751 #if /*@GNULIB_FREELOCALE@ ||*/ (IN_GREP_GNULIB_TESTS && 1)
752 # if 0
753 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
754 #   undef freelocale
755 #   define freelocale rpl_freelocale
756 #   define GNULIB_defined_freelocale 1
757 #  endif
758 _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
759 _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
760 # else
761 #  if 1
762 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
763                                    int.  */
764 _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
765 #  endif
766 # endif
767 # if 1
768 _GL_CXXALIASWARN (freelocale);
769 # endif
770 #elif defined GNULIB_POSIXCHECK
771 # undef freelocale
772 # if HAVE_RAW_DECL_FREELOCALE
773 _GL_WARN_ON_USE (freelocale, "freelocale is not portable");
774 # endif
775 #endif
776 
777 #endif /* _GL_LOCALE_H */
778 #endif /* _GL_LOCALE_H */
779 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */
780