1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2 /* A more-standard <time.h>. 3 4 Copyright (C) 2007-2018 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, see <https://www.gnu.org/licenses/>. */ 18 19 #if __GNUC__ >= 3 20 #pragma GCC system_header 21 #endif 22 23 24 /* Don't get in the way of glibc when it includes time.h merely to 25 declare a few standard symbols, rather than to declare all the 26 symbols. (However, skip this for MinGW as it treats __need_time_t 27 incompatibly.) Also, Solaris 8 <time.h> eventually includes itself 28 recursively; if that is happening, just include the system <time.h> 29 without adding our own declarations. */ 30 #if (((defined __need_time_t || defined __need_clock_t \ 31 || defined __need_timespec) \ 32 && !defined __MINGW32__) \ 33 || defined _GL_TIME_H) 34 35 # include_next <time.h> 36 37 #else 38 39 # define _GL_TIME_H 40 41 # include_next <time.h> 42 43 /* NetBSD 5.0 mis-defines NULL. */ 44 # include <stddef.h> 45 46 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 47 /* C++ compatible function declaration macros. 48 Copyright (C) 2010-2018 Free Software Foundation, Inc. 49 50 This program is free software: you can redistribute it and/or modify it 51 under the terms of the GNU General Public License as published 52 by the Free Software Foundation; either version 3 of the License, or 53 (at your option) any later version. 54 55 This program is distributed in the hope that it will be useful, 56 but WITHOUT ANY WARRANTY; without even the implied warranty of 57 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 58 General Public License for more details. 59 60 You should have received a copy of the GNU General Public License 61 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 62 63 #ifndef _GL_CXXDEFS_H 64 #define _GL_CXXDEFS_H 65 66 /* Begin/end the GNULIB_NAMESPACE namespace. */ 67 #if defined __cplusplus && defined GNULIB_NAMESPACE 68 # define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { 69 # define _GL_END_NAMESPACE } 70 #else 71 # define _GL_BEGIN_NAMESPACE 72 # define _GL_END_NAMESPACE 73 #endif 74 75 /* The three most frequent use cases of these macros are: 76 77 * For providing a substitute for a function that is missing on some 78 platforms, but is declared and works fine on the platforms on which 79 it exists: 80 81 #if @GNULIB_FOO@ 82 # if !@HAVE_FOO@ 83 _GL_FUNCDECL_SYS (foo, ...); 84 # endif 85 _GL_CXXALIAS_SYS (foo, ...); 86 _GL_CXXALIASWARN (foo); 87 #elif defined GNULIB_POSIXCHECK 88 ... 89 #endif 90 91 * For providing a replacement for a function that exists on all platforms, 92 but is broken/insufficient and needs to be replaced on some platforms: 93 94 #if @GNULIB_FOO@ 95 # if @REPLACE_FOO@ 96 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 97 # undef foo 98 # define foo rpl_foo 99 # endif 100 _GL_FUNCDECL_RPL (foo, ...); 101 _GL_CXXALIAS_RPL (foo, ...); 102 # else 103 _GL_CXXALIAS_SYS (foo, ...); 104 # endif 105 _GL_CXXALIASWARN (foo); 106 #elif defined GNULIB_POSIXCHECK 107 ... 108 #endif 109 110 * For providing a replacement for a function that exists on some platforms 111 but is broken/insufficient and needs to be replaced on some of them and 112 is additionally either missing or undeclared on some other platforms: 113 114 #if @GNULIB_FOO@ 115 # if @REPLACE_FOO@ 116 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 117 # undef foo 118 # define foo rpl_foo 119 # endif 120 _GL_FUNCDECL_RPL (foo, ...); 121 _GL_CXXALIAS_RPL (foo, ...); 122 # else 123 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ 124 _GL_FUNCDECL_SYS (foo, ...); 125 # endif 126 _GL_CXXALIAS_SYS (foo, ...); 127 # endif 128 _GL_CXXALIASWARN (foo); 129 #elif defined GNULIB_POSIXCHECK 130 ... 131 #endif 132 */ 133 134 /* _GL_EXTERN_C declaration; 135 performs the declaration with C linkage. */ 136 #if defined __cplusplus 137 # define _GL_EXTERN_C extern "C" 138 #else 139 # define _GL_EXTERN_C extern 140 #endif 141 142 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); 143 declares a replacement function, named rpl_func, with the given prototype, 144 consisting of return type, parameters, and attributes. 145 Example: 146 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) 147 _GL_ARG_NONNULL ((1))); 148 */ 149 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ 150 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) 151 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ 152 _GL_EXTERN_C rettype rpl_func parameters_and_attributes 153 154 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); 155 declares the system function, named func, with the given prototype, 156 consisting of return type, parameters, and attributes. 157 Example: 158 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) 159 _GL_ARG_NONNULL ((1))); 160 */ 161 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ 162 _GL_EXTERN_C rettype func parameters_and_attributes 163 164 /* _GL_CXXALIAS_RPL (func, rettype, parameters); 165 declares a C++ alias called GNULIB_NAMESPACE::func 166 that redirects to rpl_func, if GNULIB_NAMESPACE is defined. 167 Example: 168 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); 169 170 Wrapping rpl_func in an object with an inline conversion operator 171 avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is 172 actually used in the program. */ 173 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \ 174 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) 175 #if defined __cplusplus && defined GNULIB_NAMESPACE 176 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 177 namespace GNULIB_NAMESPACE \ 178 { \ 179 static const struct _gl_ ## func ## _wrapper \ 180 { \ 181 typedef rettype (*type) parameters; \ 182 \ 183 inline operator type () const \ 184 { \ 185 return ::rpl_func; \ 186 } \ 187 } func = {}; \ 188 } \ 189 _GL_EXTERN_C int _gl_cxxalias_dummy 190 #else 191 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ 192 _GL_EXTERN_C int _gl_cxxalias_dummy 193 #endif 194 195 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); 196 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); 197 except that the C function rpl_func may have a slightly different 198 declaration. A cast is used to silence the "invalid conversion" error 199 that would otherwise occur. */ 200 #if defined __cplusplus && defined GNULIB_NAMESPACE 201 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 202 namespace GNULIB_NAMESPACE \ 203 { \ 204 static const struct _gl_ ## func ## _wrapper \ 205 { \ 206 typedef rettype (*type) parameters; \ 207 \ 208 inline operator type () const \ 209 { \ 210 return reinterpret_cast<type>(::rpl_func); \ 211 } \ 212 } func = {}; \ 213 } \ 214 _GL_EXTERN_C int _gl_cxxalias_dummy 215 #else 216 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ 217 _GL_EXTERN_C int _gl_cxxalias_dummy 218 #endif 219 220 /* _GL_CXXALIAS_SYS (func, rettype, parameters); 221 declares a C++ alias called GNULIB_NAMESPACE::func 222 that redirects to the system provided function func, if GNULIB_NAMESPACE 223 is defined. 224 Example: 225 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); 226 227 Wrapping func in an object with an inline conversion operator 228 avoids a reference to func unless GNULIB_NAMESPACE::func is 229 actually used in the program. */ 230 #if defined __cplusplus && defined GNULIB_NAMESPACE 231 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 232 namespace GNULIB_NAMESPACE \ 233 { \ 234 static const struct _gl_ ## func ## _wrapper \ 235 { \ 236 typedef rettype (*type) parameters; \ 237 \ 238 inline operator type () const \ 239 { \ 240 return ::func; \ 241 } \ 242 } func = {}; \ 243 } \ 244 _GL_EXTERN_C int _gl_cxxalias_dummy 245 #else 246 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \ 247 _GL_EXTERN_C int _gl_cxxalias_dummy 248 #endif 249 250 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); 251 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 252 except that the C function func may have a slightly different declaration. 253 A cast is used to silence the "invalid conversion" error that would 254 otherwise occur. */ 255 #if defined __cplusplus && defined GNULIB_NAMESPACE 256 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 257 namespace GNULIB_NAMESPACE \ 258 { \ 259 static const struct _gl_ ## func ## _wrapper \ 260 { \ 261 typedef rettype (*type) parameters; \ 262 \ 263 inline operator type () const \ 264 { \ 265 return reinterpret_cast<type>(::func); \ 266 } \ 267 } func = {}; \ 268 } \ 269 _GL_EXTERN_C int _gl_cxxalias_dummy 270 #else 271 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ 272 _GL_EXTERN_C int _gl_cxxalias_dummy 273 #endif 274 275 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); 276 is like _GL_CXXALIAS_SYS (func, rettype, parameters); 277 except that the C function is picked among a set of overloaded functions, 278 namely the one with rettype2 and parameters2. Two consecutive casts 279 are used to silence the "cannot find a match" and "invalid conversion" 280 errors that would otherwise occur. */ 281 #if defined __cplusplus && defined GNULIB_NAMESPACE 282 /* The outer cast must be a reinterpret_cast. 283 The inner cast: When the function is defined as a set of overloaded 284 functions, it works as a static_cast<>, choosing the designated variant. 285 When the function is defined as a single variant, it works as a 286 reinterpret_cast<>. The parenthesized cast syntax works both ways. */ 287 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 288 namespace GNULIB_NAMESPACE \ 289 { \ 290 static const struct _gl_ ## func ## _wrapper \ 291 { \ 292 typedef rettype (*type) parameters; \ 293 \ 294 inline operator type () const \ 295 { \ 296 return reinterpret_cast<type>((rettype2 (*) parameters2)(::func)); \ 297 } \ 298 } func = {}; \ 299 } \ 300 _GL_EXTERN_C int _gl_cxxalias_dummy 301 #else 302 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ 303 _GL_EXTERN_C int _gl_cxxalias_dummy 304 #endif 305 306 /* _GL_CXXALIASWARN (func); 307 causes a warning to be emitted when ::func is used but not when 308 GNULIB_NAMESPACE::func is used. func must be defined without overloaded 309 variants. */ 310 #if defined __cplusplus && defined GNULIB_NAMESPACE 311 # define _GL_CXXALIASWARN(func) \ 312 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) 313 # define _GL_CXXALIASWARN_1(func,namespace) \ 314 _GL_CXXALIASWARN_2 (func, namespace) 315 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 316 we enable the warning only when not optimizing. */ 317 # if !__OPTIMIZE__ 318 # define _GL_CXXALIASWARN_2(func,namespace) \ 319 _GL_WARN_ON_USE (func, \ 320 "The symbol ::" #func " refers to the system function. " \ 321 "Use " #namespace "::" #func " instead.") 322 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 323 # define _GL_CXXALIASWARN_2(func,namespace) \ 324 extern __typeof__ (func) func 325 # else 326 # define _GL_CXXALIASWARN_2(func,namespace) \ 327 _GL_EXTERN_C int _gl_cxxalias_dummy 328 # endif 329 #else 330 # define _GL_CXXALIASWARN(func) \ 331 _GL_EXTERN_C int _gl_cxxalias_dummy 332 #endif 333 334 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); 335 causes a warning to be emitted when the given overloaded variant of ::func 336 is used but not when GNULIB_NAMESPACE::func is used. */ 337 #if defined __cplusplus && defined GNULIB_NAMESPACE 338 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 339 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ 340 GNULIB_NAMESPACE) 341 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ 342 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) 343 /* To work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>, 344 we enable the warning only when not optimizing. */ 345 # if !__OPTIMIZE__ 346 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 347 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \ 348 "The symbol ::" #func " refers to the system function. " \ 349 "Use " #namespace "::" #func " instead.") 350 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 351 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 352 extern __typeof__ (func) func 353 # else 354 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ 355 _GL_EXTERN_C int _gl_cxxalias_dummy 356 # endif 357 #else 358 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ 359 _GL_EXTERN_C int _gl_cxxalias_dummy 360 #endif 361 362 #endif /* _GL_CXXDEFS_H */ 363 364 /* The definition of _GL_ARG_NONNULL is copied here. */ 365 /* A C macro for declaring that specific arguments must not be NULL. 366 Copyright (C) 2009-2018 Free Software Foundation, Inc. 367 368 This program is free software: you can redistribute it and/or modify it 369 under the terms of the GNU General Public License as published 370 by the Free Software Foundation; either version 3 of the License, or 371 (at your option) any later version. 372 373 This program is distributed in the hope that it will be useful, 374 but WITHOUT ANY WARRANTY; without even the implied warranty of 375 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 376 General Public License for more details. 377 378 You should have received a copy of the GNU General Public License 379 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 380 381 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools 382 that the values passed as arguments n, ..., m must be non-NULL pointers. 383 n = 1 stands for the first argument, n = 2 for the second argument etc. */ 384 #ifndef _GL_ARG_NONNULL 385 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3 386 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) 387 # else 388 # define _GL_ARG_NONNULL(params) 389 # endif 390 #endif 391 392 /* The definition of _GL_WARN_ON_USE is copied here. */ 393 /* A C macro for emitting warnings if a function is used. 394 Copyright (C) 2010-2018 Free Software Foundation, Inc. 395 396 This program is free software: you can redistribute it and/or modify it 397 under the terms of the GNU General Public License as published 398 by the Free Software Foundation; either version 3 of the License, or 399 (at your option) any later version. 400 401 This program is distributed in the hope that it will be useful, 402 but WITHOUT ANY WARRANTY; without even the implied warranty of 403 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 404 General Public License for more details. 405 406 You should have received a copy of the GNU General Public License 407 along with this program. If not, see <https://www.gnu.org/licenses/>. */ 408 409 /* _GL_WARN_ON_USE (function, "literal string") issues a declaration 410 for FUNCTION which will then trigger a compiler warning containing 411 the text of "literal string" anywhere that function is called, if 412 supported by the compiler. If the compiler does not support this 413 feature, the macro expands to an unused extern declaration. 414 415 _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the 416 attribute used in _GL_WARN_ON_USE. If the compiler does not support 417 this feature, it expands to empty. 418 419 These macros are useful for marking a function as a potential 420 portability trap, with the intent that "literal string" include 421 instructions on the replacement function that should be used 422 instead. 423 _GL_WARN_ON_USE is for functions with 'extern' linkage. 424 _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' 425 linkage. 426 427 However, one of the reasons that a function is a portability trap is 428 if it has the wrong signature. Declaring FUNCTION with a different 429 signature in C is a compilation error, so this macro must use the 430 same type as any existing declaration so that programs that avoid 431 the problematic FUNCTION do not fail to compile merely because they 432 included a header that poisoned the function. But this implies that 433 _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already 434 have a declaration. Use of this macro implies that there must not 435 be any other macro hiding the declaration of FUNCTION; but 436 undefining FUNCTION first is part of the poisoning process anyway 437 (although for symbols that are provided only via a macro, the result 438 is a compilation error rather than a warning containing 439 "literal string"). Also note that in C++, it is only safe to use if 440 FUNCTION has no overloads. 441 442 For an example, it is possible to poison 'getline' by: 443 - adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]], 444 [getline]) in configure.ac, which potentially defines 445 HAVE_RAW_DECL_GETLINE 446 - adding this code to a header that wraps the system <stdio.h>: 447 #undef getline 448 #if HAVE_RAW_DECL_GETLINE 449 _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" 450 "not universally present; use the gnulib module getline"); 451 #endif 452 453 It is not possible to directly poison global variables. But it is 454 possible to write a wrapper accessor function, and poison that 455 (less common usage, like &environ, will cause a compilation error 456 rather than issue the nice warning, but the end result of informing 457 the developer about their portability problem is still achieved): 458 #if HAVE_RAW_DECL_ENVIRON 459 static char *** 460 rpl_environ (void) { return &environ; } 461 _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); 462 # undef environ 463 # define environ (*rpl_environ ()) 464 #endif 465 or better (avoiding contradictory use of 'static' and 'extern'): 466 #if HAVE_RAW_DECL_ENVIRON 467 static char *** 468 _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") 469 rpl_environ (void) { return &environ; } 470 # undef environ 471 # define environ (*rpl_environ ()) 472 #endif 473 */ 474 #ifndef _GL_WARN_ON_USE 475 476 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 477 /* A compiler attribute is available in gcc versions 4.3.0 and later. */ 478 # define _GL_WARN_ON_USE(function, message) \ 479 extern __typeof__ (function) function __attribute__ ((__warning__ (message))) 480 # define _GL_WARN_ON_USE_ATTRIBUTE(message) \ 481 __attribute__ ((__warning__ (message))) 482 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 483 /* Verify the existence of the function. */ 484 # define _GL_WARN_ON_USE(function, message) \ 485 extern __typeof__ (function) function 486 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 487 # else /* Unsupported. */ 488 # define _GL_WARN_ON_USE(function, message) \ 489 _GL_WARN_EXTERN_C int _gl_warn_on_use 490 # define _GL_WARN_ON_USE_ATTRIBUTE(message) 491 # endif 492 #endif 493 494 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string") 495 is like _GL_WARN_ON_USE (function, "string"), except that the function is 496 declared with the given prototype, consisting of return type, parameters, 497 and attributes. 498 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does 499 not work in this case. */ 500 #ifndef _GL_WARN_ON_USE_CXX 501 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) 502 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 503 extern rettype function parameters_and_attributes \ 504 __attribute__ ((__warning__ (msg))) 505 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING 506 /* Verify the existence of the function. */ 507 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 508 extern rettype function parameters_and_attributes 509 # else /* Unsupported. */ 510 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \ 511 _GL_WARN_EXTERN_C int _gl_warn_on_use 512 # endif 513 #endif 514 515 /* _GL_WARN_EXTERN_C declaration; 516 performs the declaration with C linkage. */ 517 #ifndef _GL_WARN_EXTERN_C 518 # if defined __cplusplus 519 # define _GL_WARN_EXTERN_C extern "C" 520 # else 521 # define _GL_WARN_EXTERN_C extern 522 # endif 523 #endif 524 525 /* Some systems don't define struct timespec (e.g., AIX 4.1). 526 Or they define it with the wrong member names or define it in <sys/time.h> 527 (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, 528 but the pthreads-win32 library defines it in <pthread.h>. */ 529 # if ! 1 530 # if 0 531 # include <sys/time.h> 532 # elif 0 533 # include <pthread.h> 534 # elif 0 535 # include <unistd.h> 536 # else 537 538 # ifdef __cplusplus 539 extern "C" { 540 # endif 541 542 # if !GNULIB_defined_struct_timespec 543 # undef timespec 544 # define timespec rpl_timespec 545 struct timespec 546 { 547 time_t tv_sec; 548 long int tv_nsec; 549 }; 550 # define GNULIB_defined_struct_timespec 1 551 # endif 552 553 # ifdef __cplusplus 554 } 555 # endif 556 557 # endif 558 # endif 559 560 # if !GNULIB_defined_struct_time_t_must_be_integral 561 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires 562 time_t to be an integer type, even though C99 permits floating 563 point. We don't know of any implementation that uses floating 564 point, and it is much easier to write code that doesn't have to 565 worry about that corner case, so we force the issue. */ 566 struct __time_t_must_be_integral { 567 unsigned int __floating_time_t_unsupported : (time_t) 1; 568 }; 569 # define GNULIB_defined_struct_time_t_must_be_integral 1 570 # endif 571 572 /* Sleep for at least RQTP seconds unless interrupted, If interrupted, 573 return -1 and store the remaining time into RMTP. See 574 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ 575 # if IN_DIFFUTILS_GNULIB_TESTS 576 # if 0 577 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 578 # define nanosleep rpl_nanosleep 579 # endif 580 _GL_FUNCDECL_RPL (nanosleep, int, 581 (struct timespec const *__rqtp, struct timespec *__rmtp) 582 _GL_ARG_NONNULL ((1))); 583 _GL_CXXALIAS_RPL (nanosleep, int, 584 (struct timespec const *__rqtp, struct timespec *__rmtp)); 585 # else 586 # if ! 1 587 _GL_FUNCDECL_SYS (nanosleep, int, 588 (struct timespec const *__rqtp, struct timespec *__rmtp) 589 _GL_ARG_NONNULL ((1))); 590 # endif 591 _GL_CXXALIAS_SYS (nanosleep, int, 592 (struct timespec const *__rqtp, struct timespec *__rmtp)); 593 # endif 594 _GL_CXXALIASWARN (nanosleep); 595 # endif 596 597 /* Initialize time conversion information. */ 598 # if 1 599 # if 0 600 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 601 # undef tzset 602 # define tzset rpl_tzset 603 # endif 604 _GL_FUNCDECL_RPL (tzset, void, (void)); 605 _GL_CXXALIAS_RPL (tzset, void, (void)); 606 # else 607 # if ! 1 608 _GL_FUNCDECL_SYS (tzset, void, (void)); 609 # endif 610 _GL_CXXALIAS_SYS (tzset, void, (void)); 611 # endif 612 _GL_CXXALIASWARN (tzset); 613 # endif 614 615 /* Return the 'time_t' representation of TP and normalize TP. */ 616 # if 1 617 # if 1 618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 619 # define mktime rpl_mktime 620 # endif 621 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); 622 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); 623 # else 624 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); 625 # endif 626 _GL_CXXALIASWARN (mktime); 627 # endif 628 629 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 630 <http://www.opengroup.org/susv3xsh/localtime_r.html> and 631 <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */ 632 # if 1 633 # if 0 634 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 635 # undef localtime_r 636 # define localtime_r rpl_localtime_r 637 # endif 638 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 639 struct tm *restrict __result) 640 _GL_ARG_NONNULL ((1, 2))); 641 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 642 struct tm *restrict __result)); 643 # else 644 # if ! 1 645 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 646 struct tm *restrict __result) 647 _GL_ARG_NONNULL ((1, 2))); 648 # endif 649 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 650 struct tm *restrict __result)); 651 # endif 652 # if 1 653 _GL_CXXALIASWARN (localtime_r); 654 # endif 655 # if 0 656 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 657 # undef gmtime_r 658 # define gmtime_r rpl_gmtime_r 659 # endif 660 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 661 struct tm *restrict __result) 662 _GL_ARG_NONNULL ((1, 2))); 663 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 664 struct tm *restrict __result)); 665 # else 666 # if ! 1 667 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 668 struct tm *restrict __result) 669 _GL_ARG_NONNULL ((1, 2))); 670 # endif 671 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 672 struct tm *restrict __result)); 673 # endif 674 # if 1 675 _GL_CXXALIASWARN (gmtime_r); 676 # endif 677 # endif 678 679 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See 680 <http://www.opengroup.org/susv3xsh/localtime.html> and 681 <http://www.opengroup.org/susv3xsh/gmtime.html>. */ 682 # if 0 || 0 683 # if 0 684 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 685 # undef localtime 686 # define localtime rpl_localtime 687 # endif 688 _GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) 689 _GL_ARG_NONNULL ((1))); 690 _GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); 691 # else 692 _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); 693 # endif 694 _GL_CXXALIASWARN (localtime); 695 # endif 696 697 # if 0 || 0 698 # if 0 699 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 700 # undef gmtime 701 # define gmtime rpl_gmtime 702 # endif 703 _GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) 704 _GL_ARG_NONNULL ((1))); 705 _GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); 706 # else 707 _GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); 708 # endif 709 _GL_CXXALIASWARN (gmtime); 710 # endif 711 712 /* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store 713 the resulting broken-down time into TM. See 714 <http://www.opengroup.org/susv3xsh/strptime.html>. */ 715 # if 1 716 # if ! 1 717 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, 718 char const *restrict __format, 719 struct tm *restrict __tm) 720 _GL_ARG_NONNULL ((1, 2, 3))); 721 # endif 722 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, 723 char const *restrict __format, 724 struct tm *restrict __tm)); 725 _GL_CXXALIASWARN (strptime); 726 # endif 727 728 /* Convert *TP to a date and time string. See 729 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html>. */ 730 # if 0 731 # if GNULIB_PORTCHECK 732 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 733 # define ctime rpl_ctime 734 # endif 735 _GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) 736 _GL_ARG_NONNULL ((1))); 737 _GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); 738 # else 739 _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); 740 # endif 741 _GL_CXXALIASWARN (ctime); 742 # endif 743 744 /* Convert *TP to a date and time string. See 745 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html>. */ 746 # if 0 747 # if GNULIB_PORTCHECK 748 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 749 # define strftime rpl_strftime 750 # endif 751 _GL_FUNCDECL_RPL (strftime, size_t, (char *__buf, size_t __bufsize, 752 const char *__fmt, const struct tm *__tp) 753 _GL_ARG_NONNULL ((1, 3, 4))); 754 _GL_CXXALIAS_RPL (strftime, size_t, (char *__buf, size_t __bufsize, 755 const char *__fmt, const struct tm *__tp)); 756 # else 757 _GL_CXXALIAS_SYS (strftime, size_t, (char *__buf, size_t __bufsize, 758 const char *__fmt, const struct tm *__tp)); 759 # endif 760 _GL_CXXALIASWARN (strftime); 761 # endif 762 763 # if defined _GNU_SOURCE && 1 && ! 0 764 typedef struct tm_zone *timezone_t; 765 _GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); 766 _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); 767 _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); 768 _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); 769 _GL_FUNCDECL_SYS (localtime_rz, struct tm *, 770 (timezone_t __tz, time_t const *restrict __timer, 771 struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); 772 _GL_CXXALIAS_SYS (localtime_rz, struct tm *, 773 (timezone_t __tz, time_t const *restrict __timer, 774 struct tm *restrict __result)); 775 _GL_FUNCDECL_SYS (mktime_z, time_t, 776 (timezone_t __tz, struct tm *restrict __result) 777 _GL_ARG_NONNULL ((2))); 778 _GL_CXXALIAS_SYS (mktime_z, time_t, 779 (timezone_t __tz, struct tm *restrict __result)); 780 # endif 781 782 /* Convert TM to a time_t value, assuming UTC. */ 783 # if 1 784 # if 1 785 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) 786 # undef timegm 787 # define timegm rpl_timegm 788 # endif 789 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 790 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); 791 # else 792 # if ! 1 793 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); 794 # endif 795 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); 796 # endif 797 _GL_CXXALIASWARN (timegm); 798 # endif 799 800 /* Encourage applications to avoid unsafe functions that can overrun 801 buffers when given outlandish struct tm values. Portable 802 applications should use strftime (or even sprintf) instead. */ 803 # if defined GNULIB_POSIXCHECK 804 # undef asctime 805 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " 806 "better use strftime (or even sprintf) instead"); 807 # endif 808 # if defined GNULIB_POSIXCHECK 809 # undef asctime_r 810 _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - " 811 "better use strftime (or even sprintf) instead"); 812 # endif 813 # if defined GNULIB_POSIXCHECK 814 # undef ctime 815 _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - " 816 "better use strftime (or even sprintf) instead"); 817 # endif 818 # if defined GNULIB_POSIXCHECK 819 # undef ctime_r 820 _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - " 821 "better use strftime (or even sprintf) instead"); 822 # endif 823 824 #endif 825