1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* Substitute for and wrapper around <langinfo.h>. 3 Copyright (C) 2009-2014 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 THOUSEP 10002 54 /* nl_langinfo items of the LC_TIME category */ 55 # define D_T_FMT 10003 56 # define D_FMT 10004 57 # define T_FMT 10005 58 # define T_FMT_AMPM 10006 59 # define AM_STR 10007 60 # define PM_STR 10008 61 # define DAY_1 10009 62 # define DAY_2 (DAY_1 + 1) 63 # define DAY_3 (DAY_1 + 2) 64 # define DAY_4 (DAY_1 + 3) 65 # define DAY_5 (DAY_1 + 4) 66 # define DAY_6 (DAY_1 + 5) 67 # define DAY_7 (DAY_1 + 6) 68 # define ABDAY_1 10016 69 # define ABDAY_2 (ABDAY_1 + 1) 70 # define ABDAY_3 (ABDAY_1 + 2) 71 # define ABDAY_4 (ABDAY_1 + 3) 72 # define ABDAY_5 (ABDAY_1 + 4) 73 # define ABDAY_6 (ABDAY_1 + 5) 74 # define ABDAY_7 (ABDAY_1 + 6) 75 # define MON_1 10023 76 # define MON_2 (MON_1 + 1) 77 # define MON_3 (MON_1 + 2) 78 # define MON_4 (MON_1 + 3) 79 # define MON_5 (MON_1 + 4) 80 # define MON_6 (MON_1 + 5) 81 # define MON_7 (MON_1 + 6) 82 # define MON_8 (MON_1 + 7) 83 # define MON_9 (MON_1 + 8) 84 # define MON_10 (MON_1 + 9) 85 # define MON_11 (MON_1 + 10) 86 # define MON_12 (MON_1 + 11) 87 # define ABMON_1 10035 88 # define ABMON_2 (ABMON_1 + 1) 89 # define ABMON_3 (ABMON_1 + 2) 90 # define ABMON_4 (ABMON_1 + 3) 91 # define ABMON_5 (ABMON_1 + 4) 92 # define ABMON_6 (ABMON_1 + 5) 93 # define ABMON_7 (ABMON_1 + 6) 94 # define ABMON_8 (ABMON_1 + 7) 95 # define ABMON_9 (ABMON_1 + 8) 96 # define ABMON_10 (ABMON_1 + 9) 97 # define ABMON_11 (ABMON_1 + 10) 98 # define ABMON_12 (ABMON_1 + 11) 99 # define ERA 10047 100 # define ERA_D_FMT 10048 101 # define ERA_D_T_FMT 10049 102 # define ERA_T_FMT 10050 103 # define ALT_DIGITS 10051 104 /* nl_langinfo items of the LC_MONETARY category */ 105 # define CRNCYSTR 10052 106 /* nl_langinfo items of the LC_MESSAGES category */ 107 # define YESEXPR 10053 108 # define NOEXPR 10054 109 110 #else 111 112 /* A platform that has <langinfo.h>. */ 113 114 # if !1 115 # define CODESET 10000 116 # define GNULIB_defined_CODESET 1 117 # endif 118 119 # if !1 120 # define T_FMT_AMPM 10006 121 # define GNULIB_defined_T_FMT_AMPM 1 122 # endif 123 124 # if !1 125 # define ERA 10047 126 # define ERA_D_FMT 10048 127 # define ERA_D_T_FMT 10049 128 # define ERA_T_FMT 10050 129 # define ALT_DIGITS 10051 130 # define GNULIB_defined_ERA 1 131 # endif 132 133 # if !1 134 # define YESEXPR 10053 135 # define NOEXPR 10054 136 # define GNULIB_defined_YESEXPR 1 137 # endif 138 139 #endif 140 141 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 142 #ifndef _GL_CXXDEFS_H 143 #define _GL_CXXDEFS_H 144 145 /* The three most frequent use cases of these macros are: 146 147 * For providing a substitute for a function that is missing on some 148 platforms, but is declared and works fine on the platforms on which 149 it exists: 150 151 #if @GNULIB_FOO@ 152 # if !@HAVE_FOO@ 153 _GL_FUNCDECL_SYS (foo, ...); 154 # endif 155 _GL_CXXALIAS_SYS (foo, ...); 156 _GL_CXXALIASWARN (foo); 157 #elif defined GNULIB_POSIXCHECK 158 ... 159 #endif 160 161 * For providing a replacement for a function that exists on all platforms, 162 but is broken/insufficient and needs to be replaced on some platforms: 163 164 #if @GNULIB_FOO@ 165 # if @REPLACE_FOO@ 166 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 167 # undef foo 168 # define foo rpl_foo 169 # endif 170 _GL_FUNCDECL_RPL (foo, ...); 171 _GL_CXXALIAS_RPL (foo, ...); 172 # else 173 _GL_CXXALIAS_SYS (foo, ...); 174 # endif 175 _GL_CXXALIASWARN (foo); 176 #elif defined GNULIB_POSIXCHECK 177 ... 178 #endif 179 180 * For providing a replacement for a function that exists on some platforms 181 but is broken/insufficient and needs to be replaced on some of them and 182 is additionally either missing or undeclared on some other platforms: 183 184 #if @GNULIB_FOO@ 185 # if @REPLACE_FOO@ 186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 187 # undef foo 188 # define foo rpl_foo 189 # endif 190 _GL_FUNCDECL_RPL (foo, ...); 191 _GL_CXXALIAS_RPL (foo, ...); 192 # else 193 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 194 _GL_FUNCDECL_SYS (foo, ...); 195 # endif 196 _GL_CXXALIAS_SYS (foo, ...); 197 # endif 198 _GL_CXXALIASWARN (foo); 199 #elif defined GNULIB_POSIXCHECK 200 ... 201 #endif 202 */ 203 204 /* _GL_EXTERN_C declaration; 205 performs the declaration with C linkage. */ 206 #if defined __cplusplus 207 # define _GL_EXTERN_C extern "C" 208 #else 209 # define _GL_EXTERN_C extern 210 #endif 211 212 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 213 declares a replacement function, named rpl_func, with the given prototype, 214 consisting of return type, parameters, and attributes. 215 Example: 216 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 217 _GL_ARG_NONNULL ((1))); 218 */ 219 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 220 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 221 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 222 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 223 224 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 225 declares the system function, named func, with the given prototype, 226 consisting of return type, parameters, and attributes. 227 Example: 228 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 229 _GL_ARG_NONNULL ((1))); 230 */ 231 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 232 _GL_EXTERN_C rettype func parameters_and_attributes 233 234 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 235 declares a C++ alias called GNULIB_NAMESPACE::func 236 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 237 Example: 238 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 239 */ 240 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 241 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 242 #if defined __cplusplus && defined GNULIB_NAMESPACE 243 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 244 namespace GNULIB_NAMESPACE \ 245 { \ 246 rettype (*const func) parameters = ::rpl_func; \ 247 } \ 248 _GL_EXTERN_C int _gl_cxxalias_dummy 249 #else 250 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 251 _GL_EXTERN_C int _gl_cxxalias_dummy 252 #endif 253 254 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 255 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 256 except that the C function rpl_func may have a slightly different 257 declaration. A cast is used to silence the "invalid conversion" error 258 that would otherwise occur. */ 259 #if defined __cplusplus && defined GNULIB_NAMESPACE 260 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 261 namespace GNULIB_NAMESPACE \ 262 { \ 263 rettype (*const func) parameters = \ 264 reinterpret_cast<rettype(*)parameters>(::rpl_func); \ 265 } \ 266 _GL_EXTERN_C int _gl_cxxalias_dummy 267 #else 268 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 270 #endif 271 272 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 273 declares a C++ alias called GNULIB_NAMESPACE::func 274 that redirects to the system provided function func, if GNULIB_NAMESPACE 275 is defined. 276 Example: 277 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 278 */ 279 #if defined __cplusplus && defined GNULIB_NAMESPACE 280 /* If we were to write 281 rettype (*const func) parameters = ::func; 282 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls 283 better (remove an indirection through a 'static' pointer variable), 284 but then the _GL_CXXALIASWARN macro below would cause a warning not only 285 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */ 286 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 287 namespace GNULIB_NAMESPACE \ 288 { \ 289 static rettype (*func) parameters = ::func; \ 290 } \ 291 _GL_EXTERN_C int _gl_cxxalias_dummy 292 #else 293 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 294 _GL_EXTERN_C int _gl_cxxalias_dummy 295 #endif 296 297 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 298 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 299 except that the C function func may have a slightly different declaration. 300 A cast is used to silence the "invalid conversion" error that would 301 otherwise occur. */ 302 #if defined __cplusplus && defined GNULIB_NAMESPACE 303 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 304 namespace GNULIB_NAMESPACE \ 305 { \ 306 static rettype (*func) parameters = \ 307 reinterpret_cast<rettype(*)parameters>(::func); \ 308 } \ 309 _GL_EXTERN_C int _gl_cxxalias_dummy 310 #else 311 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 312 _GL_EXTERN_C int _gl_cxxalias_dummy 313 #endif 314 315 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 316 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 317 except that the C function is picked among a set of overloaded functions, 318 namely the one with rettype2 and parameters2. Two consecutive casts 319 are used to silence the "cannot find a match" and "invalid conversion" 320 errors that would otherwise occur. */ 321 #if defined __cplusplus && defined GNULIB_NAMESPACE 322 /* The outer cast must be a reinterpret_cast. 323 The inner cast: When the function is defined as a set of overloaded 324 functions, it works as a static_cast<>, choosing the designated variant. 325 When the function is defined as a single variant, it works as a 326 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 327 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 328 namespace GNULIB_NAMESPACE \ 329 { \ 330 static rettype (*func) parameters = \ 331 reinterpret_cast<rettype(*)parameters>( \ 332 (rettype2(*)parameters2)(::func)); \ 333 } \ 334 _GL_EXTERN_C int _gl_cxxalias_dummy 335 #else 336 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 337 _GL_EXTERN_C int _gl_cxxalias_dummy 338 #endif 339 340 /* _GL_CXXALIASWARN (func); 341 causes a warning to be emitted when ::func is used but not when 342 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 343 variants. */ 344 #if defined __cplusplus && defined GNULIB_NAMESPACE 345 # define _GL_CXXALIASWARN(func) \ 346 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 347 # define _GL_CXXALIASWARN_1(func,namespace) \ 348 _GL_CXXALIASWARN_2 (func, namespace) 349 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 350 we enable the warning only when not optimizing. */ 351 # if !__OPTIMIZE__ 352 # define _GL_CXXALIASWARN_2(func,namespace) \ 353 _GL_WARN_ON_USE (func, \ 354 "The symbol ::" #func " refers to the system function. " \ 355 "Use " #namespace "::" #func " instead.") 356 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 357 # define _GL_CXXALIASWARN_2(func,namespace) \ 358 extern __typeof__ (func) func 359 # else 360 # define _GL_CXXALIASWARN_2(func,namespace) \ 361 _GL_EXTERN_C int _gl_cxxalias_dummy 362 # endif 363 #else 364 # define _GL_CXXALIASWARN(func) \ 365 _GL_EXTERN_C int _gl_cxxalias_dummy 366 #endif 367 368 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 369 causes a warning to be emitted when the given overloaded variant of ::func 370 is used but not when GNULIB_NAMESPACE::func is used. */ 371 #if defined __cplusplus && defined GNULIB_NAMESPACE 372 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 373 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 374 GNULIB_NAMESPACE) 375 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 376 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 377 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 378 we enable the warning only when not optimizing. */ 379 # if !__OPTIMIZE__ 380 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 381 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 382 "The symbol ::" #func " refers to the system function. " \ 383 "Use " #namespace "::" #func " instead.") 384 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 385 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 386 extern __typeof__ (func) func 387 # else 388 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 389 _GL_EXTERN_C int _gl_cxxalias_dummy 390 # endif 391 #else 392 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 393 _GL_EXTERN_C int _gl_cxxalias_dummy 394 #endif 395 396 #endif /* _GL_CXXDEFS_H */ 397 398 /* The definition of _GL_WARN_ON_USE is copied here. */ 399 #ifndef _GL_WARN_ON_USE 400 401 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 402 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 403 # define _GL_WARN_ON_USE(function, message) \ 404 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 405 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 406 /* Verify the existence of the function. */ 407 # define _GL_WARN_ON_USE(function, message) \ 408 extern __typeof__ (function) function 409 # else /* Unsupported. */ 410 # define _GL_WARN_ON_USE(function, message) \ 411 _GL_WARN_EXTERN_C int _gl_warn_on_use 412 # endif 413 #endif 414 415 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 416 is like _GL_WARN_ON_USE (function, "string"), except that the function is 417 declared with the given prototype, consisting of return type, parameters, 418 and attributes. 419 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 420 not work in this case. */ 421 #ifndef _GL_WARN_ON_USE_CXX 422 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 423 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 424 extern rettype function parameters_and_attributes \ 425 __attribute__ ((__warning__ (msg))) 426 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 427 /* Verify the existence of the function. */ 428 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 429 extern rettype function parameters_and_attributes 430 # else /* Unsupported. */ 431 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 432 _GL_WARN_EXTERN_C int _gl_warn_on_use 433 # endif 434 #endif 435 436 /* _GL_WARN_EXTERN_C declaration; 437 performs the declaration with C linkage. */ 438 #ifndef _GL_WARN_EXTERN_C 439 # if defined __cplusplus 440 # define _GL_WARN_EXTERN_C extern "C" 441 # else 442 # define _GL_WARN_EXTERN_C extern 443 # endif 444 #endif 445 446 /* Declare overridden functions. */ 447 448 449 /* Return a piece of locale dependent information. 450 Note: The difference between nl_langinfo (CODESET) and locale_charset () 451 is that the latter normalizes the encoding names to GNU conventions. */ 452 453 #if 1 454 # if 0 455 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 456 # undef nl_langinfo 457 # define nl_langinfo rpl_nl_langinfo 458 # endif 459 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); 460 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); 461 # else 462 # if !1 463 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); 464 # endif 465 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); 466 # endif 467 _GL_CXXALIASWARN (nl_langinfo); 468 #elif defined GNULIB_POSIXCHECK 469 # undef nl_langinfo 470 # if HAVE_RAW_DECL_NL_LANGINFO 471 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " 472 "use gnulib module nl_langinfo for portability"); 473 # endif 474 #endif 475 476 477 #endif /* _GL_LANGINFO_H */ 478 #endif /* _GL_LANGINFO_H */ 479