1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* Substitute for and wrapper around <langinfo.h>. 3 Copyright (C) 2009-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, or (at your option) 8 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 /* 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> 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 1 32 # include_next <langinfo.h> 33 #endif 34 35 #ifndef _GL_LANGINFO_H 36 #define _GL_LANGINFO_H 37 38 39 #if !1 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 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) 102 # define ERA 10047 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 127 128 #else 129 130 /* A platform that has <langinfo.h>. */ 131 132 # if !1 133 # define CODESET 10000 134 # define GNULIB_defined_CODESET 1 135 # endif 136 137 # if !1 138 # define T_FMT_AMPM 10006 139 # define GNULIB_defined_T_FMT_AMPM 1 140 # endif 141 142 # if !1 143 # define ERA 10047 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 149 # endif 150 151 # if !1 152 # define YESEXPR 10053 153 # define NOEXPR 10054 154 # define GNULIB_defined_YESEXPR 1 155 # endif 156 157 #endif 158 159 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 160 #ifndef _GL_CXXDEFS_H 161 #define _GL_CXXDEFS_H 162 163 /* The three most frequent use cases of these macros are: 164 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 167 it exists: 168 169 #if @GNULIB_FOO@ 170 # if !@HAVE_FOO@ 171 _GL_FUNCDECL_SYS (foo, ...); 172 # endif 173 _GL_CXXALIAS_SYS (foo, ...); 174 _GL_CXXALIASWARN (foo); 175 #elif defined GNULIB_POSIXCHECK 176 ... 177 #endif 178 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: 181 182 #if @GNULIB_FOO@ 183 # if @REPLACE_FOO@ 184 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 185 # undef foo 186 # define foo rpl_foo 187 # endif 188 _GL_FUNCDECL_RPL (foo, ...); 189 _GL_CXXALIAS_RPL (foo, ...); 190 # else 191 _GL_CXXALIAS_SYS (foo, ...); 192 # endif 193 _GL_CXXALIASWARN (foo); 194 #elif defined GNULIB_POSIXCHECK 195 ... 196 #endif 197 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: 201 202 #if @GNULIB_FOO@ 203 # if @REPLACE_FOO@ 204 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 205 # undef foo 206 # define foo rpl_foo 207 # endif 208 _GL_FUNCDECL_RPL (foo, ...); 209 _GL_CXXALIAS_RPL (foo, ...); 210 # else 211 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 212 _GL_FUNCDECL_SYS (foo, ...); 213 # endif 214 _GL_CXXALIAS_SYS (foo, ...); 215 # endif 216 _GL_CXXALIASWARN (foo); 217 #elif defined GNULIB_POSIXCHECK 218 ... 219 #endif 220 */ 221 222 /* _GL_EXTERN_C declaration; 223 performs the declaration with C linkage. */ 224 #if defined __cplusplus 225 # define _GL_EXTERN_C extern "C" 226 #else 227 # define _GL_EXTERN_C extern 228 #endif 229 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. 233 Example: 234 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 235 _GL_ARG_NONNULL ((1))); 236 */ 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 241 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. 245 Example: 246 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 247 _GL_ARG_NONNULL ((1))); 248 */ 249 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 250 _GL_EXTERN_C rettype func parameters_and_attributes 251 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. 255 Example: 256 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 257 */ 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 \ 263 { \ 264 rettype (*const func) parameters = ::rpl_func; \ 265 } \ 266 _GL_EXTERN_C int _gl_cxxalias_dummy 267 #else 268 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 270 #endif 271 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 \ 280 { \ 281 rettype (*const func) parameters = \ 282 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 283 } \ 284 _GL_EXTERN_C int _gl_cxxalias_dummy 285 #else 286 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 287 _GL_EXTERN_C int _gl_cxxalias_dummy 288 #endif 289 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 293 is defined. 294 Example: 295 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 296 */ 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 \ 306 { \ 307 static rettype (*func) parameters = ::func; \ 308 } \ 309 _GL_EXTERN_C int _gl_cxxalias_dummy 310 #else 311 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 312 _GL_EXTERN_C int _gl_cxxalias_dummy 313 #endif 314 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 319 otherwise occur. */ 320 #if defined __cplusplus && defined GNULIB_NAMESPACE 321 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 322 namespace GNULIB_NAMESPACE \ 323 { \ 324 static rettype (*func) parameters = \ 325 reinterpret_cast<rettype(*)parameters>(::func); \ 326 } \ 327 _GL_EXTERN_C int _gl_cxxalias_dummy 328 #else 329 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 330 _GL_EXTERN_C int _gl_cxxalias_dummy 331 #endif 332 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 \ 347 { \ 348 static rettype (*func) parameters = \ 349 reinterpret_cast<rettype(*)parameters>( \ 350 (rettype2(*)parameters2)(::func)); \ 351 } \ 352 _GL_EXTERN_C int _gl_cxxalias_dummy 353 #else 354 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 355 _GL_EXTERN_C int _gl_cxxalias_dummy 356 #endif 357 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 361 variants. */ 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. */ 369 # if !__OPTIMIZE__ 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 377 # else 378 # define _GL_CXXALIASWARN_2(func,namespace) \ 379 _GL_EXTERN_C int _gl_cxxalias_dummy 380 # endif 381 #else 382 # define _GL_CXXALIASWARN(func) \ 383 _GL_EXTERN_C int _gl_cxxalias_dummy 384 #endif 385 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, \ 392 GNULIB_NAMESPACE) 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. */ 397 # if !__OPTIMIZE__ 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 405 # else 406 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 407 _GL_EXTERN_C int _gl_cxxalias_dummy 408 # endif 409 #else 410 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 411 _GL_EXTERN_C int _gl_cxxalias_dummy 412 #endif 413 414 #endif /* _GL_CXXDEFS_H */ 415 416 /* The definition of _GL_WARN_ON_USE is copied here. */ 417 #ifndef _GL_WARN_ON_USE 418 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 430 # endif 431 #endif 432 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, 436 and attributes. 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 451 # endif 452 #endif 453 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" 459 # else 460 # define _GL_WARN_EXTERN_C extern 461 # endif 462 #endif 463 464 /* Declare overridden functions. */ 465 466 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. */ 470 471 #if 1 472 # if 0 473 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 474 # undef nl_langinfo 475 # define nl_langinfo rpl_nl_langinfo 476 # endif 477 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); 478 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); 479 # else 480 # if !1 481 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); 482 # endif 483 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); 484 # endif 485 _GL_CXXALIASWARN (nl_langinfo); 486 #elif defined GNULIB_POSIXCHECK 487 # undef nl_langinfo 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"); 491 # endif 492 #endif 493 494 495 #endif /* _GL_LANGINFO_H */ 496 #endif /* _GL_LANGINFO_H */ 497