annotate lib/sys_time.in.h @ 13094:2ed0fc659db8

Emit #pragma system_header after the inclusion guard, not before.
author Bruno Haible <bruno@clisp.org>
date Tue, 30 Mar 2010 02:35:49 +0200
parents c2b20f3765ff
children f4aae3195883
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 12422
diff changeset
3 Copyright (C) 2007-2010 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
13094
2ed0fc659db8 Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents: 12947
diff changeset
21 #if defined _GL_SYS_TIME_H
2ed0fc659db8 Emit #pragma system_header after the inclusion guard, not before.
Bruno Haible <bruno@clisp.org>
parents: 12947
diff changeset
22
10655
8668b19a7032 Avoid gcc warnings because of #pragma GCC system_header on older gcc.
Bruno Haible <bruno@clisp.org>
parents: 10375
diff changeset
23 #if __GNUC__ >= 3
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 9268
diff changeset
24 @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
25 #endif
10375
f96e845fc36d Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents: 9268
diff changeset
26
9268
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 /* 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
28 # if @HAVE_SYS_TIME_H@
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 # endif
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 #else
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 # define _GL_SYS_TIME_H
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # if @HAVE_SYS_TIME_H@
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 # @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 # else
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 # include <time.h>
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 # endif
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
42 /* 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
43
12422
f7842310a565 New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents: 10842
diff changeset
44 /* 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
45
12844
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
46 /* The definition of _GL_WARN_ON_USE is copied here. */
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
47
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
48 # ifdef __cplusplus
10842
4a02c5d90eaf sys_time: Add extern "C" block for C++.
Simon Josefsson <simon@josefsson.org>
parents: 10655
diff changeset
49 extern "C" {
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
50 # endif
10842
4a02c5d90eaf sys_time: Add extern "C" block for C++.
Simon Josefsson <simon@josefsson.org>
parents: 10655
diff changeset
51
9268
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 # if ! @HAVE_STRUCT_TIMEVAL@
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 struct timeval
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 {
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 time_t tv_sec;
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 long int tv_usec;
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 # endif
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
60 # ifdef __cplusplus
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
61 }
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
62 # endif
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
63
12844
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
64 # if @GNULIB_GETTIMEOFDAY@
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
65 # if @REPLACE_GETTIMEOFDAY@
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
66 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
67 # undef gettimeofday
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
68 # define gettimeofday rpl_gettimeofday
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
69 # endif
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
70 _GL_FUNCDECL_RPL (gettimeofday, int,
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
71 (struct timeval *restrict, void *restrict)
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
72 _GL_ARG_NONNULL ((1)));
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
73 _GL_CXXALIAS_RPL (gettimeofday, int,
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
74 (struct timeval *restrict, void *restrict));
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
75 # else
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
76 # if !@HAVE_GETTIMEOFDAY@
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
77 _GL_FUNCDECL_SYS (gettimeofday, int,
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
78 (struct timeval *restrict, void *restrict)
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
79 _GL_ARG_NONNULL ((1)));
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
80 # endif
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
81 /* 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
82 struct timezone *. */
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
83 _GL_CXXALIAS_SYS_CAST (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));
12888
88955fc5764d gettimeofday: restore support for platforms that lack function
Eric Blake <eblake@redhat.com>
parents: 12844
diff changeset
85 # endif
12947
c2b20f3765ff sys_time: Avoid #define replacements in C++ mode.
Bruno Haible <bruno@clisp.org>
parents: 12888
diff changeset
86 _GL_CXXALIASWARN (gettimeofday);
12844
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
87 # elif defined GNULIB_POSIXCHECK
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
88 # undef gettimeofday
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
89 # if HAVE_RAW_DECL_GETTIMEOFDAY
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
90 _GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
91 "use gnulib module gettimeofday for portability");
aaa284caae61 sys_time: use link-warning
Eric Blake <ebb9@byu.net>
parents: 12559
diff changeset
92 # endif
9268
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 # endif
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94
a553c18c572d Rename sys_time_.h to sys_time.in.h.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 #endif /* _GL_SYS_TIME_H */