xref: /Universal-ctags/win32/gnulib_h/langinfo.h (revision a5d10cd40cb5f3b4d2ab78aaa53944366ab48532)
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Substitute for and wrapper around <langinfo.h>.
3    Copyright (C) 2009-2021 Free Software Foundation, Inc.
4 
5    This file is free software: you can redistribute it and/or modify
6    it under the terms of the GNU Lesser General Public License as
7    published by the Free Software Foundation; either version 2.1 of the
8    License, or (at your option) any later version.
9 
10    This file 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 Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 /*
19  * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
20  * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
21  */
22 
23 #ifndef _GL_LANGINFO_H
24 
25 #if __GNUC__ >= 3
26 #pragma GCC system_header
27 #endif
28 
29 
30 /* The include_next requires a split double-inclusion guard.  */
31 #if 0
32 # include_next <langinfo.h>
33 #endif
34 
35 #ifndef _GL_LANGINFO_H
36 #define _GL_LANGINFO_H
37 
38 
39 #if !0
40 
41 /* A platform that lacks <langinfo.h>.  */
42 
43 /* Assume that it also lacks <nl_types.h> and the nl_item type.  */
44 # if !GNULIB_defined_nl_item
45 typedef int nl_item;
46 #  define GNULIB_defined_nl_item 1
47 # endif
48 
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
59 # define D_FMT       10004
60 # define T_FMT       10005
61 # define T_FMT_AMPM  10006
62 # define AM_STR      10007
63 # define PM_STR      10008
64 # define DAY_1       10009
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)
78 # define MON_1       10023
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 ALTMON_1    10200
91 # define ALTMON_2    (ALTMON_1 + 1)
92 # define ALTMON_3    (ALTMON_1 + 2)
93 # define ALTMON_4    (ALTMON_1 + 3)
94 # define ALTMON_5    (ALTMON_1 + 4)
95 # define ALTMON_6    (ALTMON_1 + 5)
96 # define ALTMON_7    (ALTMON_1 + 6)
97 # define ALTMON_8    (ALTMON_1 + 7)
98 # define ALTMON_9    (ALTMON_1 + 8)
99 # define ALTMON_10   (ALTMON_1 + 9)
100 # define ALTMON_11   (ALTMON_1 + 10)
101 # define ALTMON_12   (ALTMON_1 + 11)
102 # define ABMON_1     10035
103 # define ABMON_2     (ABMON_1 + 1)
104 # define ABMON_3     (ABMON_1 + 2)
105 # define ABMON_4     (ABMON_1 + 3)
106 # define ABMON_5     (ABMON_1 + 4)
107 # define ABMON_6     (ABMON_1 + 5)
108 # define ABMON_7     (ABMON_1 + 6)
109 # define ABMON_8     (ABMON_1 + 7)
110 # define ABMON_9     (ABMON_1 + 8)
111 # define ABMON_10    (ABMON_1 + 9)
112 # define ABMON_11    (ABMON_1 + 10)
113 # define ABMON_12    (ABMON_1 + 11)
114 # define ERA         10047
115 # define ERA_D_FMT   10048
116 # define ERA_D_T_FMT 10049
117 # define ERA_T_FMT   10050
118 # define ALT_DIGITS  10051
119 /* nl_langinfo items of the LC_MONETARY category */
120 # define CRNCYSTR    10052
121 # define CURRENCY_SYMBOL   CRNCYSTR
122 # define INT_CURR_SYMBOL   10100
123 # define MON_DECIMAL_POINT 10101
124 # define MON_THOUSANDS_SEP 10102
125 # define MON_GROUPING      10103
126 # define POSITIVE_SIGN     10104
127 # define NEGATIVE_SIGN     10105
128 # define FRAC_DIGITS       10106
129 # define INT_FRAC_DIGITS   10107
130 # define P_CS_PRECEDES     10108
131 # define N_CS_PRECEDES     10109
132 # define P_SEP_BY_SPACE    10110
133 # define N_SEP_BY_SPACE    10111
134 # define P_SIGN_POSN       10112
135 # define N_SIGN_POSN       10113
136 /* nl_langinfo items of the LC_MESSAGES category */
137 # define YESEXPR     10053
138 # define NOEXPR      10054
139 
140 #else
141 
142 /* A platform that has <langinfo.h>.  */
143 
144 # if !0
145 #  define CODESET     10000
146 #  define GNULIB_defined_CODESET 1
147 # endif
148 
149 # if !0
150 #  define T_FMT_AMPM  10006
151 #  define GNULIB_defined_T_FMT_AMPM 1
152 # endif
153 
154 # if !0
155 #  define ALTMON_1    10200
156 #  define ALTMON_2    (ALTMON_1 + 1)
157 #  define ALTMON_3    (ALTMON_1 + 2)
158 #  define ALTMON_4    (ALTMON_1 + 3)
159 #  define ALTMON_5    (ALTMON_1 + 4)
160 #  define ALTMON_6    (ALTMON_1 + 5)
161 #  define ALTMON_7    (ALTMON_1 + 6)
162 #  define ALTMON_8    (ALTMON_1 + 7)
163 #  define ALTMON_9    (ALTMON_1 + 8)
164 #  define ALTMON_10   (ALTMON_1 + 9)
165 #  define ALTMON_11   (ALTMON_1 + 10)
166 #  define ALTMON_12   (ALTMON_1 + 11)
167 #  define GNULIB_defined_ALTMON 1
168 # endif
169 
170 # if !0
171 #  define ERA         10047
172 #  define ERA_D_FMT   10048
173 #  define ERA_D_T_FMT 10049
174 #  define ERA_T_FMT   10050
175 #  define ALT_DIGITS  10051
176 #  define GNULIB_defined_ERA 1
177 # endif
178 
179 # if !0
180 #  define YESEXPR     10053
181 #  define NOEXPR      10054
182 #  define GNULIB_defined_YESEXPR 1
183 # endif
184 
185 #endif
186 
187 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
188 /* C++ compatible function declaration macros.
189    Copyright (C) 2010-2021 Free Software Foundation, Inc.
190 
191    This program is free software: you can redistribute it and/or modify it
192    under the terms of the GNU Lesser General Public License as published
193    by the Free Software Foundation; either version 2 of the License, or
194    (at your option) any later version.
195 
196    This program is distributed in the hope that it will be useful,
197    but WITHOUT ANY WARRANTY; without even the implied warranty of
198    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
199    Lesser General Public License for more details.
200 
201    You should have received a copy of the GNU Lesser General Public License
202    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
203 
204 #ifndef _GL_CXXDEFS_H
205 #define _GL_CXXDEFS_H
206 
207 /* Begin/end the GNULIB_NAMESPACE namespace.  */
208 #if defined __cplusplus && defined GNULIB_NAMESPACE
209 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE {
210 # define _GL_END_NAMESPACE }
211 #else
212 # define _GL_BEGIN_NAMESPACE
213 # define _GL_END_NAMESPACE
214 #endif
215 
216 /* The three most frequent use cases of these macros are:
217 
218    * For providing a substitute for a function that is missing on some
219      platforms, but is declared and works fine on the platforms on which
220      it exists:
221 
222        #if @GNULIB_FOO@
223        # if !@HAVE_FOO@
224        _GL_FUNCDECL_SYS (foo, ...);
225        # endif
226        _GL_CXXALIAS_SYS (foo, ...);
227        _GL_CXXALIASWARN (foo);
228        #elif defined GNULIB_POSIXCHECK
229        ...
230        #endif
231 
232    * For providing a replacement for a function that exists on all platforms,
233      but is broken/insufficient and needs to be replaced on some platforms:
234 
235        #if @GNULIB_FOO@
236        # if @REPLACE_FOO@
237        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
238        #   undef foo
239        #   define foo rpl_foo
240        #  endif
241        _GL_FUNCDECL_RPL (foo, ...);
242        _GL_CXXALIAS_RPL (foo, ...);
243        # else
244        _GL_CXXALIAS_SYS (foo, ...);
245        # endif
246        _GL_CXXALIASWARN (foo);
247        #elif defined GNULIB_POSIXCHECK
248        ...
249        #endif
250 
251    * For providing a replacement for a function that exists on some platforms
252      but is broken/insufficient and needs to be replaced on some of them and
253      is additionally either missing or undeclared on some other platforms:
254 
255        #if @GNULIB_FOO@
256        # if @REPLACE_FOO@
257        #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
258        #   undef foo
259        #   define foo rpl_foo
260        #  endif
261        _GL_FUNCDECL_RPL (foo, ...);
262        _GL_CXXALIAS_RPL (foo, ...);
263        # else
264        #  if !@HAVE_FOO@   or   if !@HAVE_DECL_FOO@
265        _GL_FUNCDECL_SYS (foo, ...);
266        #  endif
267        _GL_CXXALIAS_SYS (foo, ...);
268        # endif
269        _GL_CXXALIASWARN (foo);
270        #elif defined GNULIB_POSIXCHECK
271        ...
272        #endif
273 */
274 
275 /* _GL_EXTERN_C declaration;
276    performs the declaration with C linkage.  */
277 #if defined __cplusplus
278 # define _GL_EXTERN_C extern "C"
279 #else
280 # define _GL_EXTERN_C extern
281 #endif
282 
283 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
284    declares a replacement function, named rpl_func, with the given prototype,
285    consisting of return type, parameters, and attributes.
286    Example:
287      _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
288                                   _GL_ARG_NONNULL ((1)));
289  */
290 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
291   _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
292 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
293   _GL_EXTERN_C rettype rpl_func parameters_and_attributes
294 
295 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
296    declares the system function, named func, with the given prototype,
297    consisting of return type, parameters, and attributes.
298    Example:
299      _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
300                                   _GL_ARG_NONNULL ((1)));
301  */
302 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
303   _GL_EXTERN_C rettype func parameters_and_attributes
304 
305 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
306    declares a C++ alias called GNULIB_NAMESPACE::func
307    that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
308    Example:
309      _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
310 
311    Wrapping rpl_func in an object with an inline conversion operator
312    avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is
313    actually used in the program.  */
314 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
315   _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
316 #if defined __cplusplus && defined GNULIB_NAMESPACE
317 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
318     namespace GNULIB_NAMESPACE                                \
319     {                                                         \
320       static const struct _gl_ ## func ## _wrapper            \
321       {                                                       \
322         typedef rettype (*type) parameters;                   \
323                                                               \
324         inline operator type () const                         \
325         {                                                     \
326           return ::rpl_func;                                  \
327         }                                                     \
328       } func = {};                                            \
329     }                                                         \
330     _GL_EXTERN_C int _gl_cxxalias_dummy
331 #else
332 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
333     _GL_EXTERN_C int _gl_cxxalias_dummy
334 #endif
335 
336 /* _GL_CXXALIAS_MDA (func, rettype, parameters);
337    is to be used when func is a Microsoft deprecated alias, on native Windows.
338    It declares a C++ alias called GNULIB_NAMESPACE::func
339    that redirects to _func, if GNULIB_NAMESPACE is defined.
340    Example:
341      _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...));
342  */
343 #define _GL_CXXALIAS_MDA(func,rettype,parameters) \
344   _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters)
345 
346 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
347    is like  _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
348    except that the C function rpl_func may have a slightly different
349    declaration.  A cast is used to silence the "invalid conversion" error
350    that would otherwise occur.  */
351 #if defined __cplusplus && defined GNULIB_NAMESPACE
352 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
353     namespace GNULIB_NAMESPACE                                     \
354     {                                                              \
355       static const struct _gl_ ## func ## _wrapper                 \
356       {                                                            \
357         typedef rettype (*type) parameters;                        \
358                                                                    \
359         inline operator type () const                              \
360         {                                                          \
361           return reinterpret_cast<type>(::rpl_func);               \
362         }                                                          \
363       } func = {};                                                 \
364     }                                                              \
365     _GL_EXTERN_C int _gl_cxxalias_dummy
366 #else
367 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
368     _GL_EXTERN_C int _gl_cxxalias_dummy
369 #endif
370 
371 /* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters);
372    is like  _GL_CXXALIAS_MDA (func, rettype, parameters);
373    except that the C function func may have a slightly different declaration.
374    A cast is used to silence the "invalid conversion" error that would
375    otherwise occur.  */
376 #define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \
377   _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters)
378 
379 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
380    declares a C++ alias called GNULIB_NAMESPACE::func
381    that redirects to the system provided function func, if GNULIB_NAMESPACE
382    is defined.
383    Example:
384      _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
385 
386    Wrapping func in an object with an inline conversion operator
387    avoids a reference to func unless GNULIB_NAMESPACE::func is
388    actually used in the program.  */
389 #if defined __cplusplus && defined GNULIB_NAMESPACE
390 # define _GL_CXXALIAS_SYS(func,rettype,parameters)            \
391     namespace GNULIB_NAMESPACE                                \
392     {                                                         \
393       static const struct _gl_ ## func ## _wrapper            \
394       {                                                       \
395         typedef rettype (*type) parameters;                   \
396                                                               \
397         inline operator type () const                         \
398         {                                                     \
399           return ::func;                                      \
400         }                                                     \
401       } func = {};                                            \
402     }                                                         \
403     _GL_EXTERN_C int _gl_cxxalias_dummy
404 #else
405 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
406     _GL_EXTERN_C int _gl_cxxalias_dummy
407 #endif
408 
409 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
410    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
411    except that the C function func may have a slightly different declaration.
412    A cast is used to silence the "invalid conversion" error that would
413    otherwise occur.  */
414 #if defined __cplusplus && defined GNULIB_NAMESPACE
415 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
416     namespace GNULIB_NAMESPACE                          \
417     {                                                   \
418       static const struct _gl_ ## func ## _wrapper      \
419       {                                                 \
420         typedef rettype (*type) parameters;             \
421                                                         \
422         inline operator type () const                   \
423         {                                               \
424           return reinterpret_cast<type>(::func);        \
425         }                                               \
426       } func = {};                                      \
427     }                                                   \
428     _GL_EXTERN_C int _gl_cxxalias_dummy
429 #else
430 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
431     _GL_EXTERN_C int _gl_cxxalias_dummy
432 #endif
433 
434 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
435    is like  _GL_CXXALIAS_SYS (func, rettype, parameters);
436    except that the C function is picked among a set of overloaded functions,
437    namely the one with rettype2 and parameters2.  Two consecutive casts
438    are used to silence the "cannot find a match" and "invalid conversion"
439    errors that would otherwise occur.  */
440 #if defined __cplusplus && defined GNULIB_NAMESPACE
441   /* The outer cast must be a reinterpret_cast.
442      The inner cast: When the function is defined as a set of overloaded
443      functions, it works as a static_cast<>, choosing the designated variant.
444      When the function is defined as a single variant, it works as a
445      reinterpret_cast<>. The parenthesized cast syntax works both ways.  */
446 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
447     namespace GNULIB_NAMESPACE                                                \
448     {                                                                         \
449       static const struct _gl_ ## func ## _wrapper                            \
450       {                                                                       \
451         typedef rettype (*type) parameters;                                   \
452                                                                               \
453         inline operator type () const                                         \
454         {                                                                     \
455           return reinterpret_cast<type>((rettype2 (*) parameters2)(::func));  \
456         }                                                                     \
457       } func = {};                                                            \
458     }                                                                         \
459     _GL_EXTERN_C int _gl_cxxalias_dummy
460 #else
461 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
462     _GL_EXTERN_C int _gl_cxxalias_dummy
463 #endif
464 
465 /* _GL_CXXALIASWARN (func);
466    causes a warning to be emitted when ::func is used but not when
467    GNULIB_NAMESPACE::func is used.  func must be defined without overloaded
468    variants.  */
469 #if defined __cplusplus && defined GNULIB_NAMESPACE
470 # define _GL_CXXALIASWARN(func) \
471    _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
472 # define _GL_CXXALIASWARN_1(func,namespace) \
473    _GL_CXXALIASWARN_2 (func, namespace)
474 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
475    we enable the warning only when not optimizing.  */
476 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
477 #  define _GL_CXXALIASWARN_2(func,namespace) \
478     _GL_WARN_ON_USE (func, \
479                      "The symbol ::" #func " refers to the system function. " \
480                      "Use " #namespace "::" #func " instead.")
481 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
482 #  define _GL_CXXALIASWARN_2(func,namespace) \
483      extern __typeof__ (func) func
484 # else
485 #  define _GL_CXXALIASWARN_2(func,namespace) \
486      _GL_EXTERN_C int _gl_cxxalias_dummy
487 # endif
488 #else
489 # define _GL_CXXALIASWARN(func) \
490     _GL_EXTERN_C int _gl_cxxalias_dummy
491 #endif
492 
493 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
494    causes a warning to be emitted when the given overloaded variant of ::func
495    is used but not when GNULIB_NAMESPACE::func is used.  */
496 #if defined __cplusplus && defined GNULIB_NAMESPACE
497 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
498    _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
499                         GNULIB_NAMESPACE)
500 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
501    _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
502 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
503    we enable the warning only when not optimizing.  */
504 # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__)
505 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
506     _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \
507                          "The symbol ::" #func " refers to the system function. " \
508                          "Use " #namespace "::" #func " instead.")
509 # else
510 #  define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
511      _GL_EXTERN_C int _gl_cxxalias_dummy
512 # endif
513 #else
514 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
515     _GL_EXTERN_C int _gl_cxxalias_dummy
516 #endif
517 
518 #endif /* _GL_CXXDEFS_H */
519 
520 /* The definition of _GL_WARN_ON_USE is copied here.  */
521 /* A C macro for emitting warnings if a function is used.
522    Copyright (C) 2010-2021 Free Software Foundation, Inc.
523 
524    This program is free software: you can redistribute it and/or modify it
525    under the terms of the GNU Lesser General Public License as published
526    by the Free Software Foundation; either version 2 of the License, or
527    (at your option) any later version.
528 
529    This program is distributed in the hope that it will be useful,
530    but WITHOUT ANY WARRANTY; without even the implied warranty of
531    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
532    Lesser General Public License for more details.
533 
534    You should have received a copy of the GNU Lesser General Public License
535    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
536 
537 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration
538    for FUNCTION which will then trigger a compiler warning containing
539    the text of "literal string" anywhere that function is called, if
540    supported by the compiler.  If the compiler does not support this
541    feature, the macro expands to an unused extern declaration.
542 
543    _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the
544    attribute used in _GL_WARN_ON_USE.  If the compiler does not support
545    this feature, it expands to empty.
546 
547    These macros are useful for marking a function as a potential
548    portability trap, with the intent that "literal string" include
549    instructions on the replacement function that should be used
550    instead.
551    _GL_WARN_ON_USE is for functions with 'extern' linkage.
552    _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline'
553    linkage.
554 
555    However, one of the reasons that a function is a portability trap is
556    if it has the wrong signature.  Declaring FUNCTION with a different
557    signature in C is a compilation error, so this macro must use the
558    same type as any existing declaration so that programs that avoid
559    the problematic FUNCTION do not fail to compile merely because they
560    included a header that poisoned the function.  But this implies that
561    _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already
562    have a declaration.  Use of this macro implies that there must not
563    be any other macro hiding the declaration of FUNCTION; but
564    undefining FUNCTION first is part of the poisoning process anyway
565    (although for symbols that are provided only via a macro, the result
566    is a compilation error rather than a warning containing
567    "literal string").  Also note that in C++, it is only safe to use if
568    FUNCTION has no overloads.
569 
570    For an example, it is possible to poison 'getline' by:
571    - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
572      [getline]) in configure.ac, which potentially defines
573      HAVE_RAW_DECL_GETLINE
574    - adding this code to a header that wraps the system <stdio.h>:
575      #undef getline
576      #if HAVE_RAW_DECL_GETLINE
577      _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
578        "not universally present; use the gnulib module getline");
579      #endif
580 
581    It is not possible to directly poison global variables.  But it is
582    possible to write a wrapper accessor function, and poison that
583    (less common usage, like &environ, will cause a compilation error
584    rather than issue the nice warning, but the end result of informing
585    the developer about their portability problem is still achieved):
586      #if HAVE_RAW_DECL_ENVIRON
587      static char ***
588      rpl_environ (void) { return &environ; }
589      _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
590      # undef environ
591      # define environ (*rpl_environ ())
592      #endif
593    or better (avoiding contradictory use of 'static' and 'extern'):
594      #if HAVE_RAW_DECL_ENVIRON
595      static char ***
596      _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared")
597      rpl_environ (void) { return &environ; }
598      # undef environ
599      # define environ (*rpl_environ ())
600      #endif
601    */
602 #ifndef _GL_WARN_ON_USE
603 
604 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
605 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
606 #  define _GL_WARN_ON_USE(function, message) \
607 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
608 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
609   __attribute__ ((__warning__ (message)))
610 # elif __clang_major__ >= 4
611 /* Another compiler attribute is available in clang.  */
612 #  define _GL_WARN_ON_USE(function, message) \
613 extern __typeof__ (function) function \
614   __attribute__ ((__diagnose_if__ (1, message, "warning")))
615 #  define _GL_WARN_ON_USE_ATTRIBUTE(message) \
616   __attribute__ ((__diagnose_if__ (1, message, "warning")))
617 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
618 /* Verify the existence of the function.  */
619 #  define _GL_WARN_ON_USE(function, message) \
620 extern __typeof__ (function) function
621 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
622 # else /* Unsupported.  */
623 #  define _GL_WARN_ON_USE(function, message) \
624 _GL_WARN_EXTERN_C int _gl_warn_on_use
625 #  define _GL_WARN_ON_USE_ATTRIBUTE(message)
626 # endif
627 #endif
628 
629 /* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message")
630    is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the
631    function is declared with the given prototype, consisting of return type,
632    parameters, and attributes.
633    This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
634    not work in this case.  */
635 #ifndef _GL_WARN_ON_USE_CXX
636 # if !defined __cplusplus
637 #  define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
638      _GL_WARN_ON_USE (function, msg)
639 # else
640 #  if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
641 /* A compiler attribute is available in gcc versions 4.3.0 and later.  */
642 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
643 extern rettype_gcc function parameters_and_attributes \
644   __attribute__ ((__warning__ (msg)))
645 #  elif __clang_major__ >= 4
646 /* Another compiler attribute is available in clang.  */
647 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
648 extern rettype_clang function parameters_and_attributes \
649   __attribute__ ((__diagnose_if__ (1, msg, "warning")))
650 #  elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
651 /* Verify the existence of the function.  */
652 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
653 extern rettype_gcc function parameters_and_attributes
654 #  else /* Unsupported.  */
655 #   define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \
656 _GL_WARN_EXTERN_C int _gl_warn_on_use
657 #  endif
658 # endif
659 #endif
660 
661 /* _GL_WARN_EXTERN_C declaration;
662    performs the declaration with C linkage.  */
663 #ifndef _GL_WARN_EXTERN_C
664 # if defined __cplusplus
665 #  define _GL_WARN_EXTERN_C extern "C"
666 # else
667 #  define _GL_WARN_EXTERN_C extern
668 # endif
669 #endif
670 
671 /* Declare overridden functions.  */
672 
673 
674 /* Return a piece of locale dependent information.
675    Note: The difference between nl_langinfo (CODESET) and locale_charset ()
676    is that the latter normalizes the encoding names to GNU conventions.  */
677 
678 #if 1
679 # if 0
680 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
681 #   undef nl_langinfo
682 #   define nl_langinfo rpl_nl_langinfo
683 #  endif
684 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
685 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
686 # else
687 #  if !0
688 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
689 #  endif
690 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
691 # endif
692 _GL_CXXALIASWARN (nl_langinfo);
693 #elif defined GNULIB_POSIXCHECK
694 # undef nl_langinfo
695 # if HAVE_RAW_DECL_NL_LANGINFO
696 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
697                  "use gnulib module nl_langinfo for portability");
698 # endif
699 #endif
700 
701 
702 #endif /* _GL_LANGINFO_H */
703 #endif /* _GL_LANGINFO_H */
704