Mercurial > gnulib
annotate lib/sys_time.in.h @ 14840:5f709022a256
Allow multiple gnulib generated include files to be combined.
* gnulib-tool (func_compute_include_guard_prefix): New function.
(func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): Resolve also
${gl_include_guard_prefix} references.
(func_import, func_create_testdir): Invoke
func_compute_include_guard_prefix.
* lib/arpa_inet.in.h: Use the @GUARD_PREFIX@ placeholder.
* lib/ctype.in.h: Likewise.
* lib/dirent.in.h: Likewise.
* lib/errno.in.h: Likewise.
* lib/fcntl.in.h: Likewise.
* lib/float.in.h: Likewise.
* lib/getopt.in.h: Likewise.
* lib/iconv.in.h: Likewise.
* lib/langinfo.in.h: Likewise.
* lib/locale.in.h: Likewise.
* lib/math.in.h: Likewise.
* lib/netdb.in.h: Likewise.
* lib/netinet_in.in.h: Likewise.
* lib/poll.in.h: Likewise.
* lib/pthread.in.h: Likewise.
* lib/pty.in.h: Likewise.
* lib/sched.in.h: Likewise.
* lib/se-selinux.in.h: Likewise.
* lib/search.in.h: Likewise.
* lib/signal.in.h: Likewise.
* lib/spawn.in.h: Likewise.
* lib/stdarg.in.h: Likewise.
* lib/stddef.in.h: Likewise.
* lib/stdint.in.h: Likewise.
* lib/stdio.in.h: Likewise.
* lib/stdlib.in.h: Likewise.
* lib/string.in.h: Likewise.
* lib/strings.in.h: Likewise.
* lib/sys_file.in.h: Likewise.
* lib/sys_ioctl.in.h: Likewise.
* lib/sys_select.in.h: Likewise.
* lib/sys_socket.in.h: Likewise.
* lib/sys_stat.in.h: Likewise.
* lib/sys_time.in.h: Likewise.
* lib/sys_times.in.h: Likewise.
* lib/sys_uio.in.h: Likewise.
* lib/sys_utsname.in.h: Likewise.
* lib/sys_wait.in.h: Likewise.
* lib/sysexits.in.h: Likewise.
* lib/termios.in.h: Likewise.
* lib/time.in.h: Likewise.
* lib/unistd.in.h: Likewise.
* lib/wchar.in.h: Likewise.
* lib/wctype.in.h: Likewise.
* modules/arpa_inet (Makefile.am): Substitute @GUARD_PREFIX@.
* modules/ctype (Makefile.am): Likewise.
* modules/dirent (Makefile.am): Likewise.
* modules/errno (Makefile.am): Likewise.
* modules/fcntl-h (Makefile.am): Likewise.
* modules/float (Makefile.am): Likewise.
* modules/getopt-posix (Makefile.am): Likewise.
* modules/iconv-h (Makefile.am): Likewise.
* modules/langinfo (Makefile.am): Likewise.
* modules/locale (Makefile.am): Likewise.
* modules/math (Makefile.am): Likewise.
* modules/netdb (Makefile.am): Likewise.
* modules/netinet_in (Makefile.am): Likewise.
* modules/poll-h (Makefile.am): Likewise.
* modules/pthread (Makefile.am): Likewise.
* modules/pty (Makefile.am): Likewise.
* modules/sched (Makefile.am): Likewise.
* modules/search (Makefile.am): Likewise.
* modules/selinux-h (Makefile.am): Likewise.
* modules/signal (Makefile.am): Likewise.
* modules/spawn (Makefile.am): Likewise.
* modules/stdarg (Makefile.am): Likewise.
* modules/stddef (Makefile.am): Likewise.
* modules/stdint (Makefile.am): Likewise.
* modules/stdio (Makefile.am): Likewise.
* modules/stdlib (Makefile.am): Likewise.
* modules/string (Makefile.am): Likewise.
* modules/strings (Makefile.am): Likewise.
* modules/sys_file (Makefile.am): Likewise.
* modules/sys_ioctl (Makefile.am): Likewise.
* modules/sys_select (Makefile.am): Likewise.
* modules/sys_socket (Makefile.am): Likewise.
* modules/sys_stat (Makefile.am): Likewise.
* modules/sys_time (Makefile.am): Likewise.
* modules/sys_times (Makefile.am): Likewise.
* modules/sys_uio (Makefile.am): Likewise.
* modules/sys_utsname (Makefile.am): Likewise.
* modules/sys_wait (Makefile.am): Likewise.
* modules/sysexits (Makefile.am): Likewise.
* modules/termios (Makefile.am): Likewise.
* modules/time (Makefile.am): Likewise.
* modules/unistd (Makefile.am): Likewise.
* modules/wchar (Makefile.am): Likewise.
* modules/wctype-h (Makefile.am): Likewise.
* modules/assert-h (Makefile.am): Replace _GL_VERIFY_H specially.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 29 May 2011 15:44:42 +0200 |
parents | da5595160b9f |
children | e819b881a9e2 |
rev | line source |
---|---|
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Provide a more complete sys/time.h. |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
13761
diff
changeset
|
3 Copyright (C) 2007-2011 Free Software Foundation, Inc. |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 This program is free software; you can redistribute it and/or modify |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 it under the terms of the GNU General Public License as published by |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 the Free Software Foundation; either version 2, or (at your option) |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 any later version. |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 This program is distributed in the hope that it will be useful, |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 GNU General Public License for more details. |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
14 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU General Public License |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 along with this program; if not, write to the Free Software Foundation, |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 /* Written by Paul Eggert. */ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
21 #if __GNUC__ >= 3 |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9268
diff
changeset
|
22 @PRAGMA_SYSTEM_HEADER@ |
10655
8668b19a7032
Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
23 #endif |
13761
a19ace3ba849
Avoid line length limitation from HP NonStop system header files.
Bruno Haible <bruno@clisp.org>
parents:
13479
diff
changeset
|
24 @PRAGMA_COLUMNS@ |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
9268
diff
changeset
|
25 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
26 #if defined _@GUARD_PREFIX@_SYS_TIME_H |
13099
f4aae3195883
sys_time: avoid compiler warnings
Eric Blake <eblake@redhat.com>
parents:
13094
diff
changeset
|
27 |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 /* Simply delegate to the system's header, without adding anything. */ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 # if @HAVE_SYS_TIME_H@ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 # endif |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 #else |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
35 # define _@GUARD_PREFIX@_SYS_TIME_H |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
36 |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
37 # if @HAVE_SYS_TIME_H@ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
38 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@ |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 # else |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 # include <time.h> |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
41 # endif |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
42 |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
43 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
44 |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
10842
diff
changeset
|
45 /* The definition of _GL_ARG_NONNULL is copied here. */ |
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
10842
diff
changeset
|
46 |
12844 | 47 /* The definition of _GL_WARN_ON_USE is copied here. */ |
48 | |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
49 # ifdef __cplusplus |
10842
4a02c5d90eaf
sys_time: Add extern "C" block for C++.
Simon Josefsson <simon@josefsson.org>
parents:
10655
diff
changeset
|
50 extern "C" { |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
51 # endif |
10842
4a02c5d90eaf
sys_time: Add extern "C" block for C++.
Simon Josefsson <simon@josefsson.org>
parents:
10655
diff
changeset
|
52 |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 # if ! @HAVE_STRUCT_TIMEVAL@ |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
54 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
55 # if !GNULIB_defined_struct_timeval |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 struct timeval |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 { |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
58 time_t tv_sec; |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 long int tv_usec; |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 }; |
14274
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
61 # define GNULIB_defined_struct_timeval 1 |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
62 # endif |
da5595160b9f
Allow multiple gnulib generated replacements to coexist.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
63 |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 # endif |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
66 # ifdef __cplusplus |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
67 } |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
68 # endif |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
69 |
12844 | 70 # if @GNULIB_GETTIMEOFDAY@ |
71 # if @REPLACE_GETTIMEOFDAY@ | |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
72 # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
73 # undef gettimeofday |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
74 # define gettimeofday rpl_gettimeofday |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
75 # endif |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
76 _GL_FUNCDECL_RPL (gettimeofday, int, |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
77 (struct timeval *restrict, void *restrict) |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
78 _GL_ARG_NONNULL ((1))); |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
79 _GL_CXXALIAS_RPL (gettimeofday, int, |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
80 (struct timeval *restrict, void *restrict)); |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
81 # else |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
82 # if !@HAVE_GETTIMEOFDAY@ |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
83 _GL_FUNCDECL_SYS (gettimeofday, int, |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
84 (struct timeval *restrict, void *restrict) |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
85 _GL_ARG_NONNULL ((1))); |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
86 # endif |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
87 /* Need to cast, because on glibc systems, by default, the second argument is |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
88 struct timezone *. */ |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
89 _GL_CXXALIAS_SYS_CAST (gettimeofday, int, |
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
90 (struct timeval *restrict, void *restrict)); |
12888
88955fc5764d
gettimeofday: restore support for platforms that lack function
Eric Blake <eblake@redhat.com>
parents:
12844
diff
changeset
|
91 # endif |
12947
c2b20f3765ff
sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents:
12888
diff
changeset
|
92 _GL_CXXALIASWARN (gettimeofday); |
12844 | 93 # elif defined GNULIB_POSIXCHECK |
94 # undef gettimeofday | |
95 # if HAVE_RAW_DECL_GETTIMEOFDAY | |
96 _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - " | |
13479
8a0b8adde2be
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
13099
diff
changeset
|
97 "use gnulib module gettimeofday for portability"); |
12844 | 98 # endif |
9268
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 # endif |
a553c18c572d
Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 |
14840
5f709022a256
Allow multiple gnulib generated include files to be combined.
Bruno Haible <bruno@clisp.org>
parents:
14274
diff
changeset
|
101 #endif /* _@GUARD_PREFIX@_SYS_TIME_H */ |