1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Substitute for and wrapper around <langinfo.h>.
3 Copyright (C) 2009-2015 Free Software Foundation, Inc.
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, or (at your option)
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.
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/>. */
19 * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
20 * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
23 #ifndef _GL_LANGINFO_H
26 #pragma GCC system_header
30 /* The include_next requires a split double-inclusion guard. */
32 # include_next <langinfo.h>
35 #ifndef _GL_LANGINFO_H
36 #define _GL_LANGINFO_H
41 /* A platform that lacks <langinfo.h>. */
43 /* Assume that it also lacks <nl_types.h> and the nl_item type. */
44 # if !GNULIB_defined_nl_item
46 # define GNULIB_defined_nl_item 1
49 /* nl_langinfo items of the LC_CTYPE category */
50 # define CODESET 10000
51 /* nl_langinfo items of the LC_NUMERIC category */
52 # define RADIXCHAR 10001
53 # define DECIMAL_POINT RADIXCHAR
54 # define THOUSEP 10002
55 # define THOUSANDS_SEP THOUSEP
56 # define GROUPING 10114
57 /* nl_langinfo items of the LC_TIME category */
58 # define D_T_FMT 10003
61 # define T_FMT_AMPM 10006
65 # define DAY_2 (DAY_1 + 1)
66 # define DAY_3 (DAY_1 + 2)
67 # define DAY_4 (DAY_1 + 3)
68 # define DAY_5 (DAY_1 + 4)
69 # define DAY_6 (DAY_1 + 5)
70 # define DAY_7 (DAY_1 + 6)
71 # define ABDAY_1 10016
72 # define ABDAY_2 (ABDAY_1 + 1)
73 # define ABDAY_3 (ABDAY_1 + 2)
74 # define ABDAY_4 (ABDAY_1 + 3)
75 # define ABDAY_5 (ABDAY_1 + 4)
76 # define ABDAY_6 (ABDAY_1 + 5)
77 # define ABDAY_7 (ABDAY_1 + 6)
79 # define MON_2 (MON_1 + 1)
80 # define MON_3 (MON_1 + 2)
81 # define MON_4 (MON_1 + 3)
82 # define MON_5 (MON_1 + 4)
83 # define MON_6 (MON_1 + 5)
84 # define MON_7 (MON_1 + 6)
85 # define MON_8 (MON_1 + 7)
86 # define MON_9 (MON_1 + 8)
87 # define MON_10 (MON_1 + 9)
88 # define MON_11 (MON_1 + 10)
89 # define MON_12 (MON_1 + 11)
90 # define ABMON_1 10035
91 # define ABMON_2 (ABMON_1 + 1)
92 # define ABMON_3 (ABMON_1 + 2)
93 # define ABMON_4 (ABMON_1 + 3)
94 # define ABMON_5 (ABMON_1 + 4)
95 # define ABMON_6 (ABMON_1 + 5)
96 # define ABMON_7 (ABMON_1 + 6)
97 # define ABMON_8 (ABMON_1 + 7)
98 # define ABMON_9 (ABMON_1 + 8)
99 # define ABMON_10 (ABMON_1 + 9)
100 # define ABMON_11 (ABMON_1 + 10)
101 # define ABMON_12 (ABMON_1 + 11)
103 # define ERA_D_FMT 10048
104 # define ERA_D_T_FMT 10049
105 # define ERA_T_FMT 10050
106 # define ALT_DIGITS 10051
107 /* nl_langinfo items of the LC_MONETARY category */
108 # define CRNCYSTR 10052
109 # define CURRENCY_SYMBOL CRNCYSTR
110 # define INT_CURR_SYMBOL 10100
111 # define MON_DECIMAL_POINT 10101
112 # define MON_THOUSANDS_SEP 10102
113 # define MON_GROUPING 10103
114 # define POSITIVE_SIGN 10104
115 # define NEGATIVE_SIGN 10105
116 # define FRAC_DIGITS 10106
117 # define INT_FRAC_DIGITS 10107
118 # define P_CS_PRECEDES 10108
119 # define N_CS_PRECEDES 10109
120 # define P_SEP_BY_SPACE 10110
121 # define N_SEP_BY_SPACE 10111
122 # define P_SIGN_POSN 10112
123 # define N_SIGN_POSN 10113
124 /* nl_langinfo items of the LC_MESSAGES category */
125 # define YESEXPR 10053
126 # define NOEXPR 10054
130 /* A platform that has <langinfo.h>. */
133 # define CODESET 10000
134 # define GNULIB_defined_CODESET 1
138 # define T_FMT_AMPM 10006
139 # define GNULIB_defined_T_FMT_AMPM 1
144 # define ERA_D_FMT 10048
145 # define ERA_D_T_FMT 10049
146 # define ERA_T_FMT 10050
147 # define ALT_DIGITS 10051
148 # define GNULIB_defined_ERA 1
152 # define YESEXPR 10053
153 # define NOEXPR 10054
154 # define GNULIB_defined_YESEXPR 1
159 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
160 #ifndef _GL_CXXDEFS_H
161 #define _GL_CXXDEFS_H
163 /* The three most frequent use cases of these macros are:
165 * For providing a substitute for a function that is missing on some
166 platforms, but is declared and works fine on the platforms on which
171 _GL_FUNCDECL_SYS (foo, ...);
173 _GL_CXXALIAS_SYS (foo, ...);
174 _GL_CXXALIASWARN (foo);
175 #elif defined GNULIB_POSIXCHECK
179 * For providing a replacement for a function that exists on all platforms,
180 but is broken/insufficient and needs to be replaced on some platforms:
184 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 _GL_FUNCDECL_RPL (foo, ...);
189 _GL_CXXALIAS_RPL (foo, ...);
191 _GL_CXXALIAS_SYS (foo, ...);
193 _GL_CXXALIASWARN (foo);
194 #elif defined GNULIB_POSIXCHECK
198 * For providing a replacement for a function that exists on some platforms
199 but is broken/insufficient and needs to be replaced on some of them and
200 is additionally either missing or undeclared on some other platforms:
204 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
208 _GL_FUNCDECL_RPL (foo, ...);
209 _GL_CXXALIAS_RPL (foo, ...);
211 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
212 _GL_FUNCDECL_SYS (foo, ...);
214 _GL_CXXALIAS_SYS (foo, ...);
216 _GL_CXXALIASWARN (foo);
217 #elif defined GNULIB_POSIXCHECK
222 /* _GL_EXTERN_C declaration;
223 performs the declaration with C linkage. */
224 #if defined __cplusplus
225 # define _GL_EXTERN_C extern "C"
227 # define _GL_EXTERN_C extern
230 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
231 declares a replacement function, named rpl_func, with the given prototype,
232 consisting of return type, parameters, and attributes.
234 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
235 _GL_ARG_NONNULL ((1)));
237 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
238 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
239 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
240 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
242 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
243 declares the system function, named func, with the given prototype,
244 consisting of return type, parameters, and attributes.
246 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
247 _GL_ARG_NONNULL ((1)));
249 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
250 _GL_EXTERN_C rettype func parameters_and_attributes
252 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
253 declares a C++ alias called GNULIB_NAMESPACE::func
254 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
256 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
258 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
259 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
260 #if defined __cplusplus && defined GNULIB_NAMESPACE
261 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
262 namespace GNULIB_NAMESPACE \
264 rettype (*const func) parameters = ::rpl_func; \
266 _GL_EXTERN_C int _gl_cxxalias_dummy
268 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
269 _GL_EXTERN_C int _gl_cxxalias_dummy
272 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
273 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
274 except that the C function rpl_func may have a slightly different
275 declaration. A cast is used to silence the "invalid conversion" error
276 that would otherwise occur. */
277 #if defined __cplusplus && defined GNULIB_NAMESPACE
278 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
279 namespace GNULIB_NAMESPACE \
281 rettype (*const func) parameters = \
282 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
284 _GL_EXTERN_C int _gl_cxxalias_dummy
286 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
287 _GL_EXTERN_C int _gl_cxxalias_dummy
290 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
291 declares a C++ alias called GNULIB_NAMESPACE::func
292 that redirects to the system provided function func, if GNULIB_NAMESPACE
295 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
297 #if defined __cplusplus && defined GNULIB_NAMESPACE
298 /* If we were to write
299 rettype (*const func) parameters = ::func;
300 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
301 better (remove an indirection through a 'static' pointer variable),
302 but then the _GL_CXXALIASWARN macro below would cause a warning not only
303 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
304 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
305 namespace GNULIB_NAMESPACE \
307 static rettype (*func) parameters = ::func; \
309 _GL_EXTERN_C int _gl_cxxalias_dummy
311 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
312 _GL_EXTERN_C int _gl_cxxalias_dummy
315 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
316 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
317 except that the C function func may have a slightly different declaration.
318 A cast is used to silence the "invalid conversion" error that would
320 #if defined __cplusplus && defined GNULIB_NAMESPACE
321 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
322 namespace GNULIB_NAMESPACE \
324 static rettype (*func) parameters = \
325 reinterpret_cast<rettype(*)parameters>(::func); \
327 _GL_EXTERN_C int _gl_cxxalias_dummy
329 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
330 _GL_EXTERN_C int _gl_cxxalias_dummy
333 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
334 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
335 except that the C function is picked among a set of overloaded functions,
336 namely the one with rettype2 and parameters2. Two consecutive casts
337 are used to silence the "cannot find a match" and "invalid conversion"
338 errors that would otherwise occur. */
339 #if defined __cplusplus && defined GNULIB_NAMESPACE
340 /* The outer cast must be a reinterpret_cast.
341 The inner cast: When the function is defined as a set of overloaded
342 functions, it works as a static_cast<>, choosing the designated variant.
343 When the function is defined as a single variant, it works as a
344 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
345 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
346 namespace GNULIB_NAMESPACE \
348 static rettype (*func) parameters = \
349 reinterpret_cast<rettype(*)parameters>( \
350 (rettype2(*)parameters2)(::func)); \
352 _GL_EXTERN_C int _gl_cxxalias_dummy
354 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
355 _GL_EXTERN_C int _gl_cxxalias_dummy
358 /* _GL_CXXALIASWARN (func);
359 causes a warning to be emitted when ::func is used but not when
360 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
362 #if defined __cplusplus && defined GNULIB_NAMESPACE
363 # define _GL_CXXALIASWARN(func) \
364 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
365 # define _GL_CXXALIASWARN_1(func,namespace) \
366 _GL_CXXALIASWARN_2 (func, namespace)
367 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
368 we enable the warning only when not optimizing. */
370 # define _GL_CXXALIASWARN_2(func,namespace) \
371 _GL_WARN_ON_USE (func, \
372 "The symbol ::" #func " refers to the system function. " \
373 "Use " #namespace "::" #func " instead.")
374 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
375 # define _GL_CXXALIASWARN_2(func,namespace) \
376 extern __typeof__ (func) func
378 # define _GL_CXXALIASWARN_2(func,namespace) \
379 _GL_EXTERN_C int _gl_cxxalias_dummy
382 # define _GL_CXXALIASWARN(func) \
383 _GL_EXTERN_C int _gl_cxxalias_dummy
386 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
387 causes a warning to be emitted when the given overloaded variant of ::func
388 is used but not when GNULIB_NAMESPACE::func is used. */
389 #if defined __cplusplus && defined GNULIB_NAMESPACE
390 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
391 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
393 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
394 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
395 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
396 we enable the warning only when not optimizing. */
398 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
399 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
400 "The symbol ::" #func " refers to the system function. " \
401 "Use " #namespace "::" #func " instead.")
402 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
403 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
404 extern __typeof__ (func) func
406 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
407 _GL_EXTERN_C int _gl_cxxalias_dummy
410 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
411 _GL_EXTERN_C int _gl_cxxalias_dummy
414 #endif /* _GL_CXXDEFS_H */
416 /* The definition of _GL_WARN_ON_USE is copied here. */
417 #ifndef _GL_WARN_ON_USE
419 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
420 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
421 # define _GL_WARN_ON_USE(function, message) \
422 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
423 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
424 /* Verify the existence of the function. */
425 # define _GL_WARN_ON_USE(function, message) \
426 extern __typeof__ (function) function
427 # else /* Unsupported. */
428 # define _GL_WARN_ON_USE(function, message) \
429 _GL_WARN_EXTERN_C int _gl_warn_on_use
433 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
434 is like _GL_WARN_ON_USE (function, "string"), except that the function is
435 declared with the given prototype, consisting of return type, parameters,
437 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
438 not work in this case. */
439 #ifndef _GL_WARN_ON_USE_CXX
440 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
441 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
442 extern rettype function parameters_and_attributes \
443 __attribute__ ((__warning__ (msg)))
444 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
445 /* Verify the existence of the function. */
446 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
447 extern rettype function parameters_and_attributes
448 # else /* Unsupported. */
449 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
450 _GL_WARN_EXTERN_C int _gl_warn_on_use
454 /* _GL_WARN_EXTERN_C declaration;
455 performs the declaration with C linkage. */
456 #ifndef _GL_WARN_EXTERN_C
457 # if defined __cplusplus
458 # define _GL_WARN_EXTERN_C extern "C"
460 # define _GL_WARN_EXTERN_C extern
464 /* Declare overridden functions. */
467 /* Return a piece of locale dependent information.
468 Note: The difference between nl_langinfo (CODESET) and locale_charset ()
469 is that the latter normalizes the encoding names to GNU conventions. */
473 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
475 # define nl_langinfo rpl_nl_langinfo
477 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
478 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
481 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
483 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
485 _GL_CXXALIASWARN (nl_langinfo);
486 #elif defined GNULIB_POSIXCHECK
488 # if HAVE_RAW_DECL_NL_LANGINFO
489 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
490 "use gnulib module nl_langinfo for portability");
495 #endif /* _GL_LANGINFO_H */
496 #endif /* _GL_LANGINFO_H */