Merge branch 'vendor/BMAKE'
[dragonfly.git] / gnu / usr.bin / grep / libgreputils / locale.h
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* A POSIX <locale.h>.
3    Copyright (C) 2007-2015 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 <http://www.gnu.org/licenses/>.  */
17
18 #if __GNUC__ >= 3
19 #pragma GCC system_header
20 #endif
21
22
23 #ifdef _GL_ALREADY_INCLUDING_LOCALE_H
24
25 /* Special invocation conventions to handle Solaris header files
26    (through Solaris 10) when combined with gettext's libintl.h.  */
27
28 #include_next <locale.h>
29
30 #else
31 /* Normal invocation convention.  */
32
33 #ifndef _GL_LOCALE_H
34
35 #define _GL_ALREADY_INCLUDING_LOCALE_H
36
37 /* The include_next requires a split double-inclusion guard.  */
38 #include_next <locale.h>
39
40 #undef _GL_ALREADY_INCLUDING_LOCALE_H
41
42 #ifndef _GL_LOCALE_H
43 #define _GL_LOCALE_H
44
45 /* NetBSD 5.0 mis-defines NULL.  */
46 #include <stddef.h>
47
48 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>.  */
49 #ifndef BOOTSTRAPPING
50 # include <xlocale.h>
51 #endif
52
53 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
54 #ifndef _GL_CXXDEFS_H
55 #define _GL_CXXDEFS_H
56
57 /* The three most frequent use cases of these macros are:
58
59    * For providing a substitute for a function that is missing on some
60      platforms, but is declared and works fine on the platforms on which
61      it exists:
62
63        #if @GNULIB_FOO@
64        # if !@HAVE_FOO@
65        _GL_FUNCDECL_SYS (foo, ...);
66        # endif
67        _GL_CXXALIAS_SYS (foo, ...);
68        _GL_CXXALIASWARN (foo);
69        #elif defined GNULIB_POSIXCHECK
70        ...
71        #endif
72
73    * For providing a replacement for a function that exists on all platforms,
74      but is broken/insufficient and needs to be replaced on some platforms:
75
76        #if @GNULIB_FOO@
77        # if @REPLACE_FOO@
78        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
79        #   undef foo
80        #   define foo rpl_foo
81        #  endif
82        _GL_FUNCDECL_RPL (foo, ...);
83        _GL_CXXALIAS_RPL (foo, ...);
84        # else
85        _GL_CXXALIAS_SYS (foo, ...);
86        # endif
87        _GL_CXXALIASWARN (foo);
88        #elif defined GNULIB_POSIXCHECK
89        ...
90        #endif
91
92    * For providing a replacement for a function that exists on some platforms
93      but is broken/insufficient and needs to be replaced on some of them and
94      is additionally either missing or undeclared on some other platforms:
95
96        #if @GNULIB_FOO@
97        # if @REPLACE_FOO@
98        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
99        #   undef foo
100        #   define foo rpl_foo
101        #  endif
102        _GL_FUNCDECL_RPL (foo, ...);
103        _GL_CXXALIAS_RPL (foo, ...);
104        # else
105        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
106        _GL_FUNCDECL_SYS (foo, ...);
107        #  endif
108        _GL_CXXALIAS_SYS (foo, ...);
109        # endif
110        _GL_CXXALIASWARN (foo);
111        #elif defined GNULIB_POSIXCHECK
112        ...
113        #endif
114 */
115
116 /* _GL_EXTERN_C declaration;
117    performs the declaration with C linkage.  */
118 #if defined __cplusplus
119 # define _GL_EXTERN_C extern "C"
120 #else
121 # define _GL_EXTERN_C extern
122 #endif
123
124 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
125    declares a replacement function, named rpl_func, with the given prototype,
126    consisting of return type, parameters, and attributes.
127    Example:
128      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
129                                   _GL_ARG_NONNULL ((1)));
130  */
131 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
132   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
133 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
134   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
135
136 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
137    declares the system function, named func, with the given prototype,
138    consisting of return type, parameters, and attributes.
139    Example:
140      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
141                                   _GL_ARG_NONNULL ((1)));
142  */
143 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
144   _GL_EXTERN_C rettype func parameters_and_attributes
145
146 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
147    declares a C++ alias called GNULIB_NAMESPACE::func
148    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
149    Example:
150      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
151  */
152 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
153   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
154 #if defined __cplusplus && defined GNULIB_NAMESPACE
155 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
156     namespace GNULIB_NAMESPACE                                \
157     {                                                         \
158       rettype (*const func) parameters = ::rpl_func;          \
159     }                                                         \
160     _GL_EXTERN_C int _gl_cxxalias_dummy
161 #else
162 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
163     _GL_EXTERN_C int _gl_cxxalias_dummy
164 #endif
165
166 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
167    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
168    except that the C function rpl_func may have a slightly different
169    declaration.  A cast is used to silence the "invalid conversion" error
170    that would otherwise occur.  */
171 #if defined __cplusplus && defined GNULIB_NAMESPACE
172 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
173     namespace GNULIB_NAMESPACE                                     \
174     {                                                              \
175       rettype (*const func) parameters =                           \
176         reinterpret_cast<rettype(*)parameters>(::rpl_func);        \
177     }                                                              \
178     _GL_EXTERN_C int _gl_cxxalias_dummy
179 #else
180 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
181     _GL_EXTERN_C int _gl_cxxalias_dummy
182 #endif
183
184 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
185    declares a C++ alias called GNULIB_NAMESPACE::func
186    that redirects to the system provided function func, if GNULIB_NAMESPACE
187    is defined.
188    Example:
189      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
190  */
191 #if defined __cplusplus && defined GNULIB_NAMESPACE
192   /* If we were to write
193        rettype (*const func) parameters = ::func;
194      like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
195      better (remove an indirection through a 'static' pointer variable),
196      but then the _GL_CXXALIASWARN macro below would cause a warning not only
197      for uses of ::func but also for uses of GNULIB_NAMESPACE::func.  */
198 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
199     namespace GNULIB_NAMESPACE                     \
200     {                                              \
201       static rettype (*func) parameters = ::func;  \
202     }                                              \
203     _GL_EXTERN_C int _gl_cxxalias_dummy
204 #else
205 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
206     _GL_EXTERN_C int _gl_cxxalias_dummy
207 #endif
208
209 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
210    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
211    except that the C function func may have a slightly different declaration.
212    A cast is used to silence the "invalid conversion" error that would
213    otherwise occur.  */
214 #if defined __cplusplus && defined GNULIB_NAMESPACE
215 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
216     namespace GNULIB_NAMESPACE                          \
217     {                                                   \
218       static rettype (*func) parameters =               \
219         reinterpret_cast<rettype(*)parameters>(::func); \
220     }                                                   \
221     _GL_EXTERN_C int _gl_cxxalias_dummy
222 #else
223 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
224     _GL_EXTERN_C int _gl_cxxalias_dummy
225 #endif
226
227 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
228    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
229    except that the C function is picked among a set of overloaded functions,
230    namely the one with rettype2 and parameters2.  Two consecutive casts
231    are used to silence the "cannot find a match" and "invalid conversion"
232    errors that would otherwise occur.  */
233 #if defined __cplusplus && defined GNULIB_NAMESPACE
234   /* The outer cast must be a reinterpret_cast.
235      The inner cast: When the function is defined as a set of overloaded
236      functions, it works as a static_cast<>, choosing the designated variant.
237      When the function is defined as a single variant, it works as a
238      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
239 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
240     namespace GNULIB_NAMESPACE                                                \
241     {                                                                         \
242       static rettype (*func) parameters =                                     \
243         reinterpret_cast<rettype(*)parameters>(                               \
244           (rettype2(*)parameters2)(::func));                                  \
245     }                                                                         \
246     _GL_EXTERN_C int _gl_cxxalias_dummy
247 #else
248 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
249     _GL_EXTERN_C int _gl_cxxalias_dummy
250 #endif
251
252 /* _GL_CXXALIASWARN (func);
253    causes a warning to be emitted when ::func is used but not when
254    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
255    variants.  */
256 #if defined __cplusplus && defined GNULIB_NAMESPACE
257 # define _GL_CXXALIASWARN(func) \
258    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
259 # define _GL_CXXALIASWARN_1(func,namespace) \
260    _GL_CXXALIASWARN_2 (func, namespace)
261 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
262    we enable the warning only when not optimizing.  */
263 # if !__OPTIMIZE__
264 #  define _GL_CXXALIASWARN_2(func,namespace) \
265     _GL_WARN_ON_USE (func, \
266                      "The symbol ::" #func " refers to the system function. " \
267                      "Use " #namespace "::" #func " instead.")
268 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
269 #  define _GL_CXXALIASWARN_2(func,namespace) \
270      extern __typeof__ (func) func
271 # else
272 #  define _GL_CXXALIASWARN_2(func,namespace) \
273      _GL_EXTERN_C int _gl_cxxalias_dummy
274 # endif
275 #else
276 # define _GL_CXXALIASWARN(func) \
277     _GL_EXTERN_C int _gl_cxxalias_dummy
278 #endif
279
280 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
281    causes a warning to be emitted when the given overloaded variant of ::func
282    is used but not when GNULIB_NAMESPACE::func is used.  */
283 #if defined __cplusplus && defined GNULIB_NAMESPACE
284 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
285    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
286                         GNULIB_NAMESPACE)
287 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
288    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
289 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
290    we enable the warning only when not optimizing.  */
291 # if !__OPTIMIZE__
292 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
293     _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
294                          "The symbol ::" #func " refers to the system function. " \
295                          "Use " #namespace "::" #func " instead.")
296 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
297 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
298      extern __typeof__ (func) func
299 # else
300 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
301      _GL_EXTERN_C int _gl_cxxalias_dummy
302 # endif
303 #else
304 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
305     _GL_EXTERN_C int _gl_cxxalias_dummy
306 #endif
307
308 #endif /* _GL_CXXDEFS_H */
309
310 /* The definition of _GL_ARG_NONNULL is copied here.  */
311 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
312    that the values passed as arguments n, ..., m must be non-NULL pointers.
313    n = 1 stands for the first argument, n = 2 for the second argument etc.  */
314 #ifndef _GL_ARG_NONNULL
315 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
316 #  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
317 # else
318 #  define _GL_ARG_NONNULL(params)
319 # endif
320 #endif
321
322 /* The definition of _GL_WARN_ON_USE is copied here.  */
323 #ifndef _GL_WARN_ON_USE
324
325 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
326 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
327 #  define _GL_WARN_ON_USE(function, message) \
328 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
329 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
330 /* Verify the existence of the function.  */
331 #  define _GL_WARN_ON_USE(function, message) \
332 extern __typeof__ (function) function
333 # else /* Unsupported.  */
334 #  define _GL_WARN_ON_USE(function, message) \
335 _GL_WARN_EXTERN_C int _gl_warn_on_use
336 # endif
337 #endif
338
339 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
340    is like _GL_WARN_ON_USE (function, "string"), except that the function is
341    declared with the given prototype, consisting of return type, parameters,
342    and attributes.
343    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
344    not work in this case.  */
345 #ifndef _GL_WARN_ON_USE_CXX
346 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
347 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
348 extern rettype function parameters_and_attributes \
349      __attribute__ ((__warning__ (msg)))
350 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
351 /* Verify the existence of the function.  */
352 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
353 extern rettype function parameters_and_attributes
354 # else /* Unsupported.  */
355 #  define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
356 _GL_WARN_EXTERN_C int _gl_warn_on_use
357 # endif
358 #endif
359
360 /* _GL_WARN_EXTERN_C declaration;
361    performs the declaration with C linkage.  */
362 #ifndef _GL_WARN_EXTERN_C
363 # if defined __cplusplus
364 #  define _GL_WARN_EXTERN_C extern "C"
365 # else
366 #  define _GL_WARN_EXTERN_C extern
367 # endif
368 #endif
369
370 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
371    On systems that don't define it, use the same value as GNU libintl.  */
372 #if !defined LC_MESSAGES
373 # define LC_MESSAGES 1729
374 #endif
375
376 /* Bionic libc's 'struct lconv' is just a dummy.  */
377 #if 0
378 # define lconv rpl_lconv
379 struct lconv
380 {
381   /* All 'char *' are actually 'const char *'.  */
382
383   /* Members that depend on the LC_NUMERIC category of the locale.  See
384      <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
385
386   /* Symbol used as decimal point.  */
387   char *decimal_point;
388   /* Symbol used to separate groups of digits to the left of the decimal
389      point.  */
390   char *thousands_sep;
391   /* Definition of the size of groups of digits to the left of the decimal
392      point.  */
393   char *grouping;
394
395   /* Members that depend on the LC_MONETARY category of the locale.  See
396      <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
397
398   /* Symbol used as decimal point.  */
399   char *mon_decimal_point;
400   /* Symbol used to separate groups of digits to the left of the decimal
401      point.  */
402   char *mon_thousands_sep;
403   /* Definition of the size of groups of digits to the left of the decimal
404      point.  */
405   char *mon_grouping;
406   /* Sign used to indicate a value >= 0.  */
407   char *positive_sign;
408   /* Sign used to indicate a value < 0.  */
409   char *negative_sign;
410
411   /* For formatting local currency.  */
412   /* Currency symbol (3 characters) followed by separator (1 character).  */
413   char *currency_symbol;
414   /* Number of digits after the decimal point.  */
415   char frac_digits;
416   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
417      comes after the number.  */
418   char p_cs_precedes;
419   /* For values >= 0: Position of the sign.  */
420   char p_sign_posn;
421   /* For values >= 0: Placement of spaces between currency symbol, sign, and
422      number.  */
423   char p_sep_by_space;
424   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
425      comes after the number.  */
426   char n_cs_precedes;
427   /* For values < 0: Position of the sign.  */
428   char n_sign_posn;
429   /* For values < 0: Placement of spaces between currency symbol, sign, and
430      number.  */
431   char n_sep_by_space;
432
433   /* For formatting international currency.  */
434   /* Currency symbol (3 characters) followed by separator (1 character).  */
435   char *int_curr_symbol;
436   /* Number of digits after the decimal point.  */
437   char int_frac_digits;
438   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
439      comes after the number.  */
440   char int_p_cs_precedes;
441   /* For values >= 0: Position of the sign.  */
442   char int_p_sign_posn;
443   /* For values >= 0: Placement of spaces between currency symbol, sign, and
444      number.  */
445   char int_p_sep_by_space;
446   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
447      comes after the number.  */
448   char int_n_cs_precedes;
449   /* For values < 0: Position of the sign.  */
450   char int_n_sign_posn;
451   /* For values < 0: Placement of spaces between currency symbol, sign, and
452      number.  */
453   char int_n_sep_by_space;
454 };
455 #endif
456
457 #if 1
458 # if 0
459 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
460 #   undef localeconv
461 #   define localeconv rpl_localeconv
462 #  endif
463 _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
464 _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
465 # else
466 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
467 # endif
468 _GL_CXXALIASWARN (localeconv);
469 #elif 0
470 # undef localeconv
471 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
472 #elif defined GNULIB_POSIXCHECK
473 # undef localeconv
474 # if HAVE_RAW_DECL_LOCALECONV
475 _GL_WARN_ON_USE (localeconv,
476                  "localeconv returns too few information on some platforms - "
477                  "use gnulib module localeconv for portability");
478 # endif
479 #endif
480
481 #if IN_GREP_GNULIB_TESTS
482 # if 0
483 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
484 #   undef setlocale
485 #   define setlocale rpl_setlocale
486 #   define GNULIB_defined_setlocale 1
487 #  endif
488 _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
489 _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
490 # else
491 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
492 # endif
493 _GL_CXXALIASWARN (setlocale);
494 #elif defined GNULIB_POSIXCHECK
495 # undef setlocale
496 # if HAVE_RAW_DECL_SETLOCALE
497 _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
498                  "use gnulib module setlocale for portability");
499 # endif
500 #endif
501
502 #if 0
503 # if 0
504 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
505 #   undef duplocale
506 #   define duplocale rpl_duplocale
507 #  endif
508 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
509 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
510 # else
511 #  if 1
512 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
513 #  endif
514 # endif
515 # if 1
516 _GL_CXXALIASWARN (duplocale);
517 # endif
518 #elif defined GNULIB_POSIXCHECK
519 # undef duplocale
520 # if HAVE_RAW_DECL_DUPLOCALE
521 _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
522                  "use gnulib module duplocale for portability");
523 # endif
524 #endif
525
526 #endif /* _GL_LOCALE_H */
527 #endif /* ! _GL_ALREADY_INCLUDING_LOCALE_H */
528 #endif /* _GL_LOCALE_H */