aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2012-05-26 16:14:36 -0700
committerPaul Eggert2012-05-26 16:14:36 -0700
commitcaf8a9b2b301aba06735d403317b75b41df59bfe (patch)
treebfafb3cc0cf8a2f2394b4ed721e7c3d4891b78ab /lib
parentfe453991eafc32a890297a2003ac532b9f579f92 (diff)
downloademacs-caf8a9b2b301aba06735d403317b75b41df59bfe.tar.gz
emacs-caf8a9b2b301aba06735d403317b75b41df59bfe.zip
Merge from gnulib.
Fixes: debbugs:11527
Diffstat (limited to 'lib')
-rw-r--r--lib/alloca.in.h8
-rw-r--r--lib/allocator.h2
-rw-r--r--lib/careadlinkat.c2
-rw-r--r--lib/careadlinkat.h2
-rw-r--r--lib/dosname.h2
-rw-r--r--lib/dup2.c4
-rw-r--r--lib/filemode.c6
-rw-r--r--lib/filemode.h2
-rw-r--r--lib/ftoastr.c3
-rw-r--r--lib/ftoastr.h4
-rw-r--r--lib/getloadavg.c6
-rw-r--r--lib/getopt.c66
-rw-r--r--lib/getopt.in.h54
-rw-r--r--lib/getopt1.c6
-rw-r--r--lib/getopt_int.h16
-rw-r--r--lib/gettext.h7
-rw-r--r--lib/gnulib.mk73
-rw-r--r--lib/ignore-value.h17
-rw-r--r--lib/intprops.h2
-rw-r--r--lib/inttypes.in.h1770
-rw-r--r--lib/lstat.c8
-rw-r--r--lib/md5.c17
-rw-r--r--lib/md5.h7
-rw-r--r--lib/mktime.c432
-rw-r--r--lib/pathmax.h5
-rw-r--r--lib/pthread_sigmask.c2
-rw-r--r--lib/readlink.c2
-rw-r--r--lib/sha1.c17
-rw-r--r--lib/sha1.h5
-rw-r--r--lib/sha256.c14
-rw-r--r--lib/sha256.h2
-rw-r--r--lib/sha512.c16
-rw-r--r--lib/sha512.h2
-rw-r--r--lib/signal.in.h2
-rw-r--r--lib/sigprocmask.c5
-rw-r--r--lib/stat.c16
-rw-r--r--lib/stdalign.in.h90
-rw-r--r--lib/stdarg.in.h5
-rw-r--r--lib/stdbool.in.h5
-rw-r--r--lib/stddef.in.h5
-rw-r--r--lib/stdint.in.h84
-rw-r--r--lib/stdio.in.h41
-rw-r--r--lib/stdlib.in.h190
-rw-r--r--lib/strftime.c10
-rw-r--r--lib/strftime.h2
-rw-r--r--lib/strtoimax.c2
-rw-r--r--lib/strtol.c14
-rw-r--r--lib/strtoll.c4
-rw-r--r--lib/strtoul.c2
-rw-r--r--lib/strtoull.c4
-rw-r--r--lib/symlink.c2
-rw-r--r--lib/sys_stat.in.h70
-rw-r--r--lib/sys_types.in.h51
-rw-r--r--lib/time.in.h5
-rw-r--r--lib/time_r.c5
-rw-r--r--lib/u64.h13
-rw-r--r--lib/unistd.in.h80
-rw-r--r--lib/verify.h16
58 files changed, 1918 insertions, 1386 deletions
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 5b69c6c81a8..e94eb68c3c8 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
1/* Memory allocation on the stack. 1/* Memory allocation on the stack.
2 2
3 Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation, 3 Copyright (C) 1995, 1999, 2001-2004, 2006-2012 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
@@ -14,9 +14,9 @@
14 General Public License for more details. 14 General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public 16 You should have received a copy of the GNU General Public
17 License along with this program; if not, write to the Free Software 17 License along with this program; if not, see
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 18 <http://www.gnu.org/licenses/>.
19 USA. */ 19 */
20 20
21/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H 21/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
22 means there is a real alloca function. */ 22 means there is a real alloca function. */
diff --git a/lib/allocator.h b/lib/allocator.h
index b8de95c0f50..81c4aa20a45 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -1,6 +1,6 @@
1/* Memory allocators such as malloc+free. 1/* Memory allocators such as malloc+free.
2 2
3 Copyright (C) 2011 Free Software Foundation, Inc. 3 Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 751578b9a58..cd4aa846dca 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -1,6 +1,6 @@
1/* Read symbolic links into a buffer without size limitation, relative to fd. 1/* Read symbolic links into a buffer without size limitation, relative to fd.
2 2
3 Copyright (C) 2001, 2003-2004, 2007, 2009-2011 Free Software Foundation, 3 Copyright (C) 2001, 2003-2004, 2007, 2009-2012 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 6576fb2cecc..c21d3f459cd 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -1,6 +1,6 @@
1/* Read symbolic links into a buffer without size limitation, relative to fd. 1/* Read symbolic links into a buffer without size limitation, relative to fd.
2 2
3 Copyright (C) 2011 Free Software Foundation, Inc. 3 Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/dosname.h b/lib/dosname.h
index acdd03b156e..0468ce4dc81 100644
--- a/lib/dosname.h
+++ b/lib/dosname.h
@@ -1,6 +1,6 @@
1/* File names on MS-DOS/Windows systems. 1/* File names on MS-DOS/Windows systems.
2 2
3 Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 2000-2001, 2004-2006, 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/dup2.c b/lib/dup2.c
index 790c98a2e84..f6d0f1c73c5 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -1,6 +1,6 @@
1/* Duplicate an open file descriptor to a specified file descriptor. 1/* Duplicate an open file descriptor to a specified file descriptor.
2 2
3 Copyright (C) 1999, 2004-2007, 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 1999, 2004-2007, 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
31 31
32# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 32# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
33 33
34/* Get declarations of the Win32 API functions. */ 34/* Get declarations of the native Windows API functions. */
35# define WIN32_LEAN_AND_MEAN 35# define WIN32_LEAN_AND_MEAN
36# include <windows.h> 36# include <windows.h>
37 37
diff --git a/lib/filemode.c b/lib/filemode.c
index 0f6641ace6a..ed8c6c989f1 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -1,6 +1,6 @@
1/* filemode.c -- make a string describing file modes 1/* filemode.c -- make a string describing file modes
2 2
3 Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free 3 Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2012 Free
4 Software Foundation, Inc. 4 Software Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
@@ -21,8 +21,8 @@
21#include "filemode.h" 21#include "filemode.h"
22 22
23/* The following is for Cray DMF (Data Migration Facility), which is a 23/* The following is for Cray DMF (Data Migration Facility), which is a
24 HSM file system. A migrated file has a `st_dm_mode' that is 24 HSM file system. A migrated file has a 'st_dm_mode' that is
25 different from the normal `st_mode', so any tests for migrated 25 different from the normal 'st_mode', so any tests for migrated
26 files should use the former. */ 26 files should use the former. */
27#if HAVE_ST_DM_MODE 27#if HAVE_ST_DM_MODE
28# define IS_MIGRATED_FILE(statp) \ 28# define IS_MIGRATED_FILE(statp) \
diff --git a/lib/filemode.h b/lib/filemode.h
index 1a50302704c..9ebef47806d 100644
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -1,6 +1,6 @@
1/* Make a string describing file modes. 1/* Make a string describing file modes.
2 2
3 Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation, 3 Copyright (C) 1998-1999, 2003, 2006, 2009-2012 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index 7c99ef00f38..ebeed3e1347 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -1,6 +1,6 @@
1/* floating point to accurate string 1/* floating point to accurate string
2 2
3 Copyright (C) 2010-2011 Free Software Foundation, Inc. 3 Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
29 29
30#include "ftoastr.h" 30#include "ftoastr.h"
31 31
32#include "intprops.h"
33#include <float.h> 32#include <float.h>
34#include <stdio.h> 33#include <stdio.h>
35#include <stdlib.h> 34#include <stdlib.h>
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index 6264952e8e9..89869a2238f 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -1,6 +1,6 @@
1/* floating point to accurate string 1/* floating point to accurate string
2 2
3 Copyright (C) 2010-2011 Free Software Foundation, Inc. 3 Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ enum
58 FTOASTR_ALWAYS_SIGNED = 2, 58 FTOASTR_ALWAYS_SIGNED = 2,
59 59
60 /* Output " " before positive numbers; ignored if 60 /* Output " " before positive numbers; ignored if
61 FTOASTER_ALWAYS_SIGNED is also given. */ 61 FTOASTR_ALWAYS_SIGNED is also given. */
62 FTOASTR_SPACE_POSITIVE = 4, 62 FTOASTR_SPACE_POSITIVE = 4,
63 63
64 /* Pad with zeros instead of spaces; ignored if FTOASTR_LEFT_JUSTIFY 64 /* Pad with zeros instead of spaces; ignored if FTOASTR_LEFT_JUSTIFY
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index d324451ef15..d79ad136bc9 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,6 +1,6 @@
1/* Get the system load averages. 1/* Get the system load averages.
2 2
3 Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2011 Free Software 3 Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2012 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 NOTE: The canonical source of this file is maintained with gnulib. 6 NOTE: The canonical source of this file is maintained with gnulib.
@@ -46,7 +46,7 @@
46 NLIST_STRUCT Include nlist.h, not a.out.h. 46 NLIST_STRUCT Include nlist.h, not a.out.h.
47 N_NAME_POINTER The nlist n_name element is a pointer, 47 N_NAME_POINTER The nlist n_name element is a pointer,
48 not an array. 48 not an array.
49 HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'. 49 HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
50 LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing 50 LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing
51 load averages. 51 load averages.
52 52
@@ -794,7 +794,7 @@ getloadavg (double loadavg[], int nelem)
794# define LDAV_DONE 794# define LDAV_DONE
795 /* This call can return -1 for an error, but with good args 795 /* This call can return -1 for an error, but with good args
796 it's not supposed to fail. The first argument is for no 796 it's not supposed to fail. The first argument is for no
797 apparent reason of type `long int *'. */ 797 apparent reason of type 'long int *'. */
798 dg_sys_info ((long int *) &load_info, 798 dg_sys_info ((long int *) &load_info,
799 DG_SYS_INFO_LOAD_INFO_TYPE, 799 DG_SYS_INFO_LOAD_INFO_TYPE,
800 DG_SYS_INFO_LOAD_VERSION_0); 800 DG_SYS_INFO_LOAD_VERSION_0);
diff --git a/lib/getopt.c b/lib/getopt.c
index 7c9f7040612..4342a34104c 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -2,7 +2,7 @@
2 NOTE: getopt is part of the C library, so if you don't know what 2 NOTE: getopt is part of the C library, so if you don't know what
3 "Keep this file name-space clean" means, talk to drepper@gnu.org 3 "Keep this file name-space clean" means, talk to drepper@gnu.org
4 before changing it! 4 before changing it!
5 Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2011 Free Software 5 Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2012 Free Software
6 Foundation, Inc. 6 Foundation, Inc.
7 This file is part of the GNU C Library. 7 This file is part of the GNU C Library.
8 8
@@ -41,15 +41,15 @@
41# include <wchar.h> 41# include <wchar.h>
42#endif 42#endif
43 43
44/* This version of `getopt' appears to the caller like standard Unix `getopt' 44/* This version of 'getopt' appears to the caller like standard Unix 'getopt'
45 but it behaves differently for the user, since it allows the user 45 but it behaves differently for the user, since it allows the user
46 to intersperse the options with the other arguments. 46 to intersperse the options with the other arguments.
47 47
48 As `getopt_long' works, it permutes the elements of ARGV so that, 48 As 'getopt_long' works, it permutes the elements of ARGV so that,
49 when it is done, all the options precede everything else. Thus 49 when it is done, all the options precede everything else. Thus
50 all application programs are extended to handle flexible argument order. 50 all application programs are extended to handle flexible argument order.
51 51
52 Using `getopt' or setting the environment variable POSIXLY_CORRECT 52 Using 'getopt' or setting the environment variable POSIXLY_CORRECT
53 disables permutation. 53 disables permutation.
54 Then the behavior is completely standard. 54 Then the behavior is completely standard.
55 55
@@ -58,24 +58,24 @@
58 58
59#include "getopt_int.h" 59#include "getopt_int.h"
60 60
61/* For communication from `getopt' to the caller. 61/* For communication from 'getopt' to the caller.
62 When `getopt' finds an option that takes an argument, 62 When 'getopt' finds an option that takes an argument,
63 the argument value is returned here. 63 the argument value is returned here.
64 Also, when `ordering' is RETURN_IN_ORDER, 64 Also, when 'ordering' is RETURN_IN_ORDER,
65 each non-option ARGV-element is returned here. */ 65 each non-option ARGV-element is returned here. */
66 66
67char *optarg; 67char *optarg;
68 68
69/* Index in ARGV of the next element to be scanned. 69/* Index in ARGV of the next element to be scanned.
70 This is used for communication to and from the caller 70 This is used for communication to and from the caller
71 and for communication between successive calls to `getopt'. 71 and for communication between successive calls to 'getopt'.
72 72
73 On entry to `getopt', zero means this is the first call; initialize. 73 On entry to 'getopt', zero means this is the first call; initialize.
74 74
75 When `getopt' returns -1, this is the index of the first of the 75 When 'getopt' returns -1, this is the index of the first of the
76 non-option elements that the caller should itself scan. 76 non-option elements that the caller should itself scan.
77 77
78 Otherwise, `optind' communicates from one call to the next 78 Otherwise, 'optind' communicates from one call to the next
79 how much of ARGV has been scanned so far. */ 79 how much of ARGV has been scanned so far. */
80 80
81/* 1003.2 says this must be 1 before any call. */ 81/* 1003.2 says this must be 1 before any call. */
@@ -137,7 +137,7 @@ extern char *__getopt_nonoption_flags;
137 The other is elements [last_nonopt,optind), which contains all 137 The other is elements [last_nonopt,optind), which contains all
138 the options processed since those non-options were skipped. 138 the options processed since those non-options were skipped.
139 139
140 `first_nonopt' and `last_nonopt' are relocated so that they describe 140 'first_nonopt' and 'last_nonopt' are relocated so that they describe
141 the new indices of the non-options in ARGV after they are moved. */ 141 the new indices of the non-options in ARGV after they are moved. */
142 142
143static void 143static void
@@ -154,7 +154,7 @@ exchange (char **argv, struct _getopt_data *d)
154 but it consists of two parts that need to be swapped next. */ 154 but it consists of two parts that need to be swapped next. */
155 155
156#if defined _LIBC && defined USE_NONOPTION_FLAGS 156#if defined _LIBC && defined USE_NONOPTION_FLAGS
157 /* First make sure the handling of the `__getopt_nonoption_flags' 157 /* First make sure the handling of the '__getopt_nonoption_flags'
158 string can work normally. Our top argument must be in the range 158 string can work normally. Our top argument must be in the range
159 of the string. */ 159 of the string. */
160 if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) 160 if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
@@ -291,48 +291,48 @@ _getopt_initialize (int argc _GL_UNUSED,
291 291
292 If an element of ARGV starts with '-', and is not exactly "-" or "--", 292 If an element of ARGV starts with '-', and is not exactly "-" or "--",
293 then it is an option element. The characters of this element 293 then it is an option element. The characters of this element
294 (aside from the initial '-') are option characters. If `getopt' 294 (aside from the initial '-') are option characters. If 'getopt'
295 is called repeatedly, it returns successively each of the option characters 295 is called repeatedly, it returns successively each of the option characters
296 from each of the option elements. 296 from each of the option elements.
297 297
298 If `getopt' finds another option character, it returns that character, 298 If 'getopt' finds another option character, it returns that character,
299 updating `optind' and `nextchar' so that the next call to `getopt' can 299 updating 'optind' and 'nextchar' so that the next call to 'getopt' can
300 resume the scan with the following option character or ARGV-element. 300 resume the scan with the following option character or ARGV-element.
301 301
302 If there are no more option characters, `getopt' returns -1. 302 If there are no more option characters, 'getopt' returns -1.
303 Then `optind' is the index in ARGV of the first ARGV-element 303 Then 'optind' is the index in ARGV of the first ARGV-element
304 that is not an option. (The ARGV-elements have been permuted 304 that is not an option. (The ARGV-elements have been permuted
305 so that those that are not options now come last.) 305 so that those that are not options now come last.)
306 306
307 OPTSTRING is a string containing the legitimate option characters. 307 OPTSTRING is a string containing the legitimate option characters.
308 If an option character is seen that is not listed in OPTSTRING, 308 If an option character is seen that is not listed in OPTSTRING,
309 return '?' after printing an error message. If you set `opterr' to 309 return '?' after printing an error message. If you set 'opterr' to
310 zero, the error message is suppressed but we still return '?'. 310 zero, the error message is suppressed but we still return '?'.
311 311
312 If a char in OPTSTRING is followed by a colon, that means it wants an arg, 312 If a char in OPTSTRING is followed by a colon, that means it wants an arg,
313 so the following text in the same ARGV-element, or the text of the following 313 so the following text in the same ARGV-element, or the text of the following
314 ARGV-element, is returned in `optarg'. Two colons mean an option that 314 ARGV-element, is returned in 'optarg'. Two colons mean an option that
315 wants an optional arg; if there is text in the current ARGV-element, 315 wants an optional arg; if there is text in the current ARGV-element,
316 it is returned in `optarg', otherwise `optarg' is set to zero. 316 it is returned in 'optarg', otherwise 'optarg' is set to zero.
317 317
318 If OPTSTRING starts with `-' or `+', it requests different methods of 318 If OPTSTRING starts with '-' or '+', it requests different methods of
319 handling the non-option ARGV-elements. 319 handling the non-option ARGV-elements.
320 See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. 320 See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
321 321
322 Long-named options begin with `--' instead of `-'. 322 Long-named options begin with '--' instead of '-'.
323 Their names may be abbreviated as long as the abbreviation is unique 323 Their names may be abbreviated as long as the abbreviation is unique
324 or is an exact match for some defined option. If they have an 324 or is an exact match for some defined option. If they have an
325 argument, it follows the option name in the same ARGV-element, separated 325 argument, it follows the option name in the same ARGV-element, separated
326 from the option name by a `=', or else the in next ARGV-element. 326 from the option name by a '=', or else the in next ARGV-element.
327 When `getopt' finds a long-named option, it returns 0 if that option's 327 When 'getopt' finds a long-named option, it returns 0 if that option's
328 `flag' field is nonzero, the value of the option's `val' field 328 'flag' field is nonzero, the value of the option's 'val' field
329 if the `flag' field is zero. 329 if the 'flag' field is zero.
330 330
331 The elements of ARGV aren't really const, because we permute them. 331 The elements of ARGV aren't really const, because we permute them.
332 But we pretend they're const in the prototype to be compatible 332 But we pretend they're const in the prototype to be compatible
333 with other systems. 333 with other systems.
334 334
335 LONGOPTS is a vector of `struct option' terminated by an 335 LONGOPTS is a vector of 'struct option' terminated by an
336 element containing a name which is zero. 336 element containing a name which is zero.
337 337
338 LONGIND returns the index in LONGOPT of the long-named option found. 338 LONGIND returns the index in LONGOPT of the long-named option found.
@@ -409,7 +409,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
409 d->__last_nonopt = d->optind; 409 d->__last_nonopt = d->optind;
410 } 410 }
411 411
412 /* The special ARGV-element `--' means premature end of options. 412 /* The special ARGV-element '--' means premature end of options.
413 Skip it like a null option, 413 Skip it like a null option,
414 then exchange with previous non-options as if it were an option, 414 then exchange with previous non-options as if it were an option,
415 then skip everything else like a non-option. */ 415 then skip everything else like a non-option. */
@@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
788 char c = *d->__nextchar++; 788 char c = *d->__nextchar++;
789 const char *temp = strchr (optstring, c); 789 const char *temp = strchr (optstring, c);
790 790
791 /* Increment `optind' when we start to process its last character. */ 791 /* Increment 'optind' when we start to process its last character. */
792 if (*d->__nextchar == '\0') 792 if (*d->__nextchar == '\0')
793 ++d->optind; 793 ++d->optind;
794 794
@@ -887,7 +887,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
887 return c; 887 return c;
888 } 888 }
889 else 889 else
890 /* We already incremented `d->optind' once; 890 /* We already incremented 'd->optind' once;
891 increment it again when taking next ARGV-elt as argument. */ 891 increment it again when taking next ARGV-elt as argument. */
892 d->optarg = argv[d->optind++]; 892 d->optarg = argv[d->optind++];
893 893
@@ -1114,7 +1114,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
1114 c = '?'; 1114 c = '?';
1115 } 1115 }
1116 else 1116 else
1117 /* We already incremented `optind' once; 1117 /* We already incremented 'optind' once;
1118 increment it again when taking next ARGV-elt as argument. */ 1118 increment it again when taking next ARGV-elt as argument. */
1119 d->optarg = argv[d->optind++]; 1119 d->optarg = argv[d->optind++];
1120 d->__nextchar = NULL; 1120 d->__nextchar = NULL;
@@ -1177,7 +1177,7 @@ __posix_getopt (int argc, char *const *argv, const char *optstring)
1177#ifdef TEST 1177#ifdef TEST
1178 1178
1179/* Compile with -DTEST to make an executable for use in testing 1179/* Compile with -DTEST to make an executable for use in testing
1180 the above definition of `getopt'. */ 1180 the above definition of 'getopt'. */
1181 1181
1182int 1182int
1183main (int argc, char **argv) 1183main (int argc, char **argv)
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 0f3918ab771..06b6dfc50c2 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,5 +1,5 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software 2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -82,7 +82,7 @@
82 getopt_long_only can permute argv; this is required for backward 82 getopt_long_only can permute argv; this is required for backward
83 compatibility (e.g., for LSB 2.0.1). 83 compatibility (e.g., for LSB 2.0.1).
84 84
85 This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', 85 This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
86 but it caused redefinition warnings if both unistd.h and getopt.h were 86 but it caused redefinition warnings if both unistd.h and getopt.h were
87 included, since unistd.h includes getopt.h having previously defined 87 included, since unistd.h includes getopt.h having previously defined
88 __need_getopt. 88 __need_getopt.
@@ -128,29 +128,29 @@
128extern "C" { 128extern "C" {
129#endif 129#endif
130 130
131/* For communication from `getopt' to the caller. 131/* For communication from 'getopt' to the caller.
132 When `getopt' finds an option that takes an argument, 132 When 'getopt' finds an option that takes an argument,
133 the argument value is returned here. 133 the argument value is returned here.
134 Also, when `ordering' is RETURN_IN_ORDER, 134 Also, when 'ordering' is RETURN_IN_ORDER,
135 each non-option ARGV-element is returned here. */ 135 each non-option ARGV-element is returned here. */
136 136
137extern char *optarg; 137extern char *optarg;
138 138
139/* Index in ARGV of the next element to be scanned. 139/* Index in ARGV of the next element to be scanned.
140 This is used for communication to and from the caller 140 This is used for communication to and from the caller
141 and for communication between successive calls to `getopt'. 141 and for communication between successive calls to 'getopt'.
142 142
143 On entry to `getopt', zero means this is the first call; initialize. 143 On entry to 'getopt', zero means this is the first call; initialize.
144 144
145 When `getopt' returns -1, this is the index of the first of the 145 When 'getopt' returns -1, this is the index of the first of the
146 non-option elements that the caller should itself scan. 146 non-option elements that the caller should itself scan.
147 147
148 Otherwise, `optind' communicates from one call to the next 148 Otherwise, 'optind' communicates from one call to the next
149 how much of ARGV has been scanned so far. */ 149 how much of ARGV has been scanned so far. */
150 150
151extern int optind; 151extern int optind;
152 152
153/* Callers store zero here to inhibit the error message `getopt' prints 153/* Callers store zero here to inhibit the error message 'getopt' prints
154 for unrecognized options. */ 154 for unrecognized options. */
155 155
156extern int opterr; 156extern int opterr;
@@ -162,24 +162,24 @@ extern int optopt;
162#ifndef __need_getopt 162#ifndef __need_getopt
163/* Describe the long-named options requested by the application. 163/* Describe the long-named options requested by the application.
164 The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 164 The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
165 of `struct option' terminated by an element containing a name which is 165 of 'struct option' terminated by an element containing a name which is
166 zero. 166 zero.
167 167
168 The field `has_arg' is: 168 The field 'has_arg' is:
169 no_argument (or 0) if the option does not take an argument, 169 no_argument (or 0) if the option does not take an argument,
170 required_argument (or 1) if the option requires an argument, 170 required_argument (or 1) if the option requires an argument,
171 optional_argument (or 2) if the option takes an optional argument. 171 optional_argument (or 2) if the option takes an optional argument.
172 172
173 If the field `flag' is not NULL, it points to a variable that is set 173 If the field 'flag' is not NULL, it points to a variable that is set
174 to the value given in the field `val' when the option is found, but 174 to the value given in the field 'val' when the option is found, but
175 left unchanged if the option is not found. 175 left unchanged if the option is not found.
176 176
177 To have a long-named option do something other than set an `int' to 177 To have a long-named option do something other than set an 'int' to
178 a compiled-in constant, such as set a value from `optarg', set the 178 a compiled-in constant, such as set a value from 'optarg', set the
179 option's `flag' field to zero and its `val' field to a nonzero 179 option's 'flag' field to zero and its 'val' field to a nonzero
180 value (the equivalent single-letter option character, if there is 180 value (the equivalent single-letter option character, if there is
181 one). For long options that have a zero `flag' field, `getopt' 181 one). For long options that have a zero 'flag' field, 'getopt'
182 returns the contents of the `val' field. */ 182 returns the contents of the 'val' field. */
183 183
184# if !GNULIB_defined_struct_option 184# if !GNULIB_defined_struct_option
185struct option 185struct option
@@ -194,7 +194,7 @@ struct option
194# define GNULIB_defined_struct_option 1 194# define GNULIB_defined_struct_option 1
195# endif 195# endif
196 196
197/* Names for the values of the `has_arg' field of `struct option'. */ 197/* Names for the values of the 'has_arg' field of 'struct option'. */
198 198
199# define no_argument 0 199# define no_argument 0
200# define required_argument 1 200# define required_argument 1
@@ -208,23 +208,23 @@ struct option
208 208
209 Return the option character from OPTS just read. Return -1 when 209 Return the option character from OPTS just read. Return -1 when
210 there are no more options. For unrecognized options, or options 210 there are no more options. For unrecognized options, or options
211 missing arguments, `optopt' is set to the option letter, and '?' is 211 missing arguments, 'optopt' is set to the option letter, and '?' is
212 returned. 212 returned.
213 213
214 The OPTS string is a list of characters which are recognized option 214 The OPTS string is a list of characters which are recognized option
215 letters, optionally followed by colons, specifying that that letter 215 letters, optionally followed by colons, specifying that that letter
216 takes an argument, to be placed in `optarg'. 216 takes an argument, to be placed in 'optarg'.
217 217
218 If a letter in OPTS is followed by two colons, its argument is 218 If a letter in OPTS is followed by two colons, its argument is
219 optional. This behavior is specific to the GNU `getopt'. 219 optional. This behavior is specific to the GNU 'getopt'.
220 220
221 The argument `--' causes premature termination of argument 221 The argument '--' causes premature termination of argument
222 scanning, explicitly telling `getopt' that there are no more 222 scanning, explicitly telling 'getopt' that there are no more
223 options. 223 options.
224 224
225 If OPTS begins with `-', then non-option arguments are treated as 225 If OPTS begins with '-', then non-option arguments are treated as
226 arguments to the option '\1'. This behavior is specific to the GNU 226 arguments to the option '\1'. This behavior is specific to the GNU
227 `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in 227 'getopt'. If OPTS begins with '+', or POSIXLY_CORRECT is set in
228 the environment, then do not permute arguments. */ 228 the environment, then do not permute arguments. */
229 229
230extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) 230extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 36568024cc2..fb2a8f5a7b1 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,5 +1,5 @@
1/* getopt_long and getopt_long_only entry points for GNU getopt. 1/* getopt_long and getopt_long_only entry points for GNU getopt.
2 Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2011 Free Software 2 Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -141,11 +141,11 @@ main (int argc, char **argv)
141 break; 141 break;
142 142
143 case 'c': 143 case 'c':
144 printf ("option c with value `%s'\n", optarg); 144 printf ("option c with value '%s'\n", optarg);
145 break; 145 break;
146 146
147 case 'd': 147 case 'd':
148 printf ("option d with value `%s'\n", optarg); 148 printf ("option d with value '%s'\n", optarg);
149 break; 149 break;
150 150
151 case '?': 151 case '?':
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index 9f0c7131a14..2da020c995a 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
1/* Internal declarations for getopt. 1/* Internal declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2011 Free Software 2 Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -40,7 +40,7 @@ extern int _getopt_internal (int ___argc, char **___argv,
40 stop option processing when the first non-option is seen. 40 stop option processing when the first non-option is seen.
41 This is what Unix does. 41 This is what Unix does.
42 This mode of operation is selected by either setting the environment 42 This mode of operation is selected by either setting the environment
43 variable POSIXLY_CORRECT, or using `+' as the first character 43 variable POSIXLY_CORRECT, or using '+' as the first character
44 of the list of option characters, or by calling getopt. 44 of the list of option characters, or by calling getopt.
45 45
46 PERMUTE is the default. We permute the contents of ARGV as we 46 PERMUTE is the default. We permute the contents of ARGV as we
@@ -52,12 +52,12 @@ extern int _getopt_internal (int ___argc, char **___argv,
52 written to expect options and other ARGV-elements in any order 52 written to expect options and other ARGV-elements in any order
53 and that care about the ordering of the two. We describe each 53 and that care about the ordering of the two. We describe each
54 non-option ARGV-element as if it were the argument of an option 54 non-option ARGV-element as if it were the argument of an option
55 with character code 1. Using `-' as the first character of the 55 with character code 1. Using '-' as the first character of the
56 list of option characters selects this mode of operation. 56 list of option characters selects this mode of operation.
57 57
58 The special argument `--' forces an end of option-scanning regardless 58 The special argument '--' forces an end of option-scanning regardless
59 of the value of `ordering'. In the case of RETURN_IN_ORDER, only 59 of the value of 'ordering'. In the case of RETURN_IN_ORDER, only
60 `--' can cause `getopt' to return -1 with `optind' != ARGC. */ 60 '--' can cause 'getopt' to return -1 with 'optind' != ARGC. */
61 61
62enum __ord 62enum __ord
63 { 63 {
@@ -99,8 +99,8 @@ struct _getopt_data
99 /* Handle permutation of arguments. */ 99 /* Handle permutation of arguments. */
100 100
101 /* Describe the part of ARGV that contains non-options that have 101 /* Describe the part of ARGV that contains non-options that have
102 been skipped. `first_nonopt' is the index in ARGV of the first 102 been skipped. 'first_nonopt' is the index in ARGV of the first
103 of them; `last_nonopt' is the index after the last of them. */ 103 of them; 'last_nonopt' is the index after the last of them. */
104 104
105 int __first_nonopt; 105 int __first_nonopt;
106 int __last_nonopt; 106 int __last_nonopt;
diff --git a/lib/gettext.h b/lib/gettext.h
index 458e3322177..75875cdb0fb 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
1/* Convenience header for conditional use of GNU <libintl.h>. 1/* Convenience header for conditional use of GNU <libintl.h>.
2 Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software 2 Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License along 15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, 16 with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#ifndef _LIBGETTEXT_H 18#ifndef _LIBGETTEXT_H
20#define _LIBGETTEXT_H 1 19#define _LIBGETTEXT_H 1
@@ -185,7 +184,7 @@ npgettext_aux (const char *domain,
185#include <string.h> 184#include <string.h>
186 185
187#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \ 186#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
188 (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \ 187 (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
189 /* || __STDC_VERSION__ >= 199901L */ ) 188 /* || __STDC_VERSION__ >= 199901L */ )
190 189
191#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 190#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 153ea11efe4..863ae5cef42 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -1,6 +1,6 @@
1## DO NOT EDIT! GENERATED AUTOMATICALLY! 1## DO NOT EDIT! GENERATED AUTOMATICALLY!
2## Process this file with automake to produce Makefile.in. 2## Process this file with automake to produce Makefile.in.
3# Copyright (C) 2002-2011 Free Software Foundation, Inc. 3# Copyright (C) 2002-2012 Free Software Foundation, Inc.
4# 4#
5# This file is free software; you can redistribute it and/or modify 5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by 6# it under the terms of the GNU General Public License as published by
@@ -204,7 +204,7 @@ BUILT_SOURCES += inttypes.h
204 204
205# We need the following in order to create <inttypes.h> when the system 205# We need the following in order to create <inttypes.h> when the system
206# doesn't have one that works with the given compiler. 206# doesn't have one that works with the given compiler.
207inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H) 207inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
208 $(AM_V_GEN)rm -f $@-t $@ && \ 208 $(AM_V_GEN)rm -f $@-t $@ && \
209 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ 209 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
210 sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ 210 sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -225,10 +225,12 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_N
225 -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \ 225 -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
226 -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \ 226 -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
227 -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \ 227 -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
228 -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
228 -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \ 229 -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
229 -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \ 230 -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
230 -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \ 231 -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
231 -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \ 232 -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
233 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
232 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ 234 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
233 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ 235 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
234 < $(srcdir)/inttypes.in.h; \ 236 < $(srcdir)/inttypes.in.h; \
@@ -430,6 +432,29 @@ EXTRA_libgnu_a_SOURCES += stat.c
430 432
431## end gnulib module stat 433## end gnulib module stat
432 434
435## begin gnulib module stdalign
436
437BUILT_SOURCES += $(STDALIGN_H)
438
439# We need the following in order to create <stdalign.h> when the system
440# doesn't have one that works.
441if GL_GENERATE_STDALIGN_H
442stdalign.h: stdalign.in.h $(top_builddir)/config.status
443 $(AM_V_GEN)rm -f $@-t $@ && \
444 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
445 cat $(srcdir)/stdalign.in.h; \
446 } > $@-t && \
447 mv $@-t $@
448else
449stdalign.h: $(top_builddir)/config.status
450 rm -f $@
451endif
452MOSTLYCLEANFILES += stdalign.h stdalign.h-t
453
454EXTRA_DIST += stdalign.in.h
455
456## end gnulib module stdalign
457
433## begin gnulib module stdarg 458## begin gnulib module stdarg
434 459
435BUILT_SOURCES += $(STDARG_H) 460BUILT_SOURCES += $(STDARG_H)
@@ -599,7 +624,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
599 -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \ 624 -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
600 -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \ 625 -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
601 -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \ 626 -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
602 -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
603 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \ 627 -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
604 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \ 628 -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
605 -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \ 629 -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@@ -719,8 +743,11 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
719 -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \ 743 -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
720 -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \ 744 -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
721 -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \ 745 -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
746 -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
722 -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \ 747 -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
748 -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
723 -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \ 749 -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
750 -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
724 -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \ 751 -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
725 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \ 752 -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
726 -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \ 753 -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
@@ -745,7 +772,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
745 -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ 772 -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
746 -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \ 773 -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
747 -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ 774 -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
775 -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
748 -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \ 776 -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
777 -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
778 -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
749 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ 779 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
750 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ 780 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
751 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ 781 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -763,7 +793,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
763 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \ 793 -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
764 -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \ 794 -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
765 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ 795 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
796 -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
766 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ 797 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
798 -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
767 -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \ 799 -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
768 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ 800 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
769 -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ 801 -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
@@ -854,6 +886,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
854 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 886 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
855 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 887 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
856 -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ 888 -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
889 -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
857 -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \ 890 -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
858 -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \ 891 -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
859 -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \ 892 -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@@ -900,6 +933,31 @@ EXTRA_DIST += sys_stat.in.h
900 933
901## end gnulib module sys_stat 934## end gnulib module sys_stat
902 935
936## begin gnulib module sys_types
937
938BUILT_SOURCES += sys/types.h
939
940# We need the following in order to create <sys/types.h> when the system
941# doesn't have one that works with the given compiler.
942sys/types.h: sys_types.in.h $(top_builddir)/config.status
943 $(AM_V_at)$(MKDIR_P) sys
944 $(AM_V_GEN)rm -f $@-t $@ && \
945 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
946 sed -e 's|@''GUARD_PREFIX''@|GL|g' \
947 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
948 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
949 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
950 -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
951 -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
952 < $(srcdir)/sys_types.in.h; \
953 } > $@-t && \
954 mv $@-t $@
955MOSTLYCLEANFILES += sys/types.h sys/types.h-t
956
957EXTRA_DIST += sys_types.in.h
958
959## end gnulib module sys_types
960
903## begin gnulib module time 961## begin gnulib module time
904 962
905BUILT_SOURCES += time.h 963BUILT_SOURCES += time.h
@@ -973,6 +1031,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
973 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ 1031 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
974 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ 1032 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
975 -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ 1033 -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
1034 -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
976 -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \ 1035 -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
977 -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \ 1036 -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
978 -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \ 1037 -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@@ -997,6 +1056,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
997 -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ 1056 -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
998 -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ 1057 -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
999 -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ 1058 -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
1059 -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
1000 -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \ 1060 -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
1001 -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \ 1061 -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
1002 -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \ 1062 -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
@@ -1009,11 +1069,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
1009 -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \ 1069 -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
1010 -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \ 1070 -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
1011 -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \ 1071 -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
1072 -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
1012 -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \ 1073 -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
1013 -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \ 1074 -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
1014 -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \ 1075 -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
1015 -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \ 1076 -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
1016 -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \ 1077 -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
1017 -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \ 1078 -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
1018 -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \ 1079 -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
1019 -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \ 1080 -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
@@ -1046,6 +1107,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
1046 -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ 1107 -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
1047 -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ 1108 -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
1048 -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ 1109 -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
1110 -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
1049 -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ 1111 -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
1050 -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ 1112 -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
1051 -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ 1113 -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
@@ -1058,6 +1120,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
1058 -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ 1120 -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
1059 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ 1121 -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
1060 -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ 1122 -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
1123 -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
1061 -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ 1124 -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
1062 -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ 1125 -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
1063 -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ 1126 -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
@@ -1067,11 +1130,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
1067 -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ 1130 -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
1068 -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ 1131 -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
1069 -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ 1132 -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
1133 -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
1070 -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ 1134 -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
1071 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ 1135 -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
1072 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ 1136 -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
1073 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ 1137 -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
1074 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ 1138 -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
1139 -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
1075 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ 1140 -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
1076 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ 1141 -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
1077 -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ 1142 -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index f021a1ac8ea..2e344350946 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -1,6 +1,6 @@
1/* ignore a function return without a compiler warning 1/* ignore a function return without a compiler warning
2 2
3 Copyright (C) 2008-2011 Free Software Foundation, Inc. 3 Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -35,16 +35,6 @@
35#ifndef _GL_IGNORE_VALUE_H 35#ifndef _GL_IGNORE_VALUE_H
36# define _GL_IGNORE_VALUE_H 36# define _GL_IGNORE_VALUE_H
37 37
38# ifndef _GL_ATTRIBUTE_DEPRECATED
39/* The __attribute__((__deprecated__)) feature
40 is available in gcc versions 3.1 and newer. */
41# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
42# define _GL_ATTRIBUTE_DEPRECATED /* empty */
43# else
44# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
45# endif
46# endif
47
48/* The __attribute__((__warn_unused_result__)) feature 38/* The __attribute__((__warn_unused_result__)) feature
49 is available in gcc versions 3.4 and newer, 39 is available in gcc versions 3.4 and newer,
50 while the typeof feature has been available since 2.7 at least. */ 40 while the typeof feature has been available since 2.7 at least. */
@@ -54,9 +44,4 @@
54# define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; })) 44# define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
55# endif 45# endif
56 46
57/* ignore_value works for scalars, pointers and aggregates;
58 deprecate ignore_ptr. */
59static inline void _GL_ATTRIBUTE_DEPRECATED
60ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */
61
62#endif 47#endif
diff --git a/lib/intprops.h b/lib/intprops.h
index 1f6a539c183..2485c78d4ba 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -1,6 +1,6 @@
1/* intprops.h -- properties of integer types 1/* intprops.h -- properties of integer types
2 2
3 Copyright (C) 2001-2005, 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 2001-2005, 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 7abf39403f0..b9da2b5b091 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2006-2011 Free Software Foundation, Inc. 1/* Copyright (C) 2006-2012 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Derek Price. 2 Written by Paul Eggert, Bruno Haible, Derek Price.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 4
@@ -31,6 +31,12 @@
31 The include_next requires a split double-inclusion guard. */ 31 The include_next requires a split double-inclusion guard. */
32#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H 32#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
33# if @HAVE_INTTYPES_H@ 33# if @HAVE_INTTYPES_H@
34
35 /* Some pre-C++11 <stdint.h> implementations need this. */
36# if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
37# define __STDC_FORMAT_MACROS 1
38# endif
39
34# @INCLUDE_NEXT@ @NEXT_INTTYPES_H@ 40# @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
35# endif 41# endif
36#endif 42#endif
@@ -50,994 +56,992 @@
50# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>." 56# error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
51#endif 57#endif
52 58
59/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
60
53/* The definition of _GL_ARG_NONNULL is copied here. */ 61/* The definition of _GL_ARG_NONNULL is copied here. */
54 62
55/* The definition of _GL_WARN_ON_USE is copied here. */ 63/* The definition of _GL_WARN_ON_USE is copied here. */
56 64
57/* 7.8.1 Macros for format specifiers */ 65/* 7.8.1 Macros for format specifiers */
58 66
59#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS 67#if defined _TNS_R_TARGET
60
61# if defined _TNS_R_TARGET
62 /* Tandem NonStop R series and compatible platforms released before 68 /* Tandem NonStop R series and compatible platforms released before
63 July 2005 support %Ld but not %lld. */ 69 July 2005 support %Ld but not %lld. */
64# define _LONG_LONG_FORMAT_PREFIX "L" 70# define _LONG_LONG_FORMAT_PREFIX "L"
65# else 71#else
66# define _LONG_LONG_FORMAT_PREFIX "ll" 72# define _LONG_LONG_FORMAT_PREFIX "ll"
67# endif 73#endif
68 74
69# if !defined PRId8 || @PRI_MACROS_BROKEN@ 75#if !defined PRId8 || @PRI_MACROS_BROKEN@
70# undef PRId8 76# undef PRId8
71# ifdef INT8_MAX 77# ifdef INT8_MAX
72# define PRId8 "d" 78# define PRId8 "d"
73# endif
74# endif 79# endif
75# if !defined PRIi8 || @PRI_MACROS_BROKEN@ 80#endif
76# undef PRIi8 81#if !defined PRIi8 || @PRI_MACROS_BROKEN@
77# ifdef INT8_MAX 82# undef PRIi8
78# define PRIi8 "i" 83# ifdef INT8_MAX
79# endif 84# define PRIi8 "i"
80# endif 85# endif
81# if !defined PRIo8 || @PRI_MACROS_BROKEN@ 86#endif
82# undef PRIo8 87#if !defined PRIo8 || @PRI_MACROS_BROKEN@
83# ifdef UINT8_MAX 88# undef PRIo8
84# define PRIo8 "o" 89# ifdef UINT8_MAX
85# endif 90# define PRIo8 "o"
86# endif 91# endif
87# if !defined PRIu8 || @PRI_MACROS_BROKEN@ 92#endif
88# undef PRIu8 93#if !defined PRIu8 || @PRI_MACROS_BROKEN@
89# ifdef UINT8_MAX 94# undef PRIu8
90# define PRIu8 "u" 95# ifdef UINT8_MAX
91# endif 96# define PRIu8 "u"
92# endif 97# endif
93# if !defined PRIx8 || @PRI_MACROS_BROKEN@ 98#endif
94# undef PRIx8 99#if !defined PRIx8 || @PRI_MACROS_BROKEN@
95# ifdef UINT8_MAX 100# undef PRIx8
96# define PRIx8 "x" 101# ifdef UINT8_MAX
97# endif 102# define PRIx8 "x"
98# endif 103# endif
99# if !defined PRIX8 || @PRI_MACROS_BROKEN@ 104#endif
100# undef PRIX8 105#if !defined PRIX8 || @PRI_MACROS_BROKEN@
101# ifdef UINT8_MAX 106# undef PRIX8
102# define PRIX8 "X" 107# ifdef UINT8_MAX
103# endif 108# define PRIX8 "X"
104# endif 109# endif
105# if !defined PRId16 || @PRI_MACROS_BROKEN@ 110#endif
106# undef PRId16 111#if !defined PRId16 || @PRI_MACROS_BROKEN@
107# ifdef INT16_MAX 112# undef PRId16
108# define PRId16 "d" 113# ifdef INT16_MAX
109# endif 114# define PRId16 "d"
110# endif 115# endif
111# if !defined PRIi16 || @PRI_MACROS_BROKEN@ 116#endif
112# undef PRIi16 117#if !defined PRIi16 || @PRI_MACROS_BROKEN@
113# ifdef INT16_MAX 118# undef PRIi16
114# define PRIi16 "i" 119# ifdef INT16_MAX
115# endif 120# define PRIi16 "i"
116# endif 121# endif
117# if !defined PRIo16 || @PRI_MACROS_BROKEN@ 122#endif
118# undef PRIo16 123#if !defined PRIo16 || @PRI_MACROS_BROKEN@
119# ifdef UINT16_MAX 124# undef PRIo16
120# define PRIo16 "o" 125# ifdef UINT16_MAX
121# endif 126# define PRIo16 "o"
122# endif 127# endif
123# if !defined PRIu16 || @PRI_MACROS_BROKEN@ 128#endif
124# undef PRIu16 129#if !defined PRIu16 || @PRI_MACROS_BROKEN@
125# ifdef UINT16_MAX 130# undef PRIu16
126# define PRIu16 "u" 131# ifdef UINT16_MAX
127# endif 132# define PRIu16 "u"
128# endif 133# endif
129# if !defined PRIx16 || @PRI_MACROS_BROKEN@ 134#endif
130# undef PRIx16 135#if !defined PRIx16 || @PRI_MACROS_BROKEN@
131# ifdef UINT16_MAX 136# undef PRIx16
132# define PRIx16 "x" 137# ifdef UINT16_MAX
133# endif 138# define PRIx16 "x"
134# endif 139# endif
135# if !defined PRIX16 || @PRI_MACROS_BROKEN@ 140#endif
136# undef PRIX16 141#if !defined PRIX16 || @PRI_MACROS_BROKEN@
137# ifdef UINT16_MAX 142# undef PRIX16
138# define PRIX16 "X" 143# ifdef UINT16_MAX
139# endif 144# define PRIX16 "X"
140# endif 145# endif
141# if !defined PRId32 || @PRI_MACROS_BROKEN@ 146#endif
142# undef PRId32 147#if !defined PRId32 || @PRI_MACROS_BROKEN@
143# ifdef INT32_MAX 148# undef PRId32
144# define PRId32 "d" 149# ifdef INT32_MAX
145# endif 150# define PRId32 "d"
146# endif 151# endif
147# if !defined PRIi32 || @PRI_MACROS_BROKEN@ 152#endif
148# undef PRIi32 153#if !defined PRIi32 || @PRI_MACROS_BROKEN@
149# ifdef INT32_MAX 154# undef PRIi32
150# define PRIi32 "i" 155# ifdef INT32_MAX
151# endif 156# define PRIi32 "i"
152# endif 157# endif
153# if !defined PRIo32 || @PRI_MACROS_BROKEN@ 158#endif
154# undef PRIo32 159#if !defined PRIo32 || @PRI_MACROS_BROKEN@
155# ifdef UINT32_MAX 160# undef PRIo32
156# define PRIo32 "o" 161# ifdef UINT32_MAX
157# endif 162# define PRIo32 "o"
158# endif 163# endif
159# if !defined PRIu32 || @PRI_MACROS_BROKEN@ 164#endif
160# undef PRIu32 165#if !defined PRIu32 || @PRI_MACROS_BROKEN@
161# ifdef UINT32_MAX 166# undef PRIu32
162# define PRIu32 "u" 167# ifdef UINT32_MAX
163# endif 168# define PRIu32 "u"
164# endif 169# endif
165# if !defined PRIx32 || @PRI_MACROS_BROKEN@ 170#endif
166# undef PRIx32 171#if !defined PRIx32 || @PRI_MACROS_BROKEN@
167# ifdef UINT32_MAX 172# undef PRIx32
168# define PRIx32 "x" 173# ifdef UINT32_MAX
169# endif 174# define PRIx32 "x"
170# endif 175# endif
171# if !defined PRIX32 || @PRI_MACROS_BROKEN@ 176#endif
172# undef PRIX32 177#if !defined PRIX32 || @PRI_MACROS_BROKEN@
173# ifdef UINT32_MAX 178# undef PRIX32
174# define PRIX32 "X" 179# ifdef UINT32_MAX
175# endif 180# define PRIX32 "X"
176# endif 181# endif
177# ifdef INT64_MAX 182#endif
178# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) 183#ifdef INT64_MAX
179# define _PRI64_PREFIX "l" 184# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
180# elif defined _MSC_VER || defined __MINGW32__ 185# define _PRI64_PREFIX "l"
181# define _PRI64_PREFIX "I64" 186# elif defined _MSC_VER || defined __MINGW32__
182# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 187# define _PRI64_PREFIX "I64"
183# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX 188# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
184# endif 189# define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
185# if !defined PRId64 || @PRI_MACROS_BROKEN@ 190# endif
186# undef PRId64 191# if !defined PRId64 || @PRI_MACROS_BROKEN@
187# define PRId64 _PRI64_PREFIX "d" 192# undef PRId64
188# endif 193# define PRId64 _PRI64_PREFIX "d"
189# if !defined PRIi64 || @PRI_MACROS_BROKEN@ 194# endif
190# undef PRIi64 195# if !defined PRIi64 || @PRI_MACROS_BROKEN@
191# define PRIi64 _PRI64_PREFIX "i" 196# undef PRIi64
192# endif 197# define PRIi64 _PRI64_PREFIX "i"
193# endif 198# endif
194# ifdef UINT64_MAX 199#endif
195# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) 200#ifdef UINT64_MAX
196# define _PRIu64_PREFIX "l" 201# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
197# elif defined _MSC_VER || defined __MINGW32__ 202# define _PRIu64_PREFIX "l"
198# define _PRIu64_PREFIX "I64" 203# elif defined _MSC_VER || defined __MINGW32__
199# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 204# define _PRIu64_PREFIX "I64"
200# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX 205# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
201# endif 206# define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
202# if !defined PRIo64 || @PRI_MACROS_BROKEN@ 207# endif
203# undef PRIo64 208# if !defined PRIo64 || @PRI_MACROS_BROKEN@
204# define PRIo64 _PRIu64_PREFIX "o" 209# undef PRIo64
205# endif 210# define PRIo64 _PRIu64_PREFIX "o"
206# if !defined PRIu64 || @PRI_MACROS_BROKEN@ 211# endif
207# undef PRIu64 212# if !defined PRIu64 || @PRI_MACROS_BROKEN@
208# define PRIu64 _PRIu64_PREFIX "u" 213# undef PRIu64
209# endif 214# define PRIu64 _PRIu64_PREFIX "u"
210# if !defined PRIx64 || @PRI_MACROS_BROKEN@ 215# endif
211# undef PRIx64 216# if !defined PRIx64 || @PRI_MACROS_BROKEN@
212# define PRIx64 _PRIu64_PREFIX "x" 217# undef PRIx64
213# endif 218# define PRIx64 _PRIu64_PREFIX "x"
214# if !defined PRIX64 || @PRI_MACROS_BROKEN@ 219# endif
215# undef PRIX64 220# if !defined PRIX64 || @PRI_MACROS_BROKEN@
216# define PRIX64 _PRIu64_PREFIX "X" 221# undef PRIX64
217# endif 222# define PRIX64 _PRIu64_PREFIX "X"
218# endif 223# endif
224#endif
219 225
220# if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@ 226#if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
221# undef PRIdLEAST8 227# undef PRIdLEAST8
222# define PRIdLEAST8 "d" 228# define PRIdLEAST8 "d"
223# endif 229#endif
224# if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@ 230#if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
225# undef PRIiLEAST8 231# undef PRIiLEAST8
226# define PRIiLEAST8 "i" 232# define PRIiLEAST8 "i"
227# endif 233#endif
228# if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@ 234#if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
229# undef PRIoLEAST8 235# undef PRIoLEAST8
230# define PRIoLEAST8 "o" 236# define PRIoLEAST8 "o"
231# endif 237#endif
232# if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@ 238#if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
233# undef PRIuLEAST8 239# undef PRIuLEAST8
234# define PRIuLEAST8 "u" 240# define PRIuLEAST8 "u"
235# endif 241#endif
236# if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@ 242#if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
237# undef PRIxLEAST8 243# undef PRIxLEAST8
238# define PRIxLEAST8 "x" 244# define PRIxLEAST8 "x"
239# endif 245#endif
240# if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@ 246#if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
241# undef PRIXLEAST8 247# undef PRIXLEAST8
242# define PRIXLEAST8 "X" 248# define PRIXLEAST8 "X"
243# endif 249#endif
244# if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@ 250#if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
245# undef PRIdLEAST16 251# undef PRIdLEAST16
246# define PRIdLEAST16 "d" 252# define PRIdLEAST16 "d"
247# endif 253#endif
248# if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@ 254#if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
249# undef PRIiLEAST16 255# undef PRIiLEAST16
250# define PRIiLEAST16 "i" 256# define PRIiLEAST16 "i"
251# endif 257#endif
252# if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@ 258#if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
253# undef PRIoLEAST16 259# undef PRIoLEAST16
254# define PRIoLEAST16 "o" 260# define PRIoLEAST16 "o"
255# endif 261#endif
256# if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@ 262#if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
257# undef PRIuLEAST16 263# undef PRIuLEAST16
258# define PRIuLEAST16 "u" 264# define PRIuLEAST16 "u"
259# endif 265#endif
260# if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@ 266#if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
261# undef PRIxLEAST16 267# undef PRIxLEAST16
262# define PRIxLEAST16 "x" 268# define PRIxLEAST16 "x"
263# endif 269#endif
264# if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@ 270#if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
265# undef PRIXLEAST16 271# undef PRIXLEAST16
266# define PRIXLEAST16 "X" 272# define PRIXLEAST16 "X"
267# endif 273#endif
268# if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@ 274#if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
269# undef PRIdLEAST32 275# undef PRIdLEAST32
270# define PRIdLEAST32 "d" 276# define PRIdLEAST32 "d"
271# endif 277#endif
272# if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@ 278#if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
273# undef PRIiLEAST32 279# undef PRIiLEAST32
274# define PRIiLEAST32 "i" 280# define PRIiLEAST32 "i"
275# endif 281#endif
276# if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@ 282#if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
277# undef PRIoLEAST32 283# undef PRIoLEAST32
278# define PRIoLEAST32 "o" 284# define PRIoLEAST32 "o"
279# endif 285#endif
280# if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@ 286#if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
281# undef PRIuLEAST32 287# undef PRIuLEAST32
282# define PRIuLEAST32 "u" 288# define PRIuLEAST32 "u"
283# endif 289#endif
284# if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@ 290#if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
285# undef PRIxLEAST32 291# undef PRIxLEAST32
286# define PRIxLEAST32 "x" 292# define PRIxLEAST32 "x"
287# endif 293#endif
288# if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@ 294#if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
289# undef PRIXLEAST32 295# undef PRIXLEAST32
290# define PRIXLEAST32 "X" 296# define PRIXLEAST32 "X"
291# endif 297#endif
292# ifdef INT64_MAX 298#ifdef INT64_MAX
293# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@ 299# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
294# undef PRIdLEAST64 300# undef PRIdLEAST64
295# define PRIdLEAST64 PRId64 301# define PRIdLEAST64 PRId64
296# endif
297# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
298# undef PRIiLEAST64
299# define PRIiLEAST64 PRIi64
300# endif
301# endif 302# endif
302# ifdef UINT64_MAX 303# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
303# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@ 304# undef PRIiLEAST64
304# undef PRIoLEAST64 305# define PRIiLEAST64 PRIi64
305# define PRIoLEAST64 PRIo64 306# endif
306# endif 307#endif
307# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@ 308#ifdef UINT64_MAX
308# undef PRIuLEAST64 309# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
309# define PRIuLEAST64 PRIu64 310# undef PRIoLEAST64
310# endif 311# define PRIoLEAST64 PRIo64
311# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@ 312# endif
312# undef PRIxLEAST64 313# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
313# define PRIxLEAST64 PRIx64 314# undef PRIuLEAST64
314# endif 315# define PRIuLEAST64 PRIu64
315# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@ 316# endif
316# undef PRIXLEAST64 317# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
317# define PRIXLEAST64 PRIX64 318# undef PRIxLEAST64
318# endif 319# define PRIxLEAST64 PRIx64
319# endif 320# endif
321# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
322# undef PRIXLEAST64
323# define PRIXLEAST64 PRIX64
324# endif
325#endif
320 326
321# if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@ 327#if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
322# undef PRIdFAST8 328# undef PRIdFAST8
323# if INT_FAST8_MAX > INT32_MAX 329# if INT_FAST8_MAX > INT32_MAX
324# define PRIdFAST8 PRId64 330# define PRIdFAST8 PRId64
325# else 331# else
326# define PRIdFAST8 "d" 332# define PRIdFAST8 "d"
327# endif
328# endif 333# endif
329# if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@ 334#endif
330# undef PRIiFAST8 335#if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
331# if INT_FAST8_MAX > INT32_MAX 336# undef PRIiFAST8
332# define PRIiFAST8 PRIi64 337# if INT_FAST8_MAX > INT32_MAX
333# else 338# define PRIiFAST8 PRIi64
334# define PRIiFAST8 "i" 339# else
335# endif 340# define PRIiFAST8 "i"
336# endif 341# endif
337# if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@ 342#endif
338# undef PRIoFAST8 343#if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
339# if UINT_FAST8_MAX > UINT32_MAX 344# undef PRIoFAST8
340# define PRIoFAST8 PRIo64 345# if UINT_FAST8_MAX > UINT32_MAX
341# else 346# define PRIoFAST8 PRIo64
342# define PRIoFAST8 "o" 347# else
343# endif 348# define PRIoFAST8 "o"
344# endif 349# endif
345# if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@ 350#endif
346# undef PRIuFAST8 351#if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
347# if UINT_FAST8_MAX > UINT32_MAX 352# undef PRIuFAST8
348# define PRIuFAST8 PRIu64 353# if UINT_FAST8_MAX > UINT32_MAX
349# else 354# define PRIuFAST8 PRIu64
350# define PRIuFAST8 "u" 355# else
351# endif 356# define PRIuFAST8 "u"
352# endif 357# endif
353# if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@ 358#endif
354# undef PRIxFAST8 359#if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
355# if UINT_FAST8_MAX > UINT32_MAX 360# undef PRIxFAST8
356# define PRIxFAST8 PRIx64 361# if UINT_FAST8_MAX > UINT32_MAX
357# else 362# define PRIxFAST8 PRIx64
358# define PRIxFAST8 "x" 363# else
359# endif 364# define PRIxFAST8 "x"
360# endif 365# endif
361# if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@ 366#endif
362# undef PRIXFAST8 367#if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
363# if UINT_FAST8_MAX > UINT32_MAX 368# undef PRIXFAST8
364# define PRIXFAST8 PRIX64 369# if UINT_FAST8_MAX > UINT32_MAX
365# else 370# define PRIXFAST8 PRIX64
366# define PRIXFAST8 "X" 371# else
367# endif 372# define PRIXFAST8 "X"
368# endif 373# endif
369# if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@ 374#endif
370# undef PRIdFAST16 375#if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
371# if INT_FAST16_MAX > INT32_MAX 376# undef PRIdFAST16
372# define PRIdFAST16 PRId64 377# if INT_FAST16_MAX > INT32_MAX
373# else 378# define PRIdFAST16 PRId64
374# define PRIdFAST16 "d" 379# else
375# endif 380# define PRIdFAST16 "d"
376# endif 381# endif
377# if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@ 382#endif
378# undef PRIiFAST16 383#if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
379# if INT_FAST16_MAX > INT32_MAX 384# undef PRIiFAST16
380# define PRIiFAST16 PRIi64 385# if INT_FAST16_MAX > INT32_MAX
381# else 386# define PRIiFAST16 PRIi64
382# define PRIiFAST16 "i" 387# else
383# endif 388# define PRIiFAST16 "i"
384# endif 389# endif
385# if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@ 390#endif
386# undef PRIoFAST16 391#if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
387# if UINT_FAST16_MAX > UINT32_MAX 392# undef PRIoFAST16
388# define PRIoFAST16 PRIo64 393# if UINT_FAST16_MAX > UINT32_MAX
389# else 394# define PRIoFAST16 PRIo64
390# define PRIoFAST16 "o" 395# else
391# endif 396# define PRIoFAST16 "o"
392# endif 397# endif
393# if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@ 398#endif
394# undef PRIuFAST16 399#if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
395# if UINT_FAST16_MAX > UINT32_MAX 400# undef PRIuFAST16
396# define PRIuFAST16 PRIu64 401# if UINT_FAST16_MAX > UINT32_MAX
397# else 402# define PRIuFAST16 PRIu64
398# define PRIuFAST16 "u" 403# else
399# endif 404# define PRIuFAST16 "u"
400# endif 405# endif
401# if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@ 406#endif
402# undef PRIxFAST16 407#if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
403# if UINT_FAST16_MAX > UINT32_MAX 408# undef PRIxFAST16
404# define PRIxFAST16 PRIx64 409# if UINT_FAST16_MAX > UINT32_MAX
405# else 410# define PRIxFAST16 PRIx64
406# define PRIxFAST16 "x" 411# else
407# endif 412# define PRIxFAST16 "x"
408# endif 413# endif
409# if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@ 414#endif
410# undef PRIXFAST16 415#if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
411# if UINT_FAST16_MAX > UINT32_MAX 416# undef PRIXFAST16
412# define PRIXFAST16 PRIX64 417# if UINT_FAST16_MAX > UINT32_MAX
413# else 418# define PRIXFAST16 PRIX64
414# define PRIXFAST16 "X" 419# else
415# endif 420# define PRIXFAST16 "X"
416# endif 421# endif
417# if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@ 422#endif
418# undef PRIdFAST32 423#if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
419# if INT_FAST32_MAX > INT32_MAX 424# undef PRIdFAST32
420# define PRIdFAST32 PRId64 425# if INT_FAST32_MAX > INT32_MAX
421# else 426# define PRIdFAST32 PRId64
422# define PRIdFAST32 "d" 427# else
423# endif 428# define PRIdFAST32 "d"
424# endif 429# endif
425# if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@ 430#endif
426# undef PRIiFAST32 431#if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
427# if INT_FAST32_MAX > INT32_MAX 432# undef PRIiFAST32
428# define PRIiFAST32 PRIi64 433# if INT_FAST32_MAX > INT32_MAX
429# else 434# define PRIiFAST32 PRIi64
430# define PRIiFAST32 "i" 435# else
431# endif 436# define PRIiFAST32 "i"
432# endif 437# endif
433# if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@ 438#endif
434# undef PRIoFAST32 439#if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
435# if UINT_FAST32_MAX > UINT32_MAX 440# undef PRIoFAST32
436# define PRIoFAST32 PRIo64 441# if UINT_FAST32_MAX > UINT32_MAX
437# else 442# define PRIoFAST32 PRIo64
438# define PRIoFAST32 "o" 443# else
439# endif 444# define PRIoFAST32 "o"
440# endif 445# endif
441# if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@ 446#endif
442# undef PRIuFAST32 447#if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
443# if UINT_FAST32_MAX > UINT32_MAX 448# undef PRIuFAST32
444# define PRIuFAST32 PRIu64 449# if UINT_FAST32_MAX > UINT32_MAX
445# else 450# define PRIuFAST32 PRIu64
446# define PRIuFAST32 "u" 451# else
447# endif 452# define PRIuFAST32 "u"
448# endif 453# endif
449# if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@ 454#endif
450# undef PRIxFAST32 455#if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
451# if UINT_FAST32_MAX > UINT32_MAX 456# undef PRIxFAST32
452# define PRIxFAST32 PRIx64 457# if UINT_FAST32_MAX > UINT32_MAX
453# else 458# define PRIxFAST32 PRIx64
454# define PRIxFAST32 "x" 459# else
455# endif 460# define PRIxFAST32 "x"
456# endif 461# endif
457# if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@ 462#endif
458# undef PRIXFAST32 463#if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
459# if UINT_FAST32_MAX > UINT32_MAX 464# undef PRIXFAST32
460# define PRIXFAST32 PRIX64 465# if UINT_FAST32_MAX > UINT32_MAX
461# else 466# define PRIXFAST32 PRIX64
462# define PRIXFAST32 "X" 467# else
463# endif 468# define PRIXFAST32 "X"
464# endif 469# endif
465# ifdef INT64_MAX 470#endif
466# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@ 471#ifdef INT64_MAX
467# undef PRIdFAST64 472# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
468# define PRIdFAST64 PRId64 473# undef PRIdFAST64
469# endif 474# define PRIdFAST64 PRId64
470# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
471# undef PRIiFAST64
472# define PRIiFAST64 PRIi64
473# endif
474# endif 475# endif
475# ifdef UINT64_MAX 476# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
476# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@ 477# undef PRIiFAST64
477# undef PRIoFAST64 478# define PRIiFAST64 PRIi64
478# define PRIoFAST64 PRIo64 479# endif
479# endif 480#endif
480# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@ 481#ifdef UINT64_MAX
481# undef PRIuFAST64 482# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
482# define PRIuFAST64 PRIu64 483# undef PRIoFAST64
483# endif 484# define PRIoFAST64 PRIo64
484# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@ 485# endif
485# undef PRIxFAST64 486# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
486# define PRIxFAST64 PRIx64 487# undef PRIuFAST64
487# endif 488# define PRIuFAST64 PRIu64
488# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@ 489# endif
489# undef PRIXFAST64 490# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
490# define PRIXFAST64 PRIX64 491# undef PRIxFAST64
491# endif 492# define PRIxFAST64 PRIx64
492# endif 493# endif
494# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
495# undef PRIXFAST64
496# define PRIXFAST64 PRIX64
497# endif
498#endif
493 499
494# if !defined PRIdMAX || @PRI_MACROS_BROKEN@ 500#if !defined PRIdMAX || @PRI_MACROS_BROKEN@
495# undef PRIdMAX 501# undef PRIdMAX
496# if @INT32_MAX_LT_INTMAX_MAX@ 502# if @INT32_MAX_LT_INTMAX_MAX@
497# define PRIdMAX PRId64 503# define PRIdMAX PRId64
498# else 504# else
499# define PRIdMAX "ld" 505# define PRIdMAX "ld"
500# endif
501# endif 506# endif
502# if !defined PRIiMAX || @PRI_MACROS_BROKEN@ 507#endif
503# undef PRIiMAX 508#if !defined PRIiMAX || @PRI_MACROS_BROKEN@
504# if @INT32_MAX_LT_INTMAX_MAX@ 509# undef PRIiMAX
505# define PRIiMAX PRIi64 510# if @INT32_MAX_LT_INTMAX_MAX@
506# else 511# define PRIiMAX PRIi64
507# define PRIiMAX "li" 512# else
508# endif 513# define PRIiMAX "li"
509# endif 514# endif
510# if !defined PRIoMAX || @PRI_MACROS_BROKEN@ 515#endif
511# undef PRIoMAX 516#if !defined PRIoMAX || @PRI_MACROS_BROKEN@
512# if @UINT32_MAX_LT_UINTMAX_MAX@ 517# undef PRIoMAX
513# define PRIoMAX PRIo64 518# if @UINT32_MAX_LT_UINTMAX_MAX@
514# else 519# define PRIoMAX PRIo64
515# define PRIoMAX "lo" 520# else
516# endif 521# define PRIoMAX "lo"
517# endif 522# endif
518# if !defined PRIuMAX || @PRI_MACROS_BROKEN@ 523#endif
519# undef PRIuMAX 524#if !defined PRIuMAX || @PRI_MACROS_BROKEN@
520# if @UINT32_MAX_LT_UINTMAX_MAX@ 525# undef PRIuMAX
521# define PRIuMAX PRIu64 526# if @UINT32_MAX_LT_UINTMAX_MAX@
522# else 527# define PRIuMAX PRIu64
523# define PRIuMAX "lu" 528# else
524# endif 529# define PRIuMAX "lu"
525# endif 530# endif
526# if !defined PRIxMAX || @PRI_MACROS_BROKEN@ 531#endif
527# undef PRIxMAX 532#if !defined PRIxMAX || @PRI_MACROS_BROKEN@
528# if @UINT32_MAX_LT_UINTMAX_MAX@ 533# undef PRIxMAX
529# define PRIxMAX PRIx64 534# if @UINT32_MAX_LT_UINTMAX_MAX@
530# else 535# define PRIxMAX PRIx64
531# define PRIxMAX "lx" 536# else
532# endif 537# define PRIxMAX "lx"
533# endif 538# endif
534# if !defined PRIXMAX || @PRI_MACROS_BROKEN@ 539#endif
535# undef PRIXMAX 540#if !defined PRIXMAX || @PRI_MACROS_BROKEN@
536# if @UINT32_MAX_LT_UINTMAX_MAX@ 541# undef PRIXMAX
537# define PRIXMAX PRIX64 542# if @UINT32_MAX_LT_UINTMAX_MAX@
538# else 543# define PRIXMAX PRIX64
539# define PRIXMAX "lX" 544# else
540# endif 545# define PRIXMAX "lX"
541# endif 546# endif
547#endif
542 548
543# if !defined PRIdPTR || @PRI_MACROS_BROKEN@ 549#if !defined PRIdPTR || @PRI_MACROS_BROKEN@
544# undef PRIdPTR 550# undef PRIdPTR
545# ifdef INTPTR_MAX 551# ifdef INTPTR_MAX
546# define PRIdPTR @PRIPTR_PREFIX@ "d" 552# define PRIdPTR @PRIPTR_PREFIX@ "d"
547# endif
548# endif 553# endif
549# if !defined PRIiPTR || @PRI_MACROS_BROKEN@ 554#endif
550# undef PRIiPTR 555#if !defined PRIiPTR || @PRI_MACROS_BROKEN@
551# ifdef INTPTR_MAX 556# undef PRIiPTR
552# define PRIiPTR @PRIPTR_PREFIX@ "i" 557# ifdef INTPTR_MAX
553# endif 558# define PRIiPTR @PRIPTR_PREFIX@ "i"
554# endif 559# endif
555# if !defined PRIoPTR || @PRI_MACROS_BROKEN@ 560#endif
556# undef PRIoPTR 561#if !defined PRIoPTR || @PRI_MACROS_BROKEN@
557# ifdef UINTPTR_MAX 562# undef PRIoPTR
558# define PRIoPTR @PRIPTR_PREFIX@ "o" 563# ifdef UINTPTR_MAX
559# endif 564# define PRIoPTR @PRIPTR_PREFIX@ "o"
560# endif 565# endif
561# if !defined PRIuPTR || @PRI_MACROS_BROKEN@ 566#endif
562# undef PRIuPTR 567#if !defined PRIuPTR || @PRI_MACROS_BROKEN@
563# ifdef UINTPTR_MAX 568# undef PRIuPTR
564# define PRIuPTR @PRIPTR_PREFIX@ "u" 569# ifdef UINTPTR_MAX
565# endif 570# define PRIuPTR @PRIPTR_PREFIX@ "u"
566# endif 571# endif
567# if !defined PRIxPTR || @PRI_MACROS_BROKEN@ 572#endif
568# undef PRIxPTR 573#if !defined PRIxPTR || @PRI_MACROS_BROKEN@
569# ifdef UINTPTR_MAX 574# undef PRIxPTR
570# define PRIxPTR @PRIPTR_PREFIX@ "x" 575# ifdef UINTPTR_MAX
571# endif 576# define PRIxPTR @PRIPTR_PREFIX@ "x"
572# endif 577# endif
573# if !defined PRIXPTR || @PRI_MACROS_BROKEN@ 578#endif
574# undef PRIXPTR 579#if !defined PRIXPTR || @PRI_MACROS_BROKEN@
575# ifdef UINTPTR_MAX 580# undef PRIXPTR
576# define PRIXPTR @PRIPTR_PREFIX@ "X" 581# ifdef UINTPTR_MAX
577# endif 582# define PRIXPTR @PRIPTR_PREFIX@ "X"
578# endif 583# endif
584#endif
579 585
580# if !defined SCNd8 || @PRI_MACROS_BROKEN@ 586#if !defined SCNd8 || @PRI_MACROS_BROKEN@
581# undef SCNd8 587# undef SCNd8
582# ifdef INT8_MAX 588# ifdef INT8_MAX
583# define SCNd8 "hhd" 589# define SCNd8 "hhd"
584# endif
585# endif 590# endif
586# if !defined SCNi8 || @PRI_MACROS_BROKEN@ 591#endif
587# undef SCNi8 592#if !defined SCNi8 || @PRI_MACROS_BROKEN@
588# ifdef INT8_MAX 593# undef SCNi8
589# define SCNi8 "hhi" 594# ifdef INT8_MAX
590# endif 595# define SCNi8 "hhi"
591# endif 596# endif
592# if !defined SCNo8 || @PRI_MACROS_BROKEN@ 597#endif
593# undef SCNo8 598#if !defined SCNo8 || @PRI_MACROS_BROKEN@
594# ifdef UINT8_MAX 599# undef SCNo8
595# define SCNo8 "hho" 600# ifdef UINT8_MAX
596# endif 601# define SCNo8 "hho"
597# endif 602# endif
598# if !defined SCNu8 || @PRI_MACROS_BROKEN@ 603#endif
599# undef SCNu8 604#if !defined SCNu8 || @PRI_MACROS_BROKEN@
600# ifdef UINT8_MAX 605# undef SCNu8
601# define SCNu8 "hhu" 606# ifdef UINT8_MAX
602# endif 607# define SCNu8 "hhu"
603# endif 608# endif
604# if !defined SCNx8 || @PRI_MACROS_BROKEN@ 609#endif
605# undef SCNx8 610#if !defined SCNx8 || @PRI_MACROS_BROKEN@
606# ifdef UINT8_MAX 611# undef SCNx8
607# define SCNx8 "hhx" 612# ifdef UINT8_MAX
608# endif 613# define SCNx8 "hhx"
609# endif 614# endif
610# if !defined SCNd16 || @PRI_MACROS_BROKEN@ 615#endif
611# undef SCNd16 616#if !defined SCNd16 || @PRI_MACROS_BROKEN@
612# ifdef INT16_MAX 617# undef SCNd16
613# define SCNd16 "hd" 618# ifdef INT16_MAX
614# endif 619# define SCNd16 "hd"
615# endif 620# endif
616# if !defined SCNi16 || @PRI_MACROS_BROKEN@ 621#endif
617# undef SCNi16 622#if !defined SCNi16 || @PRI_MACROS_BROKEN@
618# ifdef INT16_MAX 623# undef SCNi16
619# define SCNi16 "hi" 624# ifdef INT16_MAX
620# endif 625# define SCNi16 "hi"
621# endif 626# endif
622# if !defined SCNo16 || @PRI_MACROS_BROKEN@ 627#endif
623# undef SCNo16 628#if !defined SCNo16 || @PRI_MACROS_BROKEN@
624# ifdef UINT16_MAX 629# undef SCNo16
625# define SCNo16 "ho" 630# ifdef UINT16_MAX
626# endif 631# define SCNo16 "ho"
627# endif 632# endif
628# if !defined SCNu16 || @PRI_MACROS_BROKEN@ 633#endif
629# undef SCNu16 634#if !defined SCNu16 || @PRI_MACROS_BROKEN@
630# ifdef UINT16_MAX 635# undef SCNu16
631# define SCNu16 "hu" 636# ifdef UINT16_MAX
632# endif 637# define SCNu16 "hu"
633# endif 638# endif
634# if !defined SCNx16 || @PRI_MACROS_BROKEN@ 639#endif
635# undef SCNx16 640#if !defined SCNx16 || @PRI_MACROS_BROKEN@
636# ifdef UINT16_MAX 641# undef SCNx16
637# define SCNx16 "hx" 642# ifdef UINT16_MAX
638# endif 643# define SCNx16 "hx"
639# endif 644# endif
640# if !defined SCNd32 || @PRI_MACROS_BROKEN@ 645#endif
641# undef SCNd32 646#if !defined SCNd32 || @PRI_MACROS_BROKEN@
642# ifdef INT32_MAX 647# undef SCNd32
643# define SCNd32 "d" 648# ifdef INT32_MAX
644# endif 649# define SCNd32 "d"
645# endif 650# endif
646# if !defined SCNi32 || @PRI_MACROS_BROKEN@ 651#endif
647# undef SCNi32 652#if !defined SCNi32 || @PRI_MACROS_BROKEN@
648# ifdef INT32_MAX 653# undef SCNi32
649# define SCNi32 "i" 654# ifdef INT32_MAX
650# endif 655# define SCNi32 "i"
651# endif 656# endif
652# if !defined SCNo32 || @PRI_MACROS_BROKEN@ 657#endif
653# undef SCNo32 658#if !defined SCNo32 || @PRI_MACROS_BROKEN@
654# ifdef UINT32_MAX 659# undef SCNo32
655# define SCNo32 "o" 660# ifdef UINT32_MAX
656# endif 661# define SCNo32 "o"
657# endif 662# endif
658# if !defined SCNu32 || @PRI_MACROS_BROKEN@ 663#endif
659# undef SCNu32 664#if !defined SCNu32 || @PRI_MACROS_BROKEN@
660# ifdef UINT32_MAX 665# undef SCNu32
661# define SCNu32 "u" 666# ifdef UINT32_MAX
662# endif 667# define SCNu32 "u"
663# endif 668# endif
664# if !defined SCNx32 || @PRI_MACROS_BROKEN@ 669#endif
665# undef SCNx32 670#if !defined SCNx32 || @PRI_MACROS_BROKEN@
666# ifdef UINT32_MAX 671# undef SCNx32
667# define SCNx32 "x" 672# ifdef UINT32_MAX
668# endif 673# define SCNx32 "x"
669# endif 674# endif
670# ifdef INT64_MAX 675#endif
671# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@) 676#ifdef INT64_MAX
672# define _SCN64_PREFIX "l" 677# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
673# elif defined _MSC_VER || defined __MINGW32__ 678# define _SCN64_PREFIX "l"
674# define _SCN64_PREFIX "I64" 679# elif defined _MSC_VER || defined __MINGW32__
675# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 680# define _SCN64_PREFIX "I64"
676# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX 681# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
677# endif 682# define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
678# if !defined SCNd64 || @PRI_MACROS_BROKEN@ 683# endif
679# undef SCNd64 684# if !defined SCNd64 || @PRI_MACROS_BROKEN@
680# define SCNd64 _SCN64_PREFIX "d" 685# undef SCNd64
681# endif 686# define SCNd64 _SCN64_PREFIX "d"
682# if !defined SCNi64 || @PRI_MACROS_BROKEN@ 687# endif
683# undef SCNi64 688# if !defined SCNi64 || @PRI_MACROS_BROKEN@
684# define SCNi64 _SCN64_PREFIX "i" 689# undef SCNi64
685# endif 690# define SCNi64 _SCN64_PREFIX "i"
686# endif 691# endif
687# ifdef UINT64_MAX 692#endif
688# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@) 693#ifdef UINT64_MAX
689# define _SCNu64_PREFIX "l" 694# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
690# elif defined _MSC_VER || defined __MINGW32__ 695# define _SCNu64_PREFIX "l"
691# define _SCNu64_PREFIX "I64" 696# elif defined _MSC_VER || defined __MINGW32__
692# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 697# define _SCNu64_PREFIX "I64"
693# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX 698# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
694# endif 699# define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
695# if !defined SCNo64 || @PRI_MACROS_BROKEN@ 700# endif
696# undef SCNo64 701# if !defined SCNo64 || @PRI_MACROS_BROKEN@
697# define SCNo64 _SCNu64_PREFIX "o" 702# undef SCNo64
698# endif 703# define SCNo64 _SCNu64_PREFIX "o"
699# if !defined SCNu64 || @PRI_MACROS_BROKEN@ 704# endif
700# undef SCNu64 705# if !defined SCNu64 || @PRI_MACROS_BROKEN@
701# define SCNu64 _SCNu64_PREFIX "u" 706# undef SCNu64
702# endif 707# define SCNu64 _SCNu64_PREFIX "u"
703# if !defined SCNx64 || @PRI_MACROS_BROKEN@ 708# endif
704# undef SCNx64 709# if !defined SCNx64 || @PRI_MACROS_BROKEN@
705# define SCNx64 _SCNu64_PREFIX "x" 710# undef SCNx64
706# endif 711# define SCNx64 _SCNu64_PREFIX "x"
707# endif 712# endif
713#endif
708 714
709# if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@ 715#if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
710# undef SCNdLEAST8 716# undef SCNdLEAST8
711# define SCNdLEAST8 "hhd" 717# define SCNdLEAST8 "hhd"
712# endif 718#endif
713# if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@ 719#if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
714# undef SCNiLEAST8 720# undef SCNiLEAST8
715# define SCNiLEAST8 "hhi" 721# define SCNiLEAST8 "hhi"
716# endif 722#endif
717# if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@ 723#if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
718# undef SCNoLEAST8 724# undef SCNoLEAST8
719# define SCNoLEAST8 "hho" 725# define SCNoLEAST8 "hho"
720# endif 726#endif
721# if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@ 727#if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
722# undef SCNuLEAST8 728# undef SCNuLEAST8
723# define SCNuLEAST8 "hhu" 729# define SCNuLEAST8 "hhu"
724# endif 730#endif
725# if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@ 731#if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
726# undef SCNxLEAST8 732# undef SCNxLEAST8
727# define SCNxLEAST8 "hhx" 733# define SCNxLEAST8 "hhx"
728# endif 734#endif
729# if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@ 735#if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
730# undef SCNdLEAST16 736# undef SCNdLEAST16
731# define SCNdLEAST16 "hd" 737# define SCNdLEAST16 "hd"
732# endif 738#endif
733# if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@ 739#if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
734# undef SCNiLEAST16 740# undef SCNiLEAST16
735# define SCNiLEAST16 "hi" 741# define SCNiLEAST16 "hi"
736# endif 742#endif
737# if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@ 743#if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
738# undef SCNoLEAST16 744# undef SCNoLEAST16
739# define SCNoLEAST16 "ho" 745# define SCNoLEAST16 "ho"
740# endif 746#endif
741# if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@ 747#if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
742# undef SCNuLEAST16 748# undef SCNuLEAST16
743# define SCNuLEAST16 "hu" 749# define SCNuLEAST16 "hu"
744# endif 750#endif
745# if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@ 751#if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
746# undef SCNxLEAST16 752# undef SCNxLEAST16
747# define SCNxLEAST16 "hx" 753# define SCNxLEAST16 "hx"
748# endif 754#endif
749# if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@ 755#if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
750# undef SCNdLEAST32 756# undef SCNdLEAST32
751# define SCNdLEAST32 "d" 757# define SCNdLEAST32 "d"
752# endif 758#endif
753# if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@ 759#if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
754# undef SCNiLEAST32 760# undef SCNiLEAST32
755# define SCNiLEAST32 "i" 761# define SCNiLEAST32 "i"
756# endif 762#endif
757# if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@ 763#if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
758# undef SCNoLEAST32 764# undef SCNoLEAST32
759# define SCNoLEAST32 "o" 765# define SCNoLEAST32 "o"
760# endif 766#endif
761# if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@ 767#if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
762# undef SCNuLEAST32 768# undef SCNuLEAST32
763# define SCNuLEAST32 "u" 769# define SCNuLEAST32 "u"
764# endif 770#endif
765# if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@ 771#if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
766# undef SCNxLEAST32 772# undef SCNxLEAST32
767# define SCNxLEAST32 "x" 773# define SCNxLEAST32 "x"
768# endif 774#endif
769# ifdef INT64_MAX 775#ifdef INT64_MAX
770# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@ 776# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
771# undef SCNdLEAST64 777# undef SCNdLEAST64
772# define SCNdLEAST64 SCNd64 778# define SCNdLEAST64 SCNd64
773# endif
774# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
775# undef SCNiLEAST64
776# define SCNiLEAST64 SCNi64
777# endif
778# endif 779# endif
779# ifdef UINT64_MAX 780# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
780# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@ 781# undef SCNiLEAST64
781# undef SCNoLEAST64 782# define SCNiLEAST64 SCNi64
782# define SCNoLEAST64 SCNo64 783# endif
783# endif 784#endif
784# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@ 785#ifdef UINT64_MAX
785# undef SCNuLEAST64 786# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
786# define SCNuLEAST64 SCNu64 787# undef SCNoLEAST64
787# endif 788# define SCNoLEAST64 SCNo64
788# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@ 789# endif
789# undef SCNxLEAST64 790# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
790# define SCNxLEAST64 SCNx64 791# undef SCNuLEAST64
791# endif 792# define SCNuLEAST64 SCNu64
793# endif
794# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
795# undef SCNxLEAST64
796# define SCNxLEAST64 SCNx64
792# endif 797# endif
798#endif
793 799
794# if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@ 800#if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
795# undef SCNdFAST8 801# undef SCNdFAST8
796# if INT_FAST8_MAX > INT32_MAX 802# if INT_FAST8_MAX > INT32_MAX
797# define SCNdFAST8 SCNd64 803# define SCNdFAST8 SCNd64
798# elif INT_FAST8_MAX == 0x7fff 804# elif INT_FAST8_MAX == 0x7fff
799# define SCNdFAST8 "hd" 805# define SCNdFAST8 "hd"
800# elif INT_FAST8_MAX == 0x7f 806# elif INT_FAST8_MAX == 0x7f
801# define SCNdFAST8 "hhd" 807# define SCNdFAST8 "hhd"
802# else 808# else
803# define SCNdFAST8 "d" 809# define SCNdFAST8 "d"
804# endif
805# endif 810# endif
806# if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@ 811#endif
807# undef SCNiFAST8 812#if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
808# if INT_FAST8_MAX > INT32_MAX 813# undef SCNiFAST8
809# define SCNiFAST8 SCNi64 814# if INT_FAST8_MAX > INT32_MAX
810# elif INT_FAST8_MAX == 0x7fff 815# define SCNiFAST8 SCNi64
811# define SCNiFAST8 "hi" 816# elif INT_FAST8_MAX == 0x7fff
812# elif INT_FAST8_MAX == 0x7f 817# define SCNiFAST8 "hi"
813# define SCNiFAST8 "hhi" 818# elif INT_FAST8_MAX == 0x7f
814# else 819# define SCNiFAST8 "hhi"
815# define SCNiFAST8 "i" 820# else
816# endif 821# define SCNiFAST8 "i"
817# endif 822# endif
818# if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@ 823#endif
819# undef SCNoFAST8 824#if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
820# if UINT_FAST8_MAX > UINT32_MAX 825# undef SCNoFAST8
821# define SCNoFAST8 SCNo64 826# if UINT_FAST8_MAX > UINT32_MAX
822# elif UINT_FAST8_MAX == 0xffff 827# define SCNoFAST8 SCNo64
823# define SCNoFAST8 "ho" 828# elif UINT_FAST8_MAX == 0xffff
824# elif UINT_FAST8_MAX == 0xff 829# define SCNoFAST8 "ho"
825# define SCNoFAST8 "hho" 830# elif UINT_FAST8_MAX == 0xff
826# else 831# define SCNoFAST8 "hho"
827# define SCNoFAST8 "o" 832# else
828# endif 833# define SCNoFAST8 "o"
829# endif 834# endif
830# if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@ 835#endif
831# undef SCNuFAST8 836#if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
832# if UINT_FAST8_MAX > UINT32_MAX 837# undef SCNuFAST8
833# define SCNuFAST8 SCNu64 838# if UINT_FAST8_MAX > UINT32_MAX
834# elif UINT_FAST8_MAX == 0xffff 839# define SCNuFAST8 SCNu64
835# define SCNuFAST8 "hu" 840# elif UINT_FAST8_MAX == 0xffff
836# elif UINT_FAST8_MAX == 0xff 841# define SCNuFAST8 "hu"
837# define SCNuFAST8 "hhu" 842# elif UINT_FAST8_MAX == 0xff
838# else 843# define SCNuFAST8 "hhu"
839# define SCNuFAST8 "u" 844# else
840# endif 845# define SCNuFAST8 "u"
841# endif 846# endif
842# if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@ 847#endif
843# undef SCNxFAST8 848#if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
844# if UINT_FAST8_MAX > UINT32_MAX 849# undef SCNxFAST8
845# define SCNxFAST8 SCNx64 850# if UINT_FAST8_MAX > UINT32_MAX
846# elif UINT_FAST8_MAX == 0xffff 851# define SCNxFAST8 SCNx64
847# define SCNxFAST8 "hx" 852# elif UINT_FAST8_MAX == 0xffff
848# elif UINT_FAST8_MAX == 0xff 853# define SCNxFAST8 "hx"
849# define SCNxFAST8 "hhx" 854# elif UINT_FAST8_MAX == 0xff
850# else 855# define SCNxFAST8 "hhx"
851# define SCNxFAST8 "x" 856# else
852# endif 857# define SCNxFAST8 "x"
853# endif 858# endif
854# if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@ 859#endif
855# undef SCNdFAST16 860#if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
856# if INT_FAST16_MAX > INT32_MAX 861# undef SCNdFAST16
857# define SCNdFAST16 SCNd64 862# if INT_FAST16_MAX > INT32_MAX
858# elif INT_FAST16_MAX == 0x7fff 863# define SCNdFAST16 SCNd64
859# define SCNdFAST16 "hd" 864# elif INT_FAST16_MAX == 0x7fff
860# else 865# define SCNdFAST16 "hd"
861# define SCNdFAST16 "d" 866# else
862# endif 867# define SCNdFAST16 "d"
863# endif 868# endif
864# if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@ 869#endif
865# undef SCNiFAST16 870#if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
866# if INT_FAST16_MAX > INT32_MAX 871# undef SCNiFAST16
867# define SCNiFAST16 SCNi64 872# if INT_FAST16_MAX > INT32_MAX
868# elif INT_FAST16_MAX == 0x7fff 873# define SCNiFAST16 SCNi64
869# define SCNiFAST16 "hi" 874# elif INT_FAST16_MAX == 0x7fff
870# else 875# define SCNiFAST16 "hi"
871# define SCNiFAST16 "i" 876# else
872# endif 877# define SCNiFAST16 "i"
873# endif 878# endif
874# if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@ 879#endif
875# undef SCNoFAST16 880#if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
876# if UINT_FAST16_MAX > UINT32_MAX 881# undef SCNoFAST16
877# define SCNoFAST16 SCNo64 882# if UINT_FAST16_MAX > UINT32_MAX
878# elif UINT_FAST16_MAX == 0xffff 883# define SCNoFAST16 SCNo64
879# define SCNoFAST16 "ho" 884# elif UINT_FAST16_MAX == 0xffff
880# else 885# define SCNoFAST16 "ho"
881# define SCNoFAST16 "o" 886# else
882# endif 887# define SCNoFAST16 "o"
883# endif 888# endif
884# if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@ 889#endif
885# undef SCNuFAST16 890#if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
886# if UINT_FAST16_MAX > UINT32_MAX 891# undef SCNuFAST16
887# define SCNuFAST16 SCNu64 892# if UINT_FAST16_MAX > UINT32_MAX
888# elif UINT_FAST16_MAX == 0xffff 893# define SCNuFAST16 SCNu64
889# define SCNuFAST16 "hu" 894# elif UINT_FAST16_MAX == 0xffff
890# else 895# define SCNuFAST16 "hu"
891# define SCNuFAST16 "u" 896# else
892# endif 897# define SCNuFAST16 "u"
893# endif 898# endif
894# if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@ 899#endif
895# undef SCNxFAST16 900#if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
896# if UINT_FAST16_MAX > UINT32_MAX 901# undef SCNxFAST16
897# define SCNxFAST16 SCNx64 902# if UINT_FAST16_MAX > UINT32_MAX
898# elif UINT_FAST16_MAX == 0xffff 903# define SCNxFAST16 SCNx64
899# define SCNxFAST16 "hx" 904# elif UINT_FAST16_MAX == 0xffff
900# else 905# define SCNxFAST16 "hx"
901# define SCNxFAST16 "x" 906# else
902# endif 907# define SCNxFAST16 "x"
903# endif 908# endif
904# if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@ 909#endif
905# undef SCNdFAST32 910#if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
906# if INT_FAST32_MAX > INT32_MAX 911# undef SCNdFAST32
907# define SCNdFAST32 SCNd64 912# if INT_FAST32_MAX > INT32_MAX
908# else 913# define SCNdFAST32 SCNd64
909# define SCNdFAST32 "d" 914# else
910# endif 915# define SCNdFAST32 "d"
911# endif 916# endif
912# if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@ 917#endif
913# undef SCNiFAST32 918#if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
914# if INT_FAST32_MAX > INT32_MAX 919# undef SCNiFAST32
915# define SCNiFAST32 SCNi64 920# if INT_FAST32_MAX > INT32_MAX
916# else 921# define SCNiFAST32 SCNi64
917# define SCNiFAST32 "i" 922# else
918# endif 923# define SCNiFAST32 "i"
919# endif 924# endif
920# if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@ 925#endif
921# undef SCNoFAST32 926#if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
922# if UINT_FAST32_MAX > UINT32_MAX 927# undef SCNoFAST32
923# define SCNoFAST32 SCNo64 928# if UINT_FAST32_MAX > UINT32_MAX
924# else 929# define SCNoFAST32 SCNo64
925# define SCNoFAST32 "o" 930# else
926# endif 931# define SCNoFAST32 "o"
927# endif 932# endif
928# if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@ 933#endif
929# undef SCNuFAST32 934#if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
930# if UINT_FAST32_MAX > UINT32_MAX 935# undef SCNuFAST32
931# define SCNuFAST32 SCNu64 936# if UINT_FAST32_MAX > UINT32_MAX
932# else 937# define SCNuFAST32 SCNu64
933# define SCNuFAST32 "u" 938# else
934# endif 939# define SCNuFAST32 "u"
935# endif 940# endif
936# if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@ 941#endif
937# undef SCNxFAST32 942#if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
938# if UINT_FAST32_MAX > UINT32_MAX 943# undef SCNxFAST32
939# define SCNxFAST32 SCNx64 944# if UINT_FAST32_MAX > UINT32_MAX
940# else 945# define SCNxFAST32 SCNx64
941# define SCNxFAST32 "x" 946# else
942# endif 947# define SCNxFAST32 "x"
943# endif 948# endif
944# ifdef INT64_MAX 949#endif
945# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@ 950#ifdef INT64_MAX
946# undef SCNdFAST64 951# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
947# define SCNdFAST64 SCNd64 952# undef SCNdFAST64
948# endif 953# define SCNdFAST64 SCNd64
949# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
950# undef SCNiFAST64
951# define SCNiFAST64 SCNi64
952# endif
953# endif 954# endif
954# ifdef UINT64_MAX 955# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
955# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@ 956# undef SCNiFAST64
956# undef SCNoFAST64 957# define SCNiFAST64 SCNi64
957# define SCNoFAST64 SCNo64 958# endif
958# endif 959#endif
959# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@ 960#ifdef UINT64_MAX
960# undef SCNuFAST64 961# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
961# define SCNuFAST64 SCNu64 962# undef SCNoFAST64
962# endif 963# define SCNoFAST64 SCNo64
963# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
964# undef SCNxFAST64
965# define SCNxFAST64 SCNx64
966# endif
967# endif 964# endif
965# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
966# undef SCNuFAST64
967# define SCNuFAST64 SCNu64
968# endif
969# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
970# undef SCNxFAST64
971# define SCNxFAST64 SCNx64
972# endif
973#endif
968 974
969# if !defined SCNdMAX || @PRI_MACROS_BROKEN@ 975#if !defined SCNdMAX || @PRI_MACROS_BROKEN@
970# undef SCNdMAX 976# undef SCNdMAX
971# if @INT32_MAX_LT_INTMAX_MAX@ 977# if @INT32_MAX_LT_INTMAX_MAX@
972# define SCNdMAX SCNd64 978# define SCNdMAX SCNd64
973# else 979# else
974# define SCNdMAX "ld" 980# define SCNdMAX "ld"
975# endif
976# endif 981# endif
977# if !defined SCNiMAX || @PRI_MACROS_BROKEN@ 982#endif
978# undef SCNiMAX 983#if !defined SCNiMAX || @PRI_MACROS_BROKEN@
979# if @INT32_MAX_LT_INTMAX_MAX@ 984# undef SCNiMAX
980# define SCNiMAX SCNi64 985# if @INT32_MAX_LT_INTMAX_MAX@
981# else 986# define SCNiMAX SCNi64
982# define SCNiMAX "li" 987# else
983# endif 988# define SCNiMAX "li"
984# endif 989# endif
985# if !defined SCNoMAX || @PRI_MACROS_BROKEN@ 990#endif
986# undef SCNoMAX 991#if !defined SCNoMAX || @PRI_MACROS_BROKEN@
987# if @UINT32_MAX_LT_UINTMAX_MAX@ 992# undef SCNoMAX
988# define SCNoMAX SCNo64 993# if @UINT32_MAX_LT_UINTMAX_MAX@
989# else 994# define SCNoMAX SCNo64
990# define SCNoMAX "lo" 995# else
991# endif 996# define SCNoMAX "lo"
992# endif 997# endif
993# if !defined SCNuMAX || @PRI_MACROS_BROKEN@ 998#endif
994# undef SCNuMAX 999#if !defined SCNuMAX || @PRI_MACROS_BROKEN@
995# if @UINT32_MAX_LT_UINTMAX_MAX@ 1000# undef SCNuMAX
996# define SCNuMAX SCNu64 1001# if @UINT32_MAX_LT_UINTMAX_MAX@
997# else 1002# define SCNuMAX SCNu64
998# define SCNuMAX "lu" 1003# else
999# endif 1004# define SCNuMAX "lu"
1000# endif 1005# endif
1001# if !defined SCNxMAX || @PRI_MACROS_BROKEN@ 1006#endif
1002# undef SCNxMAX 1007#if !defined SCNxMAX || @PRI_MACROS_BROKEN@
1003# if @UINT32_MAX_LT_UINTMAX_MAX@ 1008# undef SCNxMAX
1004# define SCNxMAX SCNx64 1009# if @UINT32_MAX_LT_UINTMAX_MAX@
1005# else 1010# define SCNxMAX SCNx64
1006# define SCNxMAX "lx" 1011# else
1007# endif 1012# define SCNxMAX "lx"
1008# endif 1013# endif
1014#endif
1009 1015
1010# if !defined SCNdPTR || @PRI_MACROS_BROKEN@ 1016#if !defined SCNdPTR || @PRI_MACROS_BROKEN@
1011# undef SCNdPTR 1017# undef SCNdPTR
1012# ifdef INTPTR_MAX 1018# ifdef INTPTR_MAX
1013# define SCNdPTR @PRIPTR_PREFIX@ "d" 1019# define SCNdPTR @PRIPTR_PREFIX@ "d"
1014# endif
1015# endif 1020# endif
1016# if !defined SCNiPTR || @PRI_MACROS_BROKEN@ 1021#endif
1017# undef SCNiPTR 1022#if !defined SCNiPTR || @PRI_MACROS_BROKEN@
1018# ifdef INTPTR_MAX 1023# undef SCNiPTR
1019# define SCNiPTR @PRIPTR_PREFIX@ "i" 1024# ifdef INTPTR_MAX
1020# endif 1025# define SCNiPTR @PRIPTR_PREFIX@ "i"
1021# endif 1026# endif
1022# if !defined SCNoPTR || @PRI_MACROS_BROKEN@ 1027#endif
1023# undef SCNoPTR 1028#if !defined SCNoPTR || @PRI_MACROS_BROKEN@
1024# ifdef UINTPTR_MAX 1029# undef SCNoPTR
1025# define SCNoPTR @PRIPTR_PREFIX@ "o" 1030# ifdef UINTPTR_MAX
1026# endif 1031# define SCNoPTR @PRIPTR_PREFIX@ "o"
1027# endif 1032# endif
1028# if !defined SCNuPTR || @PRI_MACROS_BROKEN@ 1033#endif
1029# undef SCNuPTR 1034#if !defined SCNuPTR || @PRI_MACROS_BROKEN@
1030# ifdef UINTPTR_MAX 1035# undef SCNuPTR
1031# define SCNuPTR @PRIPTR_PREFIX@ "u" 1036# ifdef UINTPTR_MAX
1032# endif 1037# define SCNuPTR @PRIPTR_PREFIX@ "u"
1033# endif 1038# endif
1034# if !defined SCNxPTR || @PRI_MACROS_BROKEN@ 1039#endif
1035# undef SCNxPTR 1040#if !defined SCNxPTR || @PRI_MACROS_BROKEN@
1036# ifdef UINTPTR_MAX 1041# undef SCNxPTR
1037# define SCNxPTR @PRIPTR_PREFIX@ "x" 1042# ifdef UINTPTR_MAX
1038# endif 1043# define SCNxPTR @PRIPTR_PREFIX@ "x"
1039# endif 1044# endif
1040
1041#endif 1045#endif
1042 1046
1043/* 7.8.2 Functions for greatest-width integer types */ 1047/* 7.8.2 Functions for greatest-width integer types */
@@ -1075,10 +1079,23 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
1075#endif 1079#endif
1076 1080
1077#if @GNULIB_STRTOIMAX@ 1081#if @GNULIB_STRTOIMAX@
1078# if !@HAVE_DECL_STRTOIMAX@ 1082# if @REPLACE_STRTOIMAX@
1079# undef strtoimax 1083# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1080extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1)); 1084# undef strtoimax
1085# define strtoimax rpl_strtoimax
1086# endif
1087_GL_FUNCDECL_RPL (strtoimax, intmax_t,
1088 (const char *, char **, int) _GL_ARG_NONNULL ((1)));
1089_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int));
1090# else
1091# if !@HAVE_DECL_STRTOIMAX@
1092# undef strtoimax
1093_GL_FUNCDECL_SYS (strtoimax, intmax_t,
1094 (const char *, char **, int) _GL_ARG_NONNULL ((1)));
1095# endif
1096_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int));
1081# endif 1097# endif
1098_GL_CXXALIASWARN (strtoimax);
1082#elif defined GNULIB_POSIXCHECK 1099#elif defined GNULIB_POSIXCHECK
1083# undef strtoimax 1100# undef strtoimax
1084# if HAVE_RAW_DECL_STRTOIMAX 1101# if HAVE_RAW_DECL_STRTOIMAX
@@ -1090,8 +1107,11 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
1090#if @GNULIB_STRTOUMAX@ 1107#if @GNULIB_STRTOUMAX@
1091# if !@HAVE_DECL_STRTOUMAX@ 1108# if !@HAVE_DECL_STRTOUMAX@
1092# undef strtoumax 1109# undef strtoumax
1093extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1)); 1110_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
1111 (const char *, char **, int) _GL_ARG_NONNULL ((1)));
1094# endif 1112# endif
1113_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
1114_GL_CXXALIASWARN (strtoumax);
1095#elif defined GNULIB_POSIXCHECK 1115#elif defined GNULIB_POSIXCHECK
1096# undef strtoumax 1116# undef strtoumax
1097# if HAVE_RAW_DECL_STRTOUMAX 1117# if HAVE_RAW_DECL_STRTOUMAX
diff --git a/lib/lstat.c b/lib/lstat.c
index d786288f2b7..db119a10d3f 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
1/* Work around a bug of lstat on some systems 1/* Work around a bug of lstat on some systems
2 2
3 Copyright (C) 1997-2006, 2008-2011 Free Software Foundation, Inc. 3 Copyright (C) 1997-2006, 2008-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -51,11 +51,11 @@ orig_lstat (const char *filename, struct stat *buf)
51# include <errno.h> 51# include <errno.h>
52 52
53/* lstat works differently on Linux and Solaris systems. POSIX (see 53/* lstat works differently on Linux and Solaris systems. POSIX (see
54 `pathname resolution' in the glossary) requires that programs like 54 "pathname resolution" in the glossary) requires that programs like
55 `ls' take into consideration the fact that FILE has a trailing slash 55 'ls' take into consideration the fact that FILE has a trailing slash
56 when FILE is a symbolic link. On Linux and Solaris 10 systems, the 56 when FILE is a symbolic link. On Linux and Solaris 10 systems, the
57 lstat function already has the desired semantics (in treating 57 lstat function already has the desired semantics (in treating
58 `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)', 58 'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
59 but on Solaris 9 and earlier it does not. 59 but on Solaris 9 and earlier it does not.
60 60
61 If FILE has a trailing slash and specifies a symbolic link, 61 If FILE has a trailing slash and specifies a symbolic link,
diff --git a/lib/md5.c b/lib/md5.c
index b7fad633364..30b7e50e3ae 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
1/* Functions to compute MD5 message digest of files or memory blocks. 1/* Functions to compute MD5 message digest of files or memory blocks.
2 according to the definition of MD5 in RFC 1321 from April 1992. 2 according to the definition of MD5 in RFC 1321 from April 1992.
3 Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software 3 Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2012 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 This file is part of the GNU C Library. 5 This file is part of the GNU C Library.
6 6
@@ -15,8 +15,7 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation, 18 along with this program; if not, see <http://www.gnu.org/licenses/>. */
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 19
21/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ 20/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
22 21
@@ -24,7 +23,8 @@
24 23
25#include "md5.h" 24#include "md5.h"
26 25
27#include <stddef.h> 26#include <stdalign.h>
27#include <stdint.h>
28#include <stdlib.h> 28#include <stdlib.h>
29#include <string.h> 29#include <string.h>
30#include <sys/types.h> 30#include <sys/types.h>
@@ -254,8 +254,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
254 if (len >= 64) 254 if (len >= 64)
255 { 255 {
256#if !_STRING_ARCH_unaligned 256#if !_STRING_ARCH_unaligned
257# define alignof(type) offsetof (struct { char c; type x; }, x) 257# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
258# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
259 if (UNALIGNED_P (buffer)) 258 if (UNALIGNED_P (buffer))
260 while (len > 64) 259 while (len > 64)
261 { 260 {
@@ -313,13 +312,13 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
313 uint32_t B = ctx->B; 312 uint32_t B = ctx->B;
314 uint32_t C = ctx->C; 313 uint32_t C = ctx->C;
315 uint32_t D = ctx->D; 314 uint32_t D = ctx->D;
315 uint32_t lolen = len;
316 316
317 /* First increment the byte count. RFC 1321 specifies the possible 317 /* First increment the byte count. RFC 1321 specifies the possible
318 length of the file up to 2^64 bits. Here we only compute the 318 length of the file up to 2^64 bits. Here we only compute the
319 number of bytes. Do a double word increment. */ 319 number of bytes. Do a double word increment. */
320 ctx->total[0] += len; 320 ctx->total[0] += lolen;
321 if (ctx->total[0] < len) 321 ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
322 ++ctx->total[1];
323 322
324 /* Process all bytes in the buffer with 64 bytes in each round of 323 /* Process all bytes in the buffer with 64 bytes in each round of
325 the loop. */ 324 the loop. */
diff --git a/lib/md5.h b/lib/md5.h
index 53e60480292..75d6bce5c33 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
1/* Declaration of functions and data types used for MD5 sum computing 1/* Declaration of functions and data types used for MD5 sum computing
2 library functions. 2 library functions.
3 Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2011 Free Software 3 Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2012 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 This file is part of the GNU C Library. 5 This file is part of the GNU C Library.
6 6
@@ -15,8 +15,7 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation, 18 along with this program; if not, see <http://www.gnu.org/licenses/>. */
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 19
21#ifndef _MD5_H 20#ifndef _MD5_H
22#define _MD5_H 1 21#define _MD5_H 1
@@ -73,7 +72,7 @@ struct md5_ctx
73 72
74/* 73/*
75 * The following three functions are build up the low level used in 74 * The following three functions are build up the low level used in
76 * the functions `md5_stream' and `md5_buffer'. 75 * the functions 'md5_stream' and 'md5_buffer'.
77 */ 76 */
78 77
79/* Initialize structure containing state of computation. 78/* Initialize structure containing state of computation.
diff --git a/lib/mktime.c b/lib/mktime.c
index c68ad9ba262..952c82983bb 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,21 +1,21 @@
1/* Convert a `struct tm' to a time_t value. 1/* Convert a 'struct tm' to a time_t value.
2 Copyright (C) 1993-1999, 2002-2007, 2009-2011 Free Software Foundation, Inc. 2 Copyright (C) 1993-2012 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 3 This file is part of the GNU C Library.
4 Contributed by Paul Eggert <eggert@twinsun.com>. 4 Contributed by Paul Eggert <eggert@twinsun.com>.
5 5
6 This program is free software; you can redistribute it and/or modify 6 The GNU C Library is free software; you can redistribute it and/or
7 it under the terms of the GNU General Public License as published by 7 modify it under the terms of the GNU General Public
8 the Free Software Foundation; either version 3, or (at your option) 8 License as published by the Free Software Foundation; either
9 any later version. 9 version 3 of the License, or (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 GNU General Public License for more details. 14 General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License along 16 You should have received a copy of the GNU General Public
17 with this program; if not, write to the Free Software Foundation, 17 License along with the GNU C Library; if not, see
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 <http://www.gnu.org/licenses/>. */
19 19
20/* Define this to have a standalone program to test this implementation of 20/* Define this to have a standalone program to test this implementation of
21 mktime. */ 21 mktime. */
@@ -25,26 +25,8 @@
25# include <config.h> 25# include <config.h>
26#endif 26#endif
27 27
28/* Some of the code in this file assumes that signed integer overflow
29 silently wraps around. This assumption can't easily be programmed
30 around, nor can it be checked for portably at compile-time or
31 easily eliminated at run-time.
32
33 Define WRAPV to 1 if the assumption is valid. Otherwise, define it
34 to 0; this forces the use of slower code that, while not guaranteed
35 by the C Standard, works on all production platforms that we know
36 about. */
37#ifndef WRAPV
38# if (__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__
39# pragma GCC optimize ("wrapv")
40# define WRAPV 1
41# else
42# define WRAPV 0
43# endif
44#endif
45
46/* Assume that leap seconds are possible, unless told otherwise. 28/* Assume that leap seconds are possible, unless told otherwise.
47 If the host has a `zic' command with a `-L leapsecondfilename' option, 29 If the host has a 'zic' command with a '-L leapsecondfilename' option,
48 then it supports leap seconds; otherwise it probably doesn't. */ 30 then it supports leap seconds; otherwise it probably doesn't. */
49#ifndef LEAP_SECONDS_POSSIBLE 31#ifndef LEAP_SECONDS_POSSIBLE
50# define LEAP_SECONDS_POSSIBLE 1 32# define LEAP_SECONDS_POSSIBLE 1
@@ -54,7 +36,7 @@
54 36
55#include <limits.h> 37#include <limits.h>
56 38
57#include <string.h> /* For the real memcpy prototype. */ 39#include <string.h> /* For the real memcpy prototype. */
58 40
59#if DEBUG 41#if DEBUG
60# include <stdio.h> 42# include <stdio.h>
@@ -64,6 +46,28 @@
64# define mktime my_mktime 46# define mktime my_mktime
65#endif /* DEBUG */ 47#endif /* DEBUG */
66 48
49/* Some of the code in this file assumes that signed integer overflow
50 silently wraps around. This assumption can't easily be programmed
51 around, nor can it be checked for portably at compile-time or
52 easily eliminated at run-time.
53
54 Define WRAPV to 1 if the assumption is valid and if
55 #pragma GCC optimize ("wrapv")
56 does not trigger GCC bug 51793
57 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
58 Otherwise, define it to 0; this forces the use of slower code that,
59 while not guaranteed by the C Standard, works on all production
60 platforms that we know about. */
61#ifndef WRAPV
62# if (((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) \
63 && defined __GLIBC__)
64# pragma GCC optimize ("wrapv")
65# define WRAPV 1
66# else
67# define WRAPV 0
68# endif
69#endif
70
67/* Verify a requirement at compile-time (unlike assert, which is runtime). */ 71/* Verify a requirement at compile-time (unlike assert, which is runtime). */
68#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; } 72#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
69 73
@@ -112,12 +116,12 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
112 your host. */ 116 your host. */
113#define TYPE_MINIMUM(t) \ 117#define TYPE_MINIMUM(t) \
114 ((t) (! TYPE_SIGNED (t) \ 118 ((t) (! TYPE_SIGNED (t) \
115 ? (t) 0 \ 119 ? (t) 0 \
116 : ~ TYPE_MAXIMUM (t))) 120 : ~ TYPE_MAXIMUM (t)))
117#define TYPE_MAXIMUM(t) \ 121#define TYPE_MAXIMUM(t) \
118 ((t) (! TYPE_SIGNED (t) \ 122 ((t) (! TYPE_SIGNED (t) \
119 ? (t) -1 \ 123 ? (t) -1 \
120 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) 124 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
121 125
122#ifndef TIME_T_MIN 126#ifndef TIME_T_MIN
123# define TIME_T_MIN TYPE_MINIMUM (time_t) 127# define TIME_T_MIN TYPE_MINIMUM (time_t)
@@ -129,9 +133,9 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
129 133
130verify (time_t_is_integer, TYPE_IS_INTEGER (time_t)); 134verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
131verify (twos_complement_arithmetic, 135verify (twos_complement_arithmetic,
132 (TYPE_TWOS_COMPLEMENT (int) 136 (TYPE_TWOS_COMPLEMENT (int)
133 && TYPE_TWOS_COMPLEMENT (long_int) 137 && TYPE_TWOS_COMPLEMENT (long_int)
134 && TYPE_TWOS_COMPLEMENT (time_t))); 138 && TYPE_TWOS_COMPLEMENT (time_t)));
135 139
136#define EPOCH_YEAR 1970 140#define EPOCH_YEAR 1970
137#define TM_YEAR_BASE 1900 141#define TM_YEAR_BASE 1900
@@ -146,7 +150,7 @@ leapyear (long_int year)
146 return 150 return
147 ((year & 3) == 0 151 ((year & 3) == 0
148 && (year % 100 != 0 152 && (year % 100 != 0
149 || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3))); 153 || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
150} 154}
151 155
152/* How many days come before each month (0-12). */ 156/* How many days come before each month (0-12). */
@@ -178,7 +182,7 @@ const unsigned short int __mon_yday[2][13] =
178static int 182static int
179isdst_differ (int a, int b) 183isdst_differ (int a, int b)
180{ 184{
181 return (!a != !b) & (0 <= a) & (0 <= b); 185 return (!a != !b) && (0 <= a) && (0 <= b);
182} 186}
183 187
184/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) - 188/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
@@ -194,7 +198,7 @@ isdst_differ (int a, int b)
194 198
195static inline time_t 199static inline time_t
196ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1, 200ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
197 int year0, int yday0, int hour0, int min0, int sec0) 201 int year0, int yday0, int hour0, int min0, int sec0)
198{ 202{
199 verify (C99_integer_division, -1 / 2 == 0); 203 verify (C99_integer_division, -1 / 2 == 0);
200 204
@@ -275,15 +279,15 @@ time_t_int_add_ok (time_t a, int b)
275 yield a value equal to *T. */ 279 yield a value equal to *T. */
276static time_t 280static time_t
277guess_time_tm (long_int year, long_int yday, int hour, int min, int sec, 281guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
278 const time_t *t, const struct tm *tp) 282 const time_t *t, const struct tm *tp)
279{ 283{
280 if (tp) 284 if (tp)
281 { 285 {
282 time_t d = ydhms_diff (year, yday, hour, min, sec, 286 time_t d = ydhms_diff (year, yday, hour, min, sec,
283 tp->tm_year, tp->tm_yday, 287 tp->tm_year, tp->tm_yday,
284 tp->tm_hour, tp->tm_min, tp->tm_sec); 288 tp->tm_hour, tp->tm_min, tp->tm_sec);
285 if (time_t_add_ok (*t, d)) 289 if (time_t_add_ok (*t, d))
286 return *t + d; 290 return *t + d;
287 } 291 }
288 292
289 /* Overflow occurred one way or another. Return the nearest result 293 /* Overflow occurred one way or another. Return the nearest result
@@ -292,8 +296,8 @@ guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
292 match; and don't oscillate between two values, as that would 296 match; and don't oscillate between two values, as that would
293 confuse the spring-forward gap detector. */ 297 confuse the spring-forward gap detector. */
294 return (*t < TIME_T_MIDPOINT 298 return (*t < TIME_T_MIDPOINT
295 ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN) 299 ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
296 : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX)); 300 : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
297} 301}
298 302
299/* Use CONVERT to convert *T to a broken down time in *TP. 303/* Use CONVERT to convert *T to a broken down time in *TP.
@@ -301,7 +305,7 @@ guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
301 it is the nearest in-range value and then convert that. */ 305 it is the nearest in-range value and then convert that. */
302static struct tm * 306static struct tm *
303ranged_convert (struct tm *(*convert) (const time_t *, struct tm *), 307ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
304 time_t *t, struct tm *tp) 308 time_t *t, struct tm *tp)
305{ 309{
306 struct tm *r = convert (t, tp); 310 struct tm *r = convert (t, tp);
307 311
@@ -311,25 +315,25 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
311 time_t ok = 0; 315 time_t ok = 0;
312 316
313 /* BAD is a known unconvertible time_t, and OK is a known good one. 317 /* BAD is a known unconvertible time_t, and OK is a known good one.
314 Use binary search to narrow the range between BAD and OK until 318 Use binary search to narrow the range between BAD and OK until
315 they differ by 1. */ 319 they differ by 1. */
316 while (bad != ok + (bad < 0 ? -1 : 1)) 320 while (bad != ok + (bad < 0 ? -1 : 1))
317 { 321 {
318 time_t mid = *t = time_t_avg (ok, bad); 322 time_t mid = *t = time_t_avg (ok, bad);
319 r = convert (t, tp); 323 r = convert (t, tp);
320 if (r) 324 if (r)
321 ok = mid; 325 ok = mid;
322 else 326 else
323 bad = mid; 327 bad = mid;
324 } 328 }
325 329
326 if (!r && ok) 330 if (!r && ok)
327 { 331 {
328 /* The last conversion attempt failed; 332 /* The last conversion attempt failed;
329 revert to the most recent successful attempt. */ 333 revert to the most recent successful attempt. */
330 *t = ok; 334 *t = ok;
331 r = convert (t, tp); 335 r = convert (t, tp);
332 } 336 }
333 } 337 }
334 338
335 return r; 339 return r;
@@ -344,8 +348,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
344 This function is external because it is used also by timegm.c. */ 348 This function is external because it is used also by timegm.c. */
345time_t 349time_t
346__mktime_internal (struct tm *tp, 350__mktime_internal (struct tm *tp,
347 struct tm *(*convert) (const time_t *, struct tm *), 351 struct tm *(*convert) (const time_t *, struct tm *),
348 time_t *offset) 352 time_t *offset)
349{ 353{
350 time_t t, gt, t0, t1, t2; 354 time_t t, gt, t0, t1, t2;
351 struct tm tm; 355 struct tm tm;
@@ -384,8 +388,8 @@ __mktime_internal (struct tm *tp,
384 /* Calculate day of year from year, month, and day of month. 388 /* Calculate day of year from year, month, and day of month.
385 The result need not be in range. */ 389 The result need not be in range. */
386 int mon_yday = ((__mon_yday[leapyear (year)] 390 int mon_yday = ((__mon_yday[leapyear (year)]
387 [mon_remainder + 12 * negative_mon_remainder]) 391 [mon_remainder + 12 * negative_mon_remainder])
388 - 1); 392 - 1);
389 long_int lmday = mday; 393 long_int lmday = mday;
390 long_int yday = mon_yday + lmday; 394 long_int yday = mon_yday + lmday;
391 395
@@ -396,33 +400,33 @@ __mktime_internal (struct tm *tp,
396 if (LEAP_SECONDS_POSSIBLE) 400 if (LEAP_SECONDS_POSSIBLE)
397 { 401 {
398 /* Handle out-of-range seconds specially, 402 /* Handle out-of-range seconds specially,
399 since ydhms_tm_diff assumes every minute has 60 seconds. */ 403 since ydhms_tm_diff assumes every minute has 60 seconds. */
400 if (sec < 0) 404 if (sec < 0)
401 sec = 0; 405 sec = 0;
402 if (59 < sec) 406 if (59 < sec)
403 sec = 59; 407 sec = 59;
404 } 408 }
405 409
406 /* Invert CONVERT by probing. First assume the same offset as last 410 /* Invert CONVERT by probing. First assume the same offset as last
407 time. */ 411 time. */
408 412
409 t0 = ydhms_diff (year, yday, hour, min, sec, 413 t0 = ydhms_diff (year, yday, hour, min, sec,
410 EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset); 414 EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
411 415
412 if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3) 416 if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
413 { 417 {
414 /* time_t isn't large enough to rule out overflows, so check 418 /* time_t isn't large enough to rule out overflows, so check
415 for major overflows. A gross check suffices, since if t0 419 for major overflows. A gross check suffices, since if t0
416 has overflowed, it is off by a multiple of TIME_T_MAX - 420 has overflowed, it is off by a multiple of TIME_T_MAX -
417 TIME_T_MIN + 1. So ignore any component of the difference 421 TIME_T_MIN + 1. So ignore any component of the difference
418 that is bounded by a small value. */ 422 that is bounded by a small value. */
419 423
420 /* Approximate log base 2 of the number of time units per 424 /* Approximate log base 2 of the number of time units per
421 biennium. A biennium is 2 years; use this unit instead of 425 biennium. A biennium is 2 years; use this unit instead of
422 years to avoid integer overflow. For example, 2 average 426 years to avoid integer overflow. For example, 2 average
423 Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds, 427 Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
424 which is 63113904 seconds, and rint (log2 (63113904)) is 428 which is 63113904 seconds, and rint (log2 (63113904)) is
425 26. */ 429 26. */
426 int ALOG2_SECONDS_PER_BIENNIUM = 26; 430 int ALOG2_SECONDS_PER_BIENNIUM = 26;
427 int ALOG2_MINUTES_PER_BIENNIUM = 20; 431 int ALOG2_MINUTES_PER_BIENNIUM = 20;
428 int ALOG2_HOURS_PER_BIENNIUM = 14; 432 int ALOG2_HOURS_PER_BIENNIUM = 14;
@@ -430,64 +434,64 @@ __mktime_internal (struct tm *tp,
430 int LOG2_YEARS_PER_BIENNIUM = 1; 434 int LOG2_YEARS_PER_BIENNIUM = 1;
431 435
432 int approx_requested_biennia = 436 int approx_requested_biennia =
433 (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM) 437 (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
434 - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM) 438 - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
435 + SHR (mday, ALOG2_DAYS_PER_BIENNIUM) 439 + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
436 + SHR (hour, ALOG2_HOURS_PER_BIENNIUM) 440 + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
437 + SHR (min, ALOG2_MINUTES_PER_BIENNIUM) 441 + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
438 + (LEAP_SECONDS_POSSIBLE 442 + (LEAP_SECONDS_POSSIBLE
439 ? 0 443 ? 0
440 : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM))); 444 : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
441 445
442 int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM); 446 int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
443 int diff = approx_biennia - approx_requested_biennia; 447 int diff = approx_biennia - approx_requested_biennia;
444 int abs_diff = diff < 0 ? -1 - diff : diff; 448 int approx_abs_diff = diff < 0 ? -1 - diff : diff;
445 449
446 /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously 450 /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously
447 gives a positive value of 715827882. Setting a variable 451 gives a positive value of 715827882. Setting a variable
448 first then doing math on it seems to work. 452 first then doing math on it seems to work.
449 (ghazi@caip.rutgers.edu) */ 453 (ghazi@caip.rutgers.edu) */
450 time_t time_t_max = TIME_T_MAX; 454 time_t time_t_max = TIME_T_MAX;
451 time_t time_t_min = TIME_T_MIN; 455 time_t time_t_min = TIME_T_MIN;
452 time_t overflow_threshold = 456 time_t overflow_threshold =
453 (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM; 457 (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
454 458
455 if (overflow_threshold < abs_diff) 459 if (overflow_threshold < approx_abs_diff)
456 { 460 {
457 /* Overflow occurred. Try repairing it; this might work if 461 /* Overflow occurred. Try repairing it; this might work if
458 the time zone offset is enough to undo the overflow. */ 462 the time zone offset is enough to undo the overflow. */
459 time_t repaired_t0 = -1 - t0; 463 time_t repaired_t0 = -1 - t0;
460 approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM); 464 approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
461 diff = approx_biennia - approx_requested_biennia; 465 diff = approx_biennia - approx_requested_biennia;
462 abs_diff = diff < 0 ? -1 - diff : diff; 466 approx_abs_diff = diff < 0 ? -1 - diff : diff;
463 if (overflow_threshold < abs_diff) 467 if (overflow_threshold < approx_abs_diff)
464 return -1; 468 return -1;
465 guessed_offset += repaired_t0 - t0; 469 guessed_offset += repaired_t0 - t0;
466 t0 = repaired_t0; 470 t0 = repaired_t0;
467 } 471 }
468 } 472 }
469 473
470 /* Repeatedly use the error to improve the guess. */ 474 /* Repeatedly use the error to improve the guess. */
471 475
472 for (t = t1 = t2 = t0, dst2 = 0; 476 for (t = t1 = t2 = t0, dst2 = 0;
473 (gt = guess_time_tm (year, yday, hour, min, sec, &t, 477 (gt = guess_time_tm (year, yday, hour, min, sec, &t,
474 ranged_convert (convert, &t, &tm)), 478 ranged_convert (convert, &t, &tm)),
475 t != gt); 479 t != gt);
476 t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0) 480 t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
477 if (t == t1 && t != t2 481 if (t == t1 && t != t2
478 && (tm.tm_isdst < 0 482 && (tm.tm_isdst < 0
479 || (isdst < 0 483 || (isdst < 0
480 ? dst2 <= (tm.tm_isdst != 0) 484 ? dst2 <= (tm.tm_isdst != 0)
481 : (isdst != 0) != (tm.tm_isdst != 0)))) 485 : (isdst != 0) != (tm.tm_isdst != 0))))
482 /* We can't possibly find a match, as we are oscillating 486 /* We can't possibly find a match, as we are oscillating
483 between two values. The requested time probably falls 487 between two values. The requested time probably falls
484 within a spring-forward gap of size GT - T. Follow the common 488 within a spring-forward gap of size GT - T. Follow the common
485 practice in this case, which is to return a time that is GT - T 489 practice in this case, which is to return a time that is GT - T
486 away from the requested time, preferring a time whose 490 away from the requested time, preferring a time whose
487 tm_isdst differs from the requested value. (If no tm_isdst 491 tm_isdst differs from the requested value. (If no tm_isdst
488 was requested and only one of the two values has a nonzero 492 was requested and only one of the two values has a nonzero
489 tm_isdst, prefer that value.) In practice, this is more 493 tm_isdst, prefer that value.) In practice, this is more
490 useful than returning -1. */ 494 useful than returning -1. */
491 goto offset_found; 495 goto offset_found;
492 else if (--remaining_probes == 0) 496 else if (--remaining_probes == 0)
493 return -1; 497 return -1;
@@ -497,50 +501,50 @@ __mktime_internal (struct tm *tp,
497 if (isdst_differ (isdst, tm.tm_isdst)) 501 if (isdst_differ (isdst, tm.tm_isdst))
498 { 502 {
499 /* tm.tm_isdst has the wrong value. Look for a neighboring 503 /* tm.tm_isdst has the wrong value. Look for a neighboring
500 time with the right value, and use its UTC offset. 504 time with the right value, and use its UTC offset.
501 505
502 Heuristic: probe the adjacent timestamps in both directions, 506 Heuristic: probe the adjacent timestamps in both directions,
503 looking for the desired isdst. This should work for all real 507 looking for the desired isdst. This should work for all real
504 time zone histories in the tz database. */ 508 time zone histories in the tz database. */
505 509
506 /* Distance between probes when looking for a DST boundary. In 510 /* Distance between probes when looking for a DST boundary. In
507 tzdata2003a, the shortest period of DST is 601200 seconds 511 tzdata2003a, the shortest period of DST is 601200 seconds
508 (e.g., America/Recife starting 2000-10-08 01:00), and the 512 (e.g., America/Recife starting 2000-10-08 01:00), and the
509 shortest period of non-DST surrounded by DST is 694800 513 shortest period of non-DST surrounded by DST is 694800
510 seconds (Africa/Tunis starting 1943-04-17 01:00). Use the 514 seconds (Africa/Tunis starting 1943-04-17 01:00). Use the
511 minimum of these two values, so we don't miss these short 515 minimum of these two values, so we don't miss these short
512 periods when probing. */ 516 periods when probing. */
513 int stride = 601200; 517 int stride = 601200;
514 518
515 /* The longest period of DST in tzdata2003a is 536454000 seconds 519 /* The longest period of DST in tzdata2003a is 536454000 seconds
516 (e.g., America/Jujuy starting 1946-10-01 01:00). The longest 520 (e.g., America/Jujuy starting 1946-10-01 01:00). The longest
517 period of non-DST is much longer, but it makes no real sense 521 period of non-DST is much longer, but it makes no real sense
518 to search for more than a year of non-DST, so use the DST 522 to search for more than a year of non-DST, so use the DST
519 max. */ 523 max. */
520 int duration_max = 536454000; 524 int duration_max = 536454000;
521 525
522 /* Search in both directions, so the maximum distance is half 526 /* Search in both directions, so the maximum distance is half
523 the duration; add the stride to avoid off-by-1 problems. */ 527 the duration; add the stride to avoid off-by-1 problems. */
524 int delta_bound = duration_max / 2 + stride; 528 int delta_bound = duration_max / 2 + stride;
525 529
526 int delta, direction; 530 int delta, direction;
527 531
528 for (delta = stride; delta < delta_bound; delta += stride) 532 for (delta = stride; delta < delta_bound; delta += stride)
529 for (direction = -1; direction <= 1; direction += 2) 533 for (direction = -1; direction <= 1; direction += 2)
530 if (time_t_int_add_ok (t, delta * direction)) 534 if (time_t_int_add_ok (t, delta * direction))
531 { 535 {
532 time_t ot = t + delta * direction; 536 time_t ot = t + delta * direction;
533 struct tm otm; 537 struct tm otm;
534 ranged_convert (convert, &ot, &otm); 538 ranged_convert (convert, &ot, &otm);
535 if (! isdst_differ (isdst, otm.tm_isdst)) 539 if (! isdst_differ (isdst, otm.tm_isdst))
536 { 540 {
537 /* We found the desired tm_isdst. 541 /* We found the desired tm_isdst.
538 Extrapolate back to the desired time. */ 542 Extrapolate back to the desired time. */
539 t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm); 543 t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
540 ranged_convert (convert, &t, &tm); 544 ranged_convert (convert, &t, &tm);
541 goto offset_found; 545 goto offset_found;
542 } 546 }
543 } 547 }
544 } 548 }
545 549
546 offset_found: 550 offset_found:
@@ -549,16 +553,16 @@ __mktime_internal (struct tm *tp,
549 if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec) 553 if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
550 { 554 {
551 /* Adjust time to reflect the tm_sec requested, not the normalized value. 555 /* Adjust time to reflect the tm_sec requested, not the normalized value.
552 Also, repair any damage from a false match due to a leap second. */ 556 Also, repair any damage from a false match due to a leap second. */
553 int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec; 557 int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
554 if (! time_t_int_add_ok (t, sec_requested)) 558 if (! time_t_int_add_ok (t, sec_requested))
555 return -1; 559 return -1;
556 t1 = t + sec_requested; 560 t1 = t + sec_requested;
557 if (! time_t_int_add_ok (t1, sec_adjustment)) 561 if (! time_t_int_add_ok (t1, sec_adjustment))
558 return -1; 562 return -1;
559 t2 = t1 + sec_adjustment; 563 t2 = t1 + sec_adjustment;
560 if (! convert (&t2, &tm)) 564 if (! convert (&t2, &tm))
561 return -1; 565 return -1;
562 t = t2; 566 t = t2;
563 } 567 }
564 568
@@ -579,7 +583,7 @@ mktime (struct tm *tp)
579{ 583{
580#ifdef _LIBC 584#ifdef _LIBC
581 /* POSIX.1 8.1.1 requires that whenever mktime() is called, the 585 /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
582 time zone names contained in the external variable `tzname' shall 586 time zone names contained in the external variable 'tzname' shall
583 be set as if the tzset() function had been called. */ 587 be set as if the tzset() function had been called. */
584 __tzset (); 588 __tzset ();
585#endif 589#endif
@@ -602,13 +606,13 @@ static int
602not_equal_tm (const struct tm *a, const struct tm *b) 606not_equal_tm (const struct tm *a, const struct tm *b)
603{ 607{
604 return ((a->tm_sec ^ b->tm_sec) 608 return ((a->tm_sec ^ b->tm_sec)
605 | (a->tm_min ^ b->tm_min) 609 | (a->tm_min ^ b->tm_min)
606 | (a->tm_hour ^ b->tm_hour) 610 | (a->tm_hour ^ b->tm_hour)
607 | (a->tm_mday ^ b->tm_mday) 611 | (a->tm_mday ^ b->tm_mday)
608 | (a->tm_mon ^ b->tm_mon) 612 | (a->tm_mon ^ b->tm_mon)
609 | (a->tm_year ^ b->tm_year) 613 | (a->tm_year ^ b->tm_year)
610 | (a->tm_yday ^ b->tm_yday) 614 | (a->tm_yday ^ b->tm_yday)
611 | isdst_differ (a->tm_isdst, b->tm_isdst)); 615 | isdst_differ (a->tm_isdst, b->tm_isdst));
612} 616}
613 617
614static void 618static void
@@ -616,9 +620,9 @@ print_tm (const struct tm *tp)
616{ 620{
617 if (tp) 621 if (tp)
618 printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d", 622 printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
619 tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday, 623 tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
620 tp->tm_hour, tp->tm_min, tp->tm_sec, 624 tp->tm_hour, tp->tm_min, tp->tm_sec,
621 tp->tm_yday, tp->tm_wday, tp->tm_isdst); 625 tp->tm_yday, tp->tm_wday, tp->tm_isdst);
622 else 626 else
623 printf ("0"); 627 printf ("0");
624} 628}
@@ -650,11 +654,11 @@ main (int argc, char **argv)
650 654
651 if ((argc == 3 || argc == 4) 655 if ((argc == 3 || argc == 4)
652 && (sscanf (argv[1], "%d-%d-%d%c", 656 && (sscanf (argv[1], "%d-%d-%d%c",
653 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer) 657 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
654 == 3) 658 == 3)
655 && (sscanf (argv[2], "%d:%d:%d%c", 659 && (sscanf (argv[2], "%d:%d:%d%c",
656 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer) 660 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
657 == 3)) 661 == 3))
658 { 662 {
659 tm.tm_year -= TM_YEAR_BASE; 663 tm.tm_year -= TM_YEAR_BASE;
660 tm.tm_mon--; 664 tm.tm_mon--;
@@ -663,10 +667,10 @@ main (int argc, char **argv)
663 tl = mktime (&tmk); 667 tl = mktime (&tmk);
664 lt = localtime (&tl); 668 lt = localtime (&tl);
665 if (lt) 669 if (lt)
666 { 670 {
667 tml = *lt; 671 tml = *lt;
668 lt = &tml; 672 lt = &tml;
669 } 673 }
670 printf ("mktime returns %ld == ", (long int) tl); 674 printf ("mktime returns %ld == ", (long int) tl);
671 print_tm (&tmk); 675 print_tm (&tmk);
672 printf ("\n"); 676 printf ("\n");
@@ -679,51 +683,51 @@ main (int argc, char **argv)
679 time_t to = atol (argv[3]); 683 time_t to = atol (argv[3]);
680 684
681 if (argc == 4) 685 if (argc == 4)
682 for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) 686 for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
683 { 687 {
684 lt = localtime (&tl); 688 lt = localtime (&tl);
685 if (lt) 689 if (lt)
686 { 690 {
687 tmk = tml = *lt; 691 tmk = tml = *lt;
688 tk = mktime (&tmk); 692 tk = mktime (&tmk);
689 status |= check_result (tk, tmk, tl, &tml); 693 status |= check_result (tk, tmk, tl, &tml);
690 } 694 }
691 else 695 else
692 { 696 {
693 printf ("localtime (%ld) yields 0\n", (long int) tl); 697 printf ("localtime (%ld) yields 0\n", (long int) tl);
694 status = 1; 698 status = 1;
695 } 699 }
696 tl1 = tl + by; 700 tl1 = tl + by;
697 if ((tl1 < tl) != (by < 0)) 701 if ((tl1 < tl) != (by < 0))
698 break; 702 break;
699 } 703 }
700 else 704 else
701 for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1) 705 for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
702 { 706 {
703 /* Null benchmark. */ 707 /* Null benchmark. */
704 lt = localtime (&tl); 708 lt = localtime (&tl);
705 if (lt) 709 if (lt)
706 { 710 {
707 tmk = tml = *lt; 711 tmk = tml = *lt;
708 tk = tl; 712 tk = tl;
709 status |= check_result (tk, tmk, tl, &tml); 713 status |= check_result (tk, tmk, tl, &tml);
710 } 714 }
711 else 715 else
712 { 716 {
713 printf ("localtime (%ld) yields 0\n", (long int) tl); 717 printf ("localtime (%ld) yields 0\n", (long int) tl);
714 status = 1; 718 status = 1;
715 } 719 }
716 tl1 = tl + by; 720 tl1 = tl + by;
717 if ((tl1 < tl) != (by < 0)) 721 if ((tl1 < tl) != (by < 0))
718 break; 722 break;
719 } 723 }
720 } 724 }
721 else 725 else
722 printf ("Usage:\ 726 printf ("Usage:\
723\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\ 727\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
724\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\ 728\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
725\t%s FROM BY TO - # Do not test those values (for benchmark).\n", 729\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
726 argv[0], argv[0], argv[0]); 730 argv[0], argv[0], argv[0]);
727 731
728 return status; 732 return status;
729} 733}
diff --git a/lib/pathmax.h b/lib/pathmax.h
index c47618a1b6a..03db7cb519b 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -1,5 +1,5 @@
1/* Define PATH_MAX somehow. Requires sys/types.h. 1/* Define PATH_MAX somehow. Requires sys/types.h.
2 Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software 2 Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2012 Free Software
3 Foundation, Inc. 3 Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#ifndef _PATHMAX_H 18#ifndef _PATHMAX_H
20# define _PATHMAX_H 19# define _PATHMAX_H
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c
index 11d549cad41..4a150e70e9f 100644
--- a/lib/pthread_sigmask.c
+++ b/lib/pthread_sigmask.c
@@ -1,5 +1,5 @@
1/* POSIX compatible signal blocking for threads. 1/* POSIX compatible signal blocking for threads.
2 Copyright (C) 2011 Free Software Foundation, Inc. 2 Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
diff --git a/lib/readlink.c b/lib/readlink.c
index 35d045b9a12..baac1322442 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
1/* Stub for readlink(). 1/* Stub for readlink().
2 Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc. 2 Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
diff --git a/lib/sha1.c b/lib/sha1.c
index f832d050574..0d82af14bc9 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,7 +1,7 @@
1/* sha1.c - Functions to compute SHA1 message digest of files or 1/* sha1.c - Functions to compute SHA1 message digest of files or
2 memory blocks according to the NIST specification FIPS-180-1. 2 memory blocks according to the NIST specification FIPS-180-1.
3 3
4 Copyright (C) 2000-2001, 2003-2006, 2008-2011 Free Software Foundation, Inc. 4 Copyright (C) 2000-2001, 2003-2006, 2008-2012 Free Software Foundation, Inc.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the 7 under the terms of the GNU General Public License as published by the
@@ -14,8 +14,7 @@
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation, 17 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 18
20/* Written by Scott G. Miller 19/* Written by Scott G. Miller
21 Credits: 20 Credits:
@@ -26,7 +25,8 @@
26 25
27#include "sha1.h" 26#include "sha1.h"
28 27
29#include <stddef.h> 28#include <stdalign.h>
29#include <stdint.h>
30#include <stdlib.h> 30#include <stdlib.h>
31#include <string.h> 31#include <string.h>
32 32
@@ -241,8 +241,7 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
241 if (len >= 64) 241 if (len >= 64)
242 { 242 {
243#if !_STRING_ARCH_unaligned 243#if !_STRING_ARCH_unaligned
244# define alignof(type) offsetof (struct { char c; type x; }, x) 244# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
245# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
246 if (UNALIGNED_P (buffer)) 245 if (UNALIGNED_P (buffer))
247 while (len > 64) 246 while (len > 64)
248 { 247 {
@@ -306,13 +305,13 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
306 uint32_t c = ctx->C; 305 uint32_t c = ctx->C;
307 uint32_t d = ctx->D; 306 uint32_t d = ctx->D;
308 uint32_t e = ctx->E; 307 uint32_t e = ctx->E;
308 uint32_t lolen = len;
309 309
310 /* First increment the byte count. RFC 1321 specifies the possible 310 /* First increment the byte count. RFC 1321 specifies the possible
311 length of the file up to 2^64 bits. Here we only compute the 311 length of the file up to 2^64 bits. Here we only compute the
312 number of bytes. Do a double word increment. */ 312 number of bytes. Do a double word increment. */
313 ctx->total[0] += len; 313 ctx->total[0] += lolen;
314 if (ctx->total[0] < len) 314 ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
315 ++ctx->total[1];
316 315
317#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) 316#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
318 317
diff --git a/lib/sha1.h b/lib/sha1.h
index 47b56f2adfb..0d9ced0298d 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -1,6 +1,6 @@
1/* Declarations of functions and data types used for SHA1 sum 1/* Declarations of functions and data types used for SHA1 sum
2 library functions. 2 library functions.
3 Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2011 Free Software 3 Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2012 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
@@ -14,8 +14,7 @@
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation, 17 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 18
20#ifndef SHA1_H 19#ifndef SHA1_H
21# define SHA1_H 1 20# define SHA1_H 1
diff --git a/lib/sha256.c b/lib/sha256.c
index 4dbb5e91291..a8d29da18dd 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -1,7 +1,7 @@
1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or 1/* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
2 memory blocks according to the NIST specification FIPS-180-2. 2 memory blocks according to the NIST specification FIPS-180-2.
3 3
4 Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. 4 Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 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 7 it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@
24 24
25#include "sha256.h" 25#include "sha256.h"
26 26
27#include <stddef.h> 27#include <stdalign.h>
28#include <stdint.h>
28#include <stdlib.h> 29#include <stdlib.h>
29#include <string.h> 30#include <string.h>
30 31
@@ -373,8 +374,7 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
373 if (len >= 64) 374 if (len >= 64)
374 { 375 {
375#if !_STRING_ARCH_unaligned 376#if !_STRING_ARCH_unaligned
376# define alignof(type) offsetof (struct { char c; type x; }, x) 377# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
377# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
378 if (UNALIGNED_P (buffer)) 378 if (UNALIGNED_P (buffer))
379 while (len > 64) 379 while (len > 64)
380 { 380 {
@@ -454,13 +454,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
454 uint32_t f = ctx->state[5]; 454 uint32_t f = ctx->state[5];
455 uint32_t g = ctx->state[6]; 455 uint32_t g = ctx->state[6];
456 uint32_t h = ctx->state[7]; 456 uint32_t h = ctx->state[7];
457 uint32_t lolen = len;
457 458
458 /* First increment the byte count. FIPS PUB 180-2 specifies the possible 459 /* First increment the byte count. FIPS PUB 180-2 specifies the possible
459 length of the file up to 2^64 bits. Here we only compute the 460 length of the file up to 2^64 bits. Here we only compute the
460 number of bytes. Do a double word increment. */ 461 number of bytes. Do a double word increment. */
461 ctx->total[0] += len; 462 ctx->total[0] += lolen;
462 if (ctx->total[0] < len) 463 ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
463 ++ctx->total[1];
464 464
465#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) 465#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
466#define S0(x) (rol(x,25)^rol(x,14)^(x>>3)) 466#define S0(x) (rol(x,25)^rol(x,14)^(x>>3))
diff --git a/lib/sha256.h b/lib/sha256.h
index 9f6bf14bf0c..d69b83fc9fc 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -1,6 +1,6 @@
1/* Declarations of functions and data types used for SHA256 and SHA224 sum 1/* Declarations of functions and data types used for SHA256 and SHA224 sum
2 library functions. 2 library functions.
3 Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/sha512.c b/lib/sha512.c
index 5c2e3ab9f81..cf62f2034e5 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -1,7 +1,7 @@
1/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or 1/* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
2 memory blocks according to the NIST specification FIPS-180-2. 2 memory blocks according to the NIST specification FIPS-180-2.
3 3
4 Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. 4 Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 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 7 it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@
24 24
25#include "sha512.h" 25#include "sha512.h"
26 26
27#include <stddef.h> 27#include <stdalign.h>
28#include <stdint.h>
28#include <stdlib.h> 29#include <stdlib.h>
29#include <string.h> 30#include <string.h>
30 31
@@ -381,8 +382,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
381 if (len >= 128) 382 if (len >= 128)
382 { 383 {
383#if !_STRING_ARCH_unaligned 384#if !_STRING_ARCH_unaligned
384# define alignof(type) offsetof (struct { char c; type x; }, x) 385# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (u64) != 0)
385# define UNALIGNED_P(p) (((size_t) p) % alignof (u64) != 0)
386 if (UNALIGNED_P (buffer)) 386 if (UNALIGNED_P (buffer))
387 while (len > 128) 387 while (len > 128)
388 { 388 {
@@ -485,13 +485,15 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
485 u64 f = ctx->state[5]; 485 u64 f = ctx->state[5];
486 u64 g = ctx->state[6]; 486 u64 g = ctx->state[6];
487 u64 h = ctx->state[7]; 487 u64 h = ctx->state[7];
488 u64 lolen = u64size (len);
488 489
489 /* First increment the byte count. FIPS PUB 180-2 specifies the possible 490 /* First increment the byte count. FIPS PUB 180-2 specifies the possible
490 length of the file up to 2^128 bits. Here we only compute the 491 length of the file up to 2^128 bits. Here we only compute the
491 number of bytes. Do a double word increment. */ 492 number of bytes. Do a double word increment. */
492 ctx->total[0] = u64plus (ctx->total[0], u64lo (len)); 493 ctx->total[0] = u64plus (ctx->total[0], lolen);
493 if (u64lt (ctx->total[0], u64lo (len))) 494 ctx->total[1] = u64plus (ctx->total[1],
494 ctx->total[1] = u64plus (ctx->total[1], u64lo (1)); 495 u64plus (u64size (len >> 31 >> 31 >> 2),
496 u64lo (u64lt (ctx->total[0], lolen))));
495 497
496#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7))) 498#define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
497#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6))) 499#define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
diff --git a/lib/sha512.h b/lib/sha512.h
index af8b354ebd0..ddf91d6c726 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -1,6 +1,6 @@
1/* Declarations of functions and data types used for SHA512 and SHA384 sum 1/* Declarations of functions and data types used for SHA512 and SHA384 sum
2 library functions. 2 library functions.
3 Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/signal.in.h b/lib/signal.in.h
index e18e0b29832..e0f0554bdbd 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <signal.h>. 1/* A GNU-like <signal.h>.
2 2
3 Copyright (C) 2006-2011 Free Software Foundation, Inc. 3 Copyright (C) 2006-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/sigprocmask.c b/lib/sigprocmask.c
index e75c7576cdf..be53d540012 100644
--- a/lib/sigprocmask.c
+++ b/lib/sigprocmask.c
@@ -1,5 +1,5 @@
1/* POSIX compatible signal blocking. 1/* POSIX compatible signal blocking.
2 Copyright (C) 2006-2011 Free Software Foundation, Inc. 2 Copyright (C) 2006-2012 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2006. 3 Written by Bruno Haible <bruno@clisp.org>, 2006.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
@@ -32,7 +32,7 @@
32 also does not have the POSIX sigaction() function, only the 32 also does not have the POSIX sigaction() function, only the
33 signal() function. We also assume signal() has SysV semantics, 33 signal() function. We also assume signal() has SysV semantics,
34 where any handler is uninstalled prior to being invoked. This is 34 where any handler is uninstalled prior to being invoked. This is
35 true for Woe32 platforms. */ 35 true for native Windows platforms. */
36 36
37/* We use raw signal(), but also provide a wrapper rpl_signal() so 37/* We use raw signal(), but also provide a wrapper rpl_signal() so
38 that applications can query or change a blocked signal. */ 38 that applications can query or change a blocked signal. */
@@ -344,5 +344,6 @@ _gl_raise_SIGPIPE (void)
344 else if (handler != SIG_IGN) 344 else if (handler != SIG_IGN)
345 (*handler) (SIGPIPE); 345 (*handler) (SIGPIPE);
346 } 346 }
347 return 0;
347} 348}
348#endif 349#endif
diff --git a/lib/stat.c b/lib/stat.c
index 1397aa93290..1fc633eeef0 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -1,5 +1,5 @@
1/* Work around platform bugs in stat. 1/* Work around platform bugs in stat.
2 Copyright (C) 2009-2011 Free Software Foundation, Inc. 2 Copyright (C) 2009-2012 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -27,6 +27,20 @@
27#include <sys/stat.h> 27#include <sys/stat.h>
28#undef __need_system_sys_stat_h 28#undef __need_system_sys_stat_h
29 29
30#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
31# if _GL_WINDOWS_64_BIT_ST_SIZE
32# define stat _stati64
33# define REPLACE_FUNC_STAT_DIR 1
34# undef REPLACE_FUNC_STAT_FILE
35# elif REPLACE_FUNC_STAT_FILE
36/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
37 Bypass it. */
38# define stat _stat
39# define REPLACE_FUNC_STAT_DIR 1
40# undef REPLACE_FUNC_STAT_FILE
41# endif
42#endif
43
30static inline int 44static inline int
31orig_stat (const char *filename, struct stat *buf) 45orig_stat (const char *filename, struct stat *buf)
32{ 46{
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
new file mode 100644
index 00000000000..8fba6943f69
--- /dev/null
+++ b/lib/stdalign.in.h
@@ -0,0 +1,90 @@
1/* A substitute for ISO C11 <stdalign.h>.
2
3 Copyright 2011-2012 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/* Written by Paul Eggert and Bruno Haible. */
19
20#ifndef _GL_STDALIGN_H
21#define _GL_STDALIGN_H
22
23/* ISO C11 <stdalign.h> for platforms that lack it.
24
25 References:
26 ISO C11 (latest free draft
27 <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
28 sections 6.5.3.4, 6.7.5, 7.15.
29 C++11 (latest free draft
30 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
31 section 18.10. */
32
33/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
34 requirement of a structure member (i.e., slot or field) that is of
35 type TYPE, as an integer constant expression.
36
37 This differs from GCC's __alignof__ operator, which can yield a
38 better-performing alignment for an object of that type. For
39 example, on x86 with GCC, __alignof__ (double) and __alignof__
40 (long long) are 8, whereas alignof (double) and alignof (long long)
41 are 4 unless the option '-malign-double' is used.
42
43 The result cannot be used as a value for an 'enum' constant, if you
44 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
45#include <stddef.h>
46#if defined __cplusplus
47 template <class __t> struct __alignof_helper { char __a; __t __b; };
48# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
49#else
50# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
51#endif
52#define alignof _Alignof
53#define __alignof_is_defined 1
54
55/* alignas (A), also known as _Alignas (A), aligns a variable or type
56 to the alignment A, where A is an integer constant expression. For
57 example:
58
59 int alignas (8) foo;
60 struct s { int a; int alignas (8) bar; };
61
62 aligns the address of FOO and the offset of BAR to be multiples of 8.
63
64 A should be a power of two that is at least the type's alignment
65 and at most the implementation's alignment limit. This limit is
66 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable
67 to MSVC through at least version 10.0, A should be an integer
68 constant, as MSVC does not support expressions such as 1 << 3.
69 To be portable to Sun C 5.11, do not align auto variables to
70 anything stricter than their default alignment.
71
72 The following C11 requirements are not supported here:
73
74 - If A is zero, alignas has no effect.
75 - alignas can be used multiple times; the strictest one wins.
76 - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
77
78 */
79
80#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
81# define _Alignas(a) __attribute__ ((__aligned__ (a)))
82#elif 1300 <= _MSC_VER
83# define _Alignas(a) __declspec (align (a))
84#endif
85#ifdef _Alignas
86# define alignas _Alignas
87# define __alignas_is_defined 1
88#endif
89
90#endif /* _GL_STDALIGN_H */
diff --git a/lib/stdarg.in.h b/lib/stdarg.in.h
index 43f96070708..53104a61923 100644
--- a/lib/stdarg.in.h
+++ b/lib/stdarg.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <stdarg.h>. 1/* Substitute for and wrapper around <stdarg.h>.
2 Copyright (C) 2008-2011 Free Software Foundation, Inc. 2 Copyright (C) 2008-2012 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation, 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 16
18#ifndef _@GUARD_PREFIX@_STDARG_H 17#ifndef _@GUARD_PREFIX@_STDARG_H
19 18
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index b64dc75b20c..ed1f9aa488b 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc. 1/* Copyright (C) 2001-2003, 2006-2012 Free Software Foundation, Inc.
2 Written by Bruno Haible <haible@clisp.cons.org>, 2001. 2 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
@@ -12,8 +12,7 @@
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation, 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 16
18#ifndef _GL_STDBOOL_H 17#ifndef _GL_STDBOOL_H
19#define _GL_STDBOOL_H 18#define _GL_STDBOOL_H
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index c7b98e7dcc5..17fcaea2bfe 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. 1/* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
2 2
3 Copyright (C) 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19/* Written by Eric Blake. */ 18/* Written by Eric Blake. */
20 19
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index b6d08c754ae..59c00d59c03 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
1/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. 1/* Copyright (C) 2001-2002, 2004-2012 Free Software Foundation, Inc.
2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. 2 Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3 This file is part of gnulib. 3 This file is part of gnulib.
4 4
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19/* 18/*
20 * ISO C 99 <stdint.h> for platforms that lack it. 19 * ISO C 99 <stdint.h> for platforms that lack it.
@@ -34,6 +33,16 @@
34 <inttypes.h>. */ 33 <inttypes.h>. */
35#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H 34#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
36 35
36/* On Android (Bionic libc), <sys/types.h> includes this file before
37 having defined 'time_t'. Therefore in this case avoid including
38 other system header files; just include the system's <stdint.h>.
39 Ideally we should test __BIONIC__ here, but it is only defined after
40 <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
41#if defined __ANDROID__ \
42 && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
43# @INCLUDE_NEXT@ @NEXT_STDINT_H@
44#else
45
37/* Get those types that are already defined in other system include 46/* Get those types that are already defined in other system include
38 files, so that we can "#define int8_t signed char" below without 47 files, so that we can "#define int8_t signed char" below without
39 worrying about a later system include file containing a "typedef 48 worrying about a later system include file containing a "typedef
@@ -49,6 +58,17 @@
49 diagnostics. */ 58 diagnostics. */
50# define __STDINT_H__ 59# define __STDINT_H__
51# endif 60# endif
61
62 /* Some pre-C++11 <stdint.h> implementations need this. */
63# ifdef __cplusplus
64# ifndef __STDC_CONSTANT_MACROS
65# define __STDC_CONSTANT_MACROS 1
66# endif
67# ifndef __STDC_LIMIT_MACROS
68# define __STDC_LIMIT_MACROS 1
69# endif
70# endif
71
52 /* Other systems may have an incomplete or buggy <stdint.h>. 72 /* Other systems may have an incomplete or buggy <stdint.h>.
53 Include it before <inttypes.h>, since any "#include <stdint.h>" 73 Include it before <inttypes.h>, since any "#include <stdint.h>"
54 in <inttypes.h> would reinclude us, skipping our contents because 74 in <inttypes.h> would reinclude us, skipping our contents because
@@ -70,7 +90,8 @@
70# include <sys/types.h> 90# include <sys/types.h>
71#endif 91#endif
72 92
73/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ 93/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
94 LONG_MIN, LONG_MAX, ULONG_MAX. */
74#include <limits.h> 95#include <limits.h>
75 96
76#if @HAVE_INTTYPES_H@ 97#if @HAVE_INTTYPES_H@
@@ -226,8 +247,9 @@ typedef unsigned long long int gl_uint64_t;
226 247
227/* Here we assume a standard architecture where the hardware integer 248/* Here we assume a standard architecture where the hardware integer
228 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types 249 types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
229 are taken from the same list of types. Assume that 'long int' 250 are taken from the same list of types. The following code normally
230 is fast enough for all narrower integers. */ 251 uses types consistent with glibc, as that lessens the chance of
252 incompatibility with older GNU hosts. */
231 253
232#undef int_fast8_t 254#undef int_fast8_t
233#undef uint_fast8_t 255#undef uint_fast8_t
@@ -237,12 +259,21 @@ typedef unsigned long long int gl_uint64_t;
237#undef uint_fast32_t 259#undef uint_fast32_t
238#undef int_fast64_t 260#undef int_fast64_t
239#undef uint_fast64_t 261#undef uint_fast64_t
240typedef long int gl_int_fast8_t; 262typedef signed char gl_int_fast8_t;
241typedef unsigned long int gl_uint_fast8_t; 263typedef unsigned char gl_uint_fast8_t;
242typedef long int gl_int_fast16_t; 264
243typedef unsigned long int gl_uint_fast16_t; 265#ifdef __sun
266/* Define types compatible with SunOS 5.10, so that code compiled under
267 earlier SunOS versions works with code compiled under SunOS 5.10. */
268typedef int gl_int_fast32_t;
269typedef unsigned int gl_uint_fast32_t;
270#else
244typedef long int gl_int_fast32_t; 271typedef long int gl_int_fast32_t;
245typedef unsigned long int gl_uint_fast32_t; 272typedef unsigned long int gl_uint_fast32_t;
273#endif
274typedef gl_int_fast32_t gl_int_fast16_t;
275typedef gl_uint_fast32_t gl_uint_fast16_t;
276
246#define int_fast8_t gl_int_fast8_t 277#define int_fast8_t gl_int_fast8_t
247#define uint_fast8_t gl_uint_fast8_t 278#define uint_fast8_t gl_uint_fast8_t
248#define int_fast16_t gl_int_fast16_t 279#define int_fast16_t gl_int_fast16_t
@@ -313,8 +344,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
313 344
314/* 7.18.2. Limits of specified-width integer types */ 345/* 7.18.2. Limits of specified-width integer types */
315 346
316#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
317
318/* 7.18.2.1. Limits of exact-width integer types */ 347/* 7.18.2.1. Limits of exact-width integer types */
319 348
320/* Here we assume a standard architecture where the hardware integer 349/* Here we assume a standard architecture where the hardware integer
@@ -400,23 +429,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
400#undef INT_FAST8_MIN 429#undef INT_FAST8_MIN
401#undef INT_FAST8_MAX 430#undef INT_FAST8_MAX
402#undef UINT_FAST8_MAX 431#undef UINT_FAST8_MAX
403#define INT_FAST8_MIN LONG_MIN 432#define INT_FAST8_MIN SCHAR_MIN
404#define INT_FAST8_MAX LONG_MAX 433#define INT_FAST8_MAX SCHAR_MAX
405#define UINT_FAST8_MAX ULONG_MAX 434#define UINT_FAST8_MAX UCHAR_MAX
406 435
407#undef INT_FAST16_MIN 436#undef INT_FAST16_MIN
408#undef INT_FAST16_MAX 437#undef INT_FAST16_MAX
409#undef UINT_FAST16_MAX 438#undef UINT_FAST16_MAX
410#define INT_FAST16_MIN LONG_MIN 439#define INT_FAST16_MIN INT_FAST32_MIN
411#define INT_FAST16_MAX LONG_MAX 440#define INT_FAST16_MAX INT_FAST32_MAX
412#define UINT_FAST16_MAX ULONG_MAX 441#define UINT_FAST16_MAX UINT_FAST32_MAX
413 442
414#undef INT_FAST32_MIN 443#undef INT_FAST32_MIN
415#undef INT_FAST32_MAX 444#undef INT_FAST32_MAX
416#undef UINT_FAST32_MAX 445#undef UINT_FAST32_MAX
417#define INT_FAST32_MIN LONG_MIN 446#ifdef __sun
418#define INT_FAST32_MAX LONG_MAX 447# define INT_FAST32_MIN INT_MIN
419#define UINT_FAST32_MAX ULONG_MAX 448# define INT_FAST32_MAX INT_MAX
449# define UINT_FAST32_MAX UINT_MAX
450#else
451# define INT_FAST32_MIN LONG_MIN
452# define INT_FAST32_MAX LONG_MAX
453# define UINT_FAST32_MAX ULONG_MAX
454#endif
420 455
421#undef INT_FAST64_MIN 456#undef INT_FAST64_MIN
422#undef INT_FAST64_MAX 457#undef INT_FAST64_MAX
@@ -534,12 +569,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
534#define WINT_MAX \ 569#define WINT_MAX \
535 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) 570 _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
536 571
537#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
538
539/* 7.18.4. Macros for integer constants */ 572/* 7.18.4. Macros for integer constants */
540 573
541#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
542
543/* 7.18.4.1. Macros for minimum-width integer constants */ 574/* 7.18.4.1. Macros for minimum-width integer constants */
544/* According to ISO C 99 Technical Corrigendum 1 */ 575/* According to ISO C 99 Technical Corrigendum 1 */
545 576
@@ -600,7 +631,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
600# endif 631# endif
601#endif 632#endif
602 633
603#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
604
605#endif /* _@GUARD_PREFIX@_STDINT_H */ 634#endif /* _@GUARD_PREFIX@_STDINT_H */
635#endif /* !(defined __ANDROID__ && ...) */
606#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ 636#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index ce00af574a8..b1b543dee72 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdio.h>. 1/* A GNU-like <stdio.h>.
2 2
3 Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc. 3 Copyright (C) 2004, 2007-2012 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#if __GNUC__ >= 3 18#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
@@ -53,7 +52,8 @@
53#include <stddef.h> 52#include <stddef.h>
54 53
55/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 54/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
56 and eglibc 2.11.2. */ 55 and eglibc 2.11.2.
56 May also define off_t to a 64-bit type on native Windows. */
57#include <sys/types.h> 57#include <sys/types.h>
58 58
59/* The __attribute__ feature is available in gcc versions 2.5 and later. 59/* The __attribute__ feature is available in gcc versions 2.5 and later.
@@ -186,7 +186,7 @@ _GL_CXXALIASWARN (fdopen);
186#elif defined GNULIB_POSIXCHECK 186#elif defined GNULIB_POSIXCHECK
187# undef fdopen 187# undef fdopen
188/* Assume fdopen is always declared. */ 188/* Assume fdopen is always declared. */
189_GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - " 189_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
190 "use gnulib module fdopen for portability"); 190 "use gnulib module fdopen for portability");
191#endif 191#endif
192 192
@@ -259,7 +259,7 @@ _GL_CXXALIASWARN (fopen);
259#elif defined GNULIB_POSIXCHECK 259#elif defined GNULIB_POSIXCHECK
260# undef fopen 260# undef fopen
261/* Assume fopen is always declared. */ 261/* Assume fopen is always declared. */
262_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - " 262_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
263 "use gnulib module fopen for portability"); 263 "use gnulib module fopen for portability");
264#endif 264#endif
265 265
@@ -387,7 +387,7 @@ _GL_CXXALIASWARN (freopen);
387# undef freopen 387# undef freopen
388/* Assume freopen is always declared. */ 388/* Assume freopen is always declared. */
389_GL_WARN_ON_USE (freopen, 389_GL_WARN_ON_USE (freopen,
390 "freopen on Win32 platforms is not POSIX compatible - " 390 "freopen on native Windows platforms is not POSIX compliant - "
391 "use gnulib module freopen for portability"); 391 "use gnulib module freopen for portability");
392#endif 392#endif
393 393
@@ -699,22 +699,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
699# endif 699# endif
700#endif 700#endif
701 701
702#if @GNULIB_GETS@
703# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
704# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
705# undef gets
706# define gets rpl_gets
707# endif
708_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
709_GL_CXXALIAS_RPL (gets, char *, (char *s));
710# else
711_GL_CXXALIAS_SYS (gets, char *, (char *s));
712# undef gets
713# endif
714_GL_CXXALIASWARN (gets);
715/* It is very rare that the developer ever has full control of stdin, 702/* It is very rare that the developer ever has full control of stdin,
716 so any use of gets warrants an unconditional warning. Assume it is 703 so any use of gets warrants an unconditional warning; besides, C11
717 always declared, since it is required by C89. */ 704 removed it. */
705#undef gets
706#if HAVE_RAW_DECL_GETS
718_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); 707_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
719#endif 708#endif
720 709
@@ -779,7 +768,7 @@ _GL_CXXALIASWARN (pclose);
779#elif defined GNULIB_POSIXCHECK 768#elif defined GNULIB_POSIXCHECK
780# undef pclose 769# undef pclose
781# if HAVE_RAW_DECL_PCLOSE 770# if HAVE_RAW_DECL_PCLOSE
782_GL_WARN_ON_USE (pclose, "popen is unportable - " 771_GL_WARN_ON_USE (pclose, "pclose is unportable - "
783 "use gnulib module pclose for more portability"); 772 "use gnulib module pclose for more portability");
784# endif 773# endif
785#endif 774#endif
@@ -1054,9 +1043,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
1054# endif 1043# endif
1055#endif 1044#endif
1056 1045
1057/* Some people would argue that sprintf should be handled like gets 1046/* Some people would argue that all sprintf uses should be warned about
1058 (for example, OpenBSD issues a link warning for both functions), 1047 (for example, OpenBSD issues a link warning for it),
1059 since both can cause security holes due to buffer overruns. 1048 since it can cause security holes due to buffer overruns.
1060 However, we believe that sprintf can be used safely, and is more 1049 However, we believe that sprintf can be used safely, and is more
1061 efficient than snprintf in those safe cases; and as proof of our 1050 efficient than snprintf in those safe cases; and as proof of our
1062 belief, we use sprintf in several gnulib modules. So this header 1051 belief, we use sprintf in several gnulib modules. So this header
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 047fac18b83..b546133c3af 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
1/* A GNU-like <stdlib.h>. 1/* A GNU-like <stdlib.h>.
2 2
3 Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc. 3 Copyright (C) 1995, 2001-2004, 2006-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -49,6 +49,11 @@
49# include <sys/loadavg.h> 49# include <sys/loadavg.h>
50#endif 50#endif
51 51
52/* Native Windows platforms declare mktemp() in <io.h>. */
53#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
54# include <io.h>
55#endif
56
52#if @GNULIB_RANDOM_R@ 57#if @GNULIB_RANDOM_R@
53 58
54/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included 59/* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
@@ -58,7 +63,7 @@
58# include <random.h> 63# include <random.h>
59# endif 64# endif
60 65
61# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@ 66# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
62# include <stdint.h> 67# include <stdint.h>
63# endif 68# endif
64 69
@@ -89,6 +94,14 @@ struct random_data
89# include <unistd.h> 94# include <unistd.h>
90#endif 95#endif
91 96
97/* The __attribute__ feature is available in gcc versions 2.5 and later.
98 The attribute __pure__ was added in gcc 2.96. */
99#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
100# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
101#else
102# define _GL_ATTRIBUTE_PURE /* empty */
103#endif
104
92/* The definition of _Noreturn is copied here. */ 105/* The definition of _Noreturn is copied here. */
93 106
94/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 107/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -133,7 +146,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
133/* Parse a signed decimal integer. 146/* Parse a signed decimal integer.
134 Returns the value of the integer. Errors are not detected. */ 147 Returns the value of the integer. Errors are not detected. */
135# if !@HAVE_ATOLL@ 148# if !@HAVE_ATOLL@
136_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1))); 149_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
150 _GL_ATTRIBUTE_PURE
151 _GL_ARG_NONNULL ((1)));
137# endif 152# endif
138_GL_CXXALIAS_SYS (atoll, long long, (const char *string)); 153_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
139_GL_CXXALIASWARN (atoll); 154_GL_CXXALIASWARN (atoll);
@@ -247,7 +262,7 @@ _GL_CXXALIASWARN (grantpt);
247#elif defined GNULIB_POSIXCHECK 262#elif defined GNULIB_POSIXCHECK
248# undef grantpt 263# undef grantpt
249# if HAVE_RAW_DECL_GRANTPT 264# if HAVE_RAW_DECL_GRANTPT
250_GL_WARN_ON_USE (ptsname, "grantpt is not portable - " 265_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
251 "use gnulib module grantpt for portability"); 266 "use gnulib module grantpt for portability");
252# endif 267# endif
253#endif 268#endif
@@ -423,6 +438,22 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
423# endif 438# endif
424#endif 439#endif
425 440
441#if @GNULIB_POSIX_OPENPT@
442/* Return an FD open to the master side of a pseudo-terminal. Flags should
443 include O_RDWR, and may also include O_NOCTTY. */
444# if !@HAVE_POSIX_OPENPT@
445_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
446# endif
447_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
448_GL_CXXALIASWARN (posix_openpt);
449#elif defined GNULIB_POSIXCHECK
450# undef posix_openpt
451# if HAVE_RAW_DECL_POSIX_OPENPT
452_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
453 "use gnulib module posix_openpt for portability");
454# endif
455#endif
456
426#if @GNULIB_PTSNAME@ 457#if @GNULIB_PTSNAME@
427/* Return the pathname of the pseudo-terminal slave associated with 458/* Return the pathname of the pseudo-terminal slave associated with
428 the master FD is open on, or NULL on errors. */ 459 the master FD is open on, or NULL on errors. */
@@ -439,6 +470,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
439# endif 470# endif
440#endif 471#endif
441 472
473#if @GNULIB_PTSNAME_R@
474/* Set the pathname of the pseudo-terminal slave associated with
475 the master FD is open on and return 0, or set errno and return
476 non-zero on errors. */
477# if @REPLACE_PTSNAME_R@
478# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
479# undef ptsname_r
480# define ptsname_r rpl_ptsname_r
481# endif
482_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
483_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
484# else
485# if !@HAVE_PTSNAME_R@
486_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
487# endif
488_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
489# endif
490_GL_CXXALIASWARN (ptsname_r);
491#elif defined GNULIB_POSIXCHECK
492# undef ptsname_r
493# if HAVE_RAW_DECL_PTSNAME_R
494_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
495 "use gnulib module ptsname_r for portability");
496# endif
497#endif
498
442#if @GNULIB_PUTENV@ 499#if @GNULIB_PUTENV@
443# if @REPLACE_PUTENV@ 500# if @REPLACE_PUTENV@
444# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 501# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -462,12 +519,83 @@ _GL_CXXALIASWARN (putenv);
462# endif 519# endif
463#endif 520#endif
464 521
522
523#if @GNULIB_RANDOM@
524# if !@HAVE_RANDOM@
525_GL_FUNCDECL_SYS (random, long, (void));
526# endif
527_GL_CXXALIAS_SYS (random, long, (void));
528_GL_CXXALIASWARN (random);
529#elif defined GNULIB_POSIXCHECK
530# undef random
531# if HAVE_RAW_DECL_RANDOM
532_GL_WARN_ON_USE (random, "random is unportable - "
533 "use gnulib module random for portability");
534# endif
535#endif
536
537#if @GNULIB_RANDOM@
538# if !@HAVE_RANDOM@
539_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
540# endif
541_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
542_GL_CXXALIASWARN (srandom);
543#elif defined GNULIB_POSIXCHECK
544# undef srandom
545# if HAVE_RAW_DECL_SRANDOM
546_GL_WARN_ON_USE (srandom, "srandom is unportable - "
547 "use gnulib module random for portability");
548# endif
549#endif
550
551#if @GNULIB_RANDOM@
552# if !@HAVE_RANDOM@
553_GL_FUNCDECL_SYS (initstate, char *,
554 (unsigned int seed, char *buf, size_t buf_size)
555 _GL_ARG_NONNULL ((2)));
556# endif
557_GL_CXXALIAS_SYS (initstate, char *,
558 (unsigned int seed, char *buf, size_t buf_size));
559_GL_CXXALIASWARN (initstate);
560#elif defined GNULIB_POSIXCHECK
561# undef initstate
562# if HAVE_RAW_DECL_INITSTATE_R
563_GL_WARN_ON_USE (initstate, "initstate is unportable - "
564 "use gnulib module random for portability");
565# endif
566#endif
567
568#if @GNULIB_RANDOM@
569# if !@HAVE_RANDOM@
570_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
571# endif
572_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
573_GL_CXXALIASWARN (setstate);
574#elif defined GNULIB_POSIXCHECK
575# undef setstate
576# if HAVE_RAW_DECL_SETSTATE_R
577_GL_WARN_ON_USE (setstate, "setstate is unportable - "
578 "use gnulib module random for portability");
579# endif
580#endif
581
582
465#if @GNULIB_RANDOM_R@ 583#if @GNULIB_RANDOM_R@
466# if !@HAVE_RANDOM_R@ 584# if @REPLACE_RANDOM_R@
585# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
586# undef random_r
587# define random_r rpl_random_r
588# endif
589_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
590 _GL_ARG_NONNULL ((1, 2)));
591_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
592# else
593# if !@HAVE_RANDOM_R@
467_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result) 594_GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
468 _GL_ARG_NONNULL ((1, 2))); 595 _GL_ARG_NONNULL ((1, 2)));
469# endif 596# endif
470_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result)); 597_GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
598# endif
471_GL_CXXALIASWARN (random_r); 599_GL_CXXALIASWARN (random_r);
472#elif defined GNULIB_POSIXCHECK 600#elif defined GNULIB_POSIXCHECK
473# undef random_r 601# undef random_r
@@ -478,13 +606,25 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
478#endif 606#endif
479 607
480#if @GNULIB_RANDOM_R@ 608#if @GNULIB_RANDOM_R@
481# if !@HAVE_RANDOM_R@ 609# if @REPLACE_RANDOM_R@
610# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
611# undef srandom_r
612# define srandom_r rpl_srandom_r
613# endif
614_GL_FUNCDECL_RPL (srandom_r, int,
615 (unsigned int seed, struct random_data *rand_state)
616 _GL_ARG_NONNULL ((2)));
617_GL_CXXALIAS_RPL (srandom_r, int,
618 (unsigned int seed, struct random_data *rand_state));
619# else
620# if !@HAVE_RANDOM_R@
482_GL_FUNCDECL_SYS (srandom_r, int, 621_GL_FUNCDECL_SYS (srandom_r, int,
483 (unsigned int seed, struct random_data *rand_state) 622 (unsigned int seed, struct random_data *rand_state)
484 _GL_ARG_NONNULL ((2))); 623 _GL_ARG_NONNULL ((2)));
485# endif 624# endif
486_GL_CXXALIAS_SYS (srandom_r, int, 625_GL_CXXALIAS_SYS (srandom_r, int,
487 (unsigned int seed, struct random_data *rand_state)); 626 (unsigned int seed, struct random_data *rand_state));
627# endif
488_GL_CXXALIASWARN (srandom_r); 628_GL_CXXALIASWARN (srandom_r);
489#elif defined GNULIB_POSIXCHECK 629#elif defined GNULIB_POSIXCHECK
490# undef srandom_r 630# undef srandom_r
@@ -495,15 +635,29 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
495#endif 635#endif
496 636
497#if @GNULIB_RANDOM_R@ 637#if @GNULIB_RANDOM_R@
498# if !@HAVE_RANDOM_R@ 638# if @REPLACE_RANDOM_R@
639# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
640# undef initstate_r
641# define initstate_r rpl_initstate_r
642# endif
643_GL_FUNCDECL_RPL (initstate_r, int,
644 (unsigned int seed, char *buf, size_t buf_size,
645 struct random_data *rand_state)
646 _GL_ARG_NONNULL ((2, 4)));
647_GL_CXXALIAS_RPL (initstate_r, int,
648 (unsigned int seed, char *buf, size_t buf_size,
649 struct random_data *rand_state));
650# else
651# if !@HAVE_RANDOM_R@
499_GL_FUNCDECL_SYS (initstate_r, int, 652_GL_FUNCDECL_SYS (initstate_r, int,
500 (unsigned int seed, char *buf, size_t buf_size, 653 (unsigned int seed, char *buf, size_t buf_size,
501 struct random_data *rand_state) 654 struct random_data *rand_state)
502 _GL_ARG_NONNULL ((2, 4))); 655 _GL_ARG_NONNULL ((2, 4)));
503# endif 656# endif
504_GL_CXXALIAS_SYS (initstate_r, int, 657_GL_CXXALIAS_SYS (initstate_r, int,
505 (unsigned int seed, char *buf, size_t buf_size, 658 (unsigned int seed, char *buf, size_t buf_size,
506 struct random_data *rand_state)); 659 struct random_data *rand_state));
660# endif
507_GL_CXXALIASWARN (initstate_r); 661_GL_CXXALIASWARN (initstate_r);
508#elif defined GNULIB_POSIXCHECK 662#elif defined GNULIB_POSIXCHECK
509# undef initstate_r 663# undef initstate_r
@@ -514,13 +668,25 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
514#endif 668#endif
515 669
516#if @GNULIB_RANDOM_R@ 670#if @GNULIB_RANDOM_R@
517# if !@HAVE_RANDOM_R@ 671# if @REPLACE_RANDOM_R@
672# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
673# undef setstate_r
674# define setstate_r rpl_setstate_r
675# endif
676_GL_FUNCDECL_RPL (setstate_r, int,
677 (char *arg_state, struct random_data *rand_state)
678 _GL_ARG_NONNULL ((1, 2)));
679_GL_CXXALIAS_RPL (setstate_r, int,
680 (char *arg_state, struct random_data *rand_state));
681# else
682# if !@HAVE_RANDOM_R@
518_GL_FUNCDECL_SYS (setstate_r, int, 683_GL_FUNCDECL_SYS (setstate_r, int,
519 (char *arg_state, struct random_data *rand_state) 684 (char *arg_state, struct random_data *rand_state)
520 _GL_ARG_NONNULL ((1, 2))); 685 _GL_ARG_NONNULL ((1, 2)));
521# endif 686# endif
522_GL_CXXALIAS_SYS (setstate_r, int, 687_GL_CXXALIAS_SYS (setstate_r, int,
523 (char *arg_state, struct random_data *rand_state)); 688 (char *arg_state, struct random_data *rand_state));
689# endif
524_GL_CXXALIASWARN (setstate_r); 690_GL_CXXALIASWARN (setstate_r);
525#elif defined GNULIB_POSIXCHECK 691#elif defined GNULIB_POSIXCHECK
526# undef setstate_r 692# undef setstate_r
diff --git a/lib/strftime.c b/lib/strftime.c
index acebc9adfad..c7b8eb5ef7e 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1991-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc. 1/* Copyright (C) 1991-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
2 2
3 NOTE: The canonical source of this file is maintained with the GNU C Library. 3 NOTE: The canonical source of this file is maintained with the GNU C Library.
4 Bugs can be reported to bug-glibc@prep.ai.mit.edu. 4 Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -40,7 +40,7 @@
40extern char *tzname[]; 40extern char *tzname[];
41#endif 41#endif
42 42
43/* Do multibyte processing if multibytes are supported, unless 43/* Do multibyte processing if multibyte encodings are supported, unless
44 multibyte sequences are safe in formats. Multibyte sequences are 44 multibyte sequences are safe in formats. Multibyte sequences are
45 safe if they cannot contain byte sequences that look like format 45 safe if they cannot contain byte sequences that look like format
46 conversion specifications. The multibyte encodings used by the 46 conversion specifications. The multibyte encodings used by the
@@ -289,7 +289,7 @@ extern char *tzname[];
289# define TOLOWER(Ch, L) tolower (Ch) 289# define TOLOWER(Ch, L) tolower (Ch)
290# endif 290# endif
291#endif 291#endif
292/* We don't use `isdigit' here since the locale dependent 292/* We don't use 'isdigit' here since the locale dependent
293 interpretation is not what we want here. We only need to accept 293 interpretation is not what we want here. We only need to accept
294 the arabic digits in the ASCII range. One day there is perhaps a 294 the arabic digits in the ASCII range. One day there is perhaps a
295 more reliable way to accept other sets of digits. */ 295 more reliable way to accept other sets of digits. */
@@ -437,7 +437,7 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
437#ifdef _NL_CURRENT 437#ifdef _NL_CURRENT
438 /* We cannot make the following values variables since we must delay 438 /* We cannot make the following values variables since we must delay
439 the evaluation of these values until really needed since some 439 the evaluation of these values until really needed since some
440 expressions might not be valid in every situation. The `struct tm' 440 expressions might not be valid in every situation. The 'struct tm'
441 might be generated by a strptime() call that initialized 441 might be generated by a strptime() call that initialized
442 only a few elements. Dereference the pointers only if the format 442 only a few elements. Dereference the pointers only if the format
443 requires this. Then it is ok to fail if the pointers are invalid. */ 443 requires this. Then it is ok to fail if the pointers are invalid. */
@@ -896,7 +896,7 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
896 goto do_number_body; 896 goto do_number_body;
897 897
898 do_number_spacepad: 898 do_number_spacepad:
899 /* Force `_' flag unless overridden by `0' or `-' flag. */ 899 /* Force '_' flag unless overridden by '0' or '-' flag. */
900 if (pad != L_('0') && pad != L_('-')) 900 if (pad != L_('0') && pad != L_('-'))
901 pad = L_('_'); 901 pad = L_('_');
902 902
diff --git a/lib/strftime.h b/lib/strftime.h
index 3410568a9a4..d3b4cb28c52 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
1/* declarations for strftime.c 1/* declarations for strftime.c
2 2
3 Copyright (C) 2002, 2004, 2008-2011 Free Software Foundation, Inc. 3 Copyright (C) 2002, 2004, 2008-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 497d15585ce..4f5fdbb5f22 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -1,6 +1,6 @@
1/* Convert string representation of a number into an intmax_t value. 1/* Convert string representation of a number into an intmax_t value.
2 2
3 Copyright (C) 1999, 2001-2004, 2006, 2009-2011 Free Software Foundation, 3 Copyright (C) 1999, 2001-2004, 2006, 2009-2012 Free Software Foundation,
4 Inc. 4 Inc.
5 5
6 This program is free software: you can redistribute it and/or modify 6 This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtol.c b/lib/strtol.c
index 6c15d11e8f8..bf992a8c272 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,6 +1,6 @@
1/* Convert string representation of a number into an integer value. 1/* Convert string representation of a number into an integer value.
2 2
3 Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2011 Free Software 3 Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2012 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6 NOTE: The canonical source of this file is maintained with the GNU C 6 NOTE: The canonical source of this file is maintained with the GNU C
@@ -40,7 +40,7 @@
40# include "../locale/localeinfo.h" 40# include "../locale/localeinfo.h"
41#endif 41#endif
42 42
43/* Nonzero if we are defining `strtoul' or `strtoull', operating on 43/* Nonzero if we are defining 'strtoul' or 'strtoull', operating on
44 unsigned integers. */ 44 unsigned integers. */
45#ifndef UNSIGNED 45#ifndef UNSIGNED
46# define UNSIGNED 0 46# define UNSIGNED 0
@@ -110,8 +110,8 @@
110# endif 110# endif
111#endif 111#endif
112 112
113/* If QUAD is defined, we are defining `strtoll' or `strtoull', 113/* If QUAD is defined, we are defining 'strtoll' or 'strtoull',
114 operating on `long long int's. */ 114 operating on 'long long int's. */
115#ifdef QUAD 115#ifdef QUAD
116# define LONG long long 116# define LONG long long
117# define STRTOL_LONG_MIN LLONG_MIN 117# define STRTOL_LONG_MIN LLONG_MIN
@@ -227,7 +227,7 @@
227 227
228 228
229 229
230/* Convert NPTR to an `unsigned long int' or `long int' in base BASE. 230/* Convert NPTR to an 'unsigned long int' or 'long int' in base BASE.
231 If BASE is 0 the base is determined by the presence of a leading 231 If BASE is 0 the base is determined by the presence of a leading
232 zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal. 232 zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
233 If BASE is < 2 or > 36, it is reset to 10. 233 If BASE is < 2 or > 36, it is reset to 10.
@@ -380,7 +380,7 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
380 380
381#if !UNSIGNED 381#if !UNSIGNED
382 /* Check for a value that is within the range of 382 /* Check for a value that is within the range of
383 `unsigned LONG int', but outside the range of `LONG int'. */ 383 'unsigned LONG int', but outside the range of 'LONG int'. */
384 if (overflow == 0 384 if (overflow == 0
385 && i > (negative 385 && i > (negative
386 ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1 386 ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
@@ -405,7 +405,7 @@ noconv:
405 /* We must handle a special case here: the base is 0 or 16 and the 405 /* We must handle a special case here: the base is 0 or 16 and the
406 first two characters are '0' and 'x', but the rest are no 406 first two characters are '0' and 'x', but the rest are no
407 hexadecimal digits. This is no error case. We return 0 and 407 hexadecimal digits. This is no error case. We return 0 and
408 ENDPTR points to the `x`. */ 408 ENDPTR points to the 'x'. */
409 if (endptr != NULL) 409 if (endptr != NULL)
410 { 410 {
411 if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X') 411 if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
diff --git a/lib/strtoll.c b/lib/strtoll.c
index 75afa4d9bc9..fdfceb01371 100644
--- a/lib/strtoll.c
+++ b/lib/strtoll.c
@@ -1,5 +1,5 @@
1/* Function to parse a `long long int' from text. 1/* Function to parse a 'long long int' from text.
2 Copyright (C) 1995-1997, 1999, 2001, 2009-2011 Free Software Foundation, 2 Copyright (C) 1995-1997, 1999, 2001, 2009-2012 Free Software Foundation,
3 Inc. 3 Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
diff --git a/lib/strtoul.c b/lib/strtoul.c
index 6fa6d0c2e01..e99da41edc0 100644
--- a/lib/strtoul.c
+++ b/lib/strtoul.c
@@ -1,4 +1,4 @@
1/* Copyright (C) 1991, 1997, 2009-2011 Free Software Foundation, Inc. 1/* Copyright (C) 1991, 1997, 2009-2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library. 2 This file is part of the GNU C Library.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtoull.c b/lib/strtoull.c
index bf259958d6e..33c2c5d9afb 100644
--- a/lib/strtoull.c
+++ b/lib/strtoull.c
@@ -1,5 +1,5 @@
1/* Function to parse an `unsigned long long int' from text. 1/* Function to parse an 'unsigned long long int' from text.
2 Copyright (C) 1995-1997, 1999, 2009-2011 Free Software Foundation, Inc. 2 Copyright (C) 1995-1997, 1999, 2009-2012 Free Software Foundation, Inc.
3 NOTE: The canonical source of this file is maintained with the GNU C 3 NOTE: The canonical source of this file is maintained with the GNU C
4 Library. Bugs can be reported to bug-glibc@gnu.org. 4 Library. Bugs can be reported to bug-glibc@gnu.org.
5 5
diff --git a/lib/symlink.c b/lib/symlink.c
index 2896cc9655b..642ca66b66c 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -1,5 +1,5 @@
1/* Stub for symlink(). 1/* Stub for symlink().
2 Copyright (C) 2009-2011 Free Software Foundation, Inc. 2 Copyright (C) 2009-2012 Free Software Foundation, Inc.
3 3
4 This program is free software: you can redistribute it and/or modify 4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 77a7177ca64..2efc1e92e06 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
1/* Provide a more complete sys/stat header file. 1/* Provide a more complete sys/stat header file.
2 Copyright (C) 2005-2011 Free Software Foundation, Inc. 2 Copyright (C) 2005-2012 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation, 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 16
18/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ 17/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
19 18
@@ -36,7 +35,8 @@
36 35
37#ifndef _@GUARD_PREFIX@_SYS_STAT_H 36#ifndef _@GUARD_PREFIX@_SYS_STAT_H
38 37
39/* Get nlink_t. */ 38/* Get nlink_t.
39 May also define off_t to a 64-bit type on native Windows. */
40#include <sys/types.h> 40#include <sys/types.h>
41 41
42/* Get struct timespec. */ 42/* Get struct timespec. */
@@ -62,6 +62,16 @@
62# include <direct.h> /* mingw64, MSVC 9 */ 62# include <direct.h> /* mingw64, MSVC 9 */
63#endif 63#endif
64 64
65/* Native Windows platforms declare umask() in <io.h>. */
66#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
67# include <io.h>
68#endif
69
70/* Large File Support on native Windows. */
71#if @WINDOWS_64_BIT_ST_SIZE@
72# define stat _stati64
73#endif
74
65#ifndef S_IFIFO 75#ifndef S_IFIFO
66# ifdef _S_IFIFO 76# ifdef _S_IFIFO
67# define S_IFIFO _S_IFIFO 77# define S_IFIFO _S_IFIFO
@@ -331,6 +341,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
331_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); 341_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
332# endif 342# endif
333_GL_CXXALIASWARN (fstat); 343_GL_CXXALIASWARN (fstat);
344#elif @WINDOWS_64_BIT_ST_SIZE@
345/* Above, we define stat to _stati64. */
346# define fstat _fstati64
334#elif defined GNULIB_POSIXCHECK 347#elif defined GNULIB_POSIXCHECK
335# undef fstat 348# undef fstat
336# if HAVE_RAW_DECL_FSTAT 349# if HAVE_RAW_DECL_FSTAT
@@ -611,14 +624,55 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
611/* We can't use the object-like #define stat rpl_stat, because of 624/* We can't use the object-like #define stat rpl_stat, because of
612 struct stat. This means that rpl_stat will not be used if the user 625 struct stat. This means that rpl_stat will not be used if the user
613 does (stat)(a,b). Oh well. */ 626 does (stat)(a,b). Oh well. */
614# undef stat 627# if defined _AIX && defined stat && defined _LARGE_FILES
615# ifdef _LARGE_FILES
616 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, 628 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
617 so we have to replace stat64() instead of stat(). */ 629 so we have to replace stat64() instead of stat(). */
618# define stat stat64
619# undef stat64 630# undef stat64
620# define stat64(name, st) rpl_stat (name, st) 631# define stat64(name, st) rpl_stat (name, st)
621# else /* !_LARGE_FILES */ 632# elif @WINDOWS_64_BIT_ST_SIZE@
633 /* Above, we define stat to _stati64. */
634# if defined __MINGW32__ && defined _stati64
635# ifndef _USE_32BIT_TIME_T
636 /* The system headers define _stati64 to _stat64. */
637# undef _stat64
638# define _stat64(name, st) rpl_stat (name, st)
639# endif
640# elif defined _MSC_VER && defined _stati64
641# ifdef _USE_32BIT_TIME_T
642 /* The system headers define _stati64 to _stat32i64. */
643# undef _stat32i64
644# define _stat32i64(name, st) rpl_stat (name, st)
645# else
646 /* The system headers define _stati64 to _stat64. */
647# undef _stat64
648# define _stat64(name, st) rpl_stat (name, st)
649# endif
650# else
651# undef _stati64
652# define _stati64(name, st) rpl_stat (name, st)
653# endif
654# elif defined __MINGW32__ && defined stat
655# ifdef _USE_32BIT_TIME_T
656 /* The system headers define stat to _stat32i64. */
657# undef _stat32i64
658# define _stat32i64(name, st) rpl_stat (name, st)
659# else
660 /* The system headers define stat to _stat64. */
661# undef _stat64
662# define _stat64(name, st) rpl_stat (name, st)
663# endif
664# elif defined _MSC_VER && defined stat
665# ifdef _USE_32BIT_TIME_T
666 /* The system headers define stat to _stat32. */
667# undef _stat32
668# define _stat32(name, st) rpl_stat (name, st)
669# else
670 /* The system headers define stat to _stat64i32. */
671# undef _stat64i32
672# define _stat64i32(name, st) rpl_stat (name, st)
673# endif
674# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
675# undef stat
622# define stat(name, st) rpl_stat (name, st) 676# define stat(name, st) rpl_stat (name, st)
623# endif /* !_LARGE_FILES */ 677# endif /* !_LARGE_FILES */
624_GL_EXTERN_C int stat (const char *name, struct stat *buf) 678_GL_EXTERN_C int stat (const char *name, struct stat *buf)
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
new file mode 100644
index 00000000000..8139d98f6a6
--- /dev/null
+++ b/lib/sys_types.in.h
@@ -0,0 +1,51 @@
1/* Provide a more complete sys/types.h.
2
3 Copyright (C) 2011-2012 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#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@
20#endif
21@PRAGMA_COLUMNS@
22
23#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
24
25/* The include_next requires a split double-inclusion guard. */
26#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
27
28#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
29#define _@GUARD_PREFIX@_SYS_TYPES_H
30
31/* Override off_t if Large File Support is requested on native Windows. */
32#if @WINDOWS_64_BIT_OFF_T@
33/* Same as int64_t in <stdint.h>. */
34# if defined _MSC_VER
35# define off_t __int64
36# else
37# define off_t long long int
38# endif
39/* Indicator, for gnulib internal purposes. */
40# define _GL_WINDOWS_64_BIT_OFF_T 1
41#endif
42
43/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
44/* But avoid namespace pollution on glibc systems. */
45#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
46 && ! defined __GLIBC__
47# include <stddef.h>
48#endif
49
50#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
51#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
diff --git a/lib/time.in.h b/lib/time.in.h
index 1fbebf47beb..04cde057cf0 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
1/* A more-standard <time.h>. 1/* A more-standard <time.h>.
2 2
3 Copyright (C) 2007-2011 Free Software Foundation, Inc. 3 Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#if __GNUC__ >= 3 18#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/time_r.c b/lib/time_r.c
index 31d010e437b..74366a0f759 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
1/* Reentrant time functions like localtime_r. 1/* Reentrant time functions like localtime_r.
2 2
3 Copyright (C) 2003, 2006-2007, 2010-2011 Free Software Foundation, Inc. 3 Copyright (C) 2003, 2006-2007, 2010-2012 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License along 15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, 16 with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19/* Written by Paul Eggert. */ 18/* Written by Paul Eggert. */
20 19
diff --git a/lib/u64.h b/lib/u64.h
index 182d64955aa..f5ec9ebcb3d 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
1/* uint64_t-like operations that work even on hosts lacking uint64_t 1/* uint64_t-like operations that work even on hosts lacking uint64_t
2 2
3 Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ typedef uint64_t u64;
30# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo))) 30# define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
31# define u64init(hi, lo) u64hilo (hi, lo) 31# define u64init(hi, lo) u64hilo (hi, lo)
32# define u64lo(x) ((u64) (x)) 32# define u64lo(x) ((u64) (x))
33# define u64size(x) u64lo (x)
33# define u64lt(x, y) ((x) < (y)) 34# define u64lt(x, y) ((x) < (y))
34# define u64and(x, y) ((x) & (y)) 35# define u64and(x, y) ((x) & (y))
35# define u64or(x, y) ((x) | (y)) 36# define u64or(x, y) ((x) | (y))
@@ -72,6 +73,16 @@ u64lo (uint32_t lo)
72 return r; 73 return r;
73} 74}
74 75
76/* Return a u64 value representing SIZE. */
77static inline u64
78u64size (size_t size)
79{
80 u64 r;
81 r.hi = size >> 31 >> 1;
82 r.lo = size;
83 return r;
84}
85
75/* Return X < Y. */ 86/* Return X < Y. */
76static inline int 87static inline int
77u64lt (u64 x, u64 y) 88u64lt (u64 x, u64 y)
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 77e5675aad2..9115486cf37 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <unistd.h>. 1/* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2011 Free Software Foundation, Inc. 2 Copyright (C) 2003-2012 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
12 GNU General Public License for more details. 12 GNU General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation, 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 16
18#if __GNUC__ >= 3 17#if __GNUC__ >= 3
19@PRAGMA_SYSTEM_HEADER@ 18@PRAGMA_SYSTEM_HEADER@
@@ -84,12 +83,19 @@
84#endif 83#endif
85 84
86/* Native Windows platforms declare chdir, getcwd, rmdir in 85/* Native Windows platforms declare chdir, getcwd, rmdir in
87 <io.h> and/or <direct.h>, not in <unistd.h>. */ 86 <io.h> and/or <direct.h>, not in <unistd.h>.
87 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
88 lseek(), read(), unlink(), write() in <io.h>. */
88#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \ 89#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
89 || defined GNULIB_POSIXCHECK) \ 90 || defined GNULIB_POSIXCHECK) \
90 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) 91 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
91# include <io.h> /* mingw32, mingw64 */ 92# include <io.h> /* mingw32, mingw64 */
92# include <direct.h> /* mingw64, MSVC 9 */ 93# include <direct.h> /* mingw64, MSVC 9 */
94#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
95 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
96 || defined GNULIB_POSIXCHECK) \
97 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
98# include <io.h>
93#endif 99#endif
94 100
95/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 101/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
@@ -101,8 +107,9 @@
101# include <netdb.h> 107# include <netdb.h>
102#endif 108#endif
103 109
104/* MSVC defines off_t in <sys/types.h>. */ 110/* MSVC defines off_t in <sys/types.h>.
105#if !@HAVE_UNISTD_H@ 111 May also define off_t to a 64-bit type on native Windows. */
112#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
106/* Get off_t. */ 113/* Get off_t. */
107# include <sys/types.h> 114# include <sys/types.h>
108#endif 115#endif
@@ -556,10 +563,19 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
556 Return 0 if successful, otherwise -1 and errno set. 563 Return 0 if successful, otherwise -1 and errno set.
557 See the POSIX:2008 specification 564 See the POSIX:2008 specification
558 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */ 565 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
559# if !@HAVE_FTRUNCATE@ 566# if @REPLACE_FTRUNCATE@
567# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
568# undef ftruncate
569# define ftruncate rpl_ftruncate
570# endif
571_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
572_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
573# else
574# if !@HAVE_FTRUNCATE@
560_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 575_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
561# endif 576# endif
562_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 577_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
578# endif
563_GL_CXXALIASWARN (ftruncate); 579_GL_CXXALIASWARN (ftruncate);
564#elif defined GNULIB_POSIXCHECK 580#elif defined GNULIB_POSIXCHECK
565# undef ftruncate 581# undef ftruncate
@@ -935,6 +951,27 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
935#endif 951#endif
936 952
937 953
954#if @GNULIB_ISATTY@
955# if @REPLACE_ISATTY@
956# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
957# undef isatty
958# define isatty rpl_isatty
959# endif
960_GL_FUNCDECL_RPL (isatty, int, (int fd));
961_GL_CXXALIAS_RPL (isatty, int, (int fd));
962# else
963_GL_CXXALIAS_SYS (isatty, int, (int fd));
964# endif
965_GL_CXXALIASWARN (isatty);
966#elif defined GNULIB_POSIXCHECK
967# undef isatty
968# if HAVE_RAW_DECL_ISATTY
969_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
970 "use gnulib module isatty for portability");
971# endif
972#endif
973
974
938#if @GNULIB_LCHOWN@ 975#if @GNULIB_LCHOWN@
939/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE 976/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
940 to GID (if GID is not -1). Do not follow symbolic links. 977 to GID (if GID is not -1). Do not follow symbolic links.
@@ -1268,6 +1305,33 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1268#endif 1305#endif
1269 1306
1270 1307
1308#if @GNULIB_SETHOSTNAME@
1309/* Set the host name of the machine.
1310 The host name may or may not be fully qualified.
1311
1312 Put LEN bytes of NAME into the host name.
1313 Return 0 if successful, otherwise, set errno and return -1.
1314
1315 Platforms with no ability to set the hostname return -1 and set
1316 errno = ENOSYS. */
1317# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1318_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1319 _GL_ARG_NONNULL ((1)));
1320# endif
1321/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
1322 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1323 2011-10, the first parameter is not const. */
1324_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1325_GL_CXXALIASWARN (sethostname);
1326#elif defined GNULIB_POSIXCHECK
1327# undef sethostname
1328# if HAVE_RAW_DECL_SETHOSTNAME
1329_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1330 "use gnulib module sethostname for portability");
1331# endif
1332#endif
1333
1334
1271#if @GNULIB_SLEEP@ 1335#if @GNULIB_SLEEP@
1272/* Pause the execution of the current thread for N seconds. 1336/* Pause the execution of the current thread for N seconds.
1273 Returns the number of seconds left to sleep. 1337 Returns the number of seconds left to sleep.
diff --git a/lib/verify.h b/lib/verify.h
index 9a8caad001d..cef14ad1571 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
1/* Compile-time assert-like macros. 1/* Compile-time assert-like macros.
2 2
3 Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc. 3 Copyright (C) 2005-2006, 2009-2012 Free Software Foundation, Inc.
4 4
5 This program is free software: you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published by
@@ -21,13 +21,11 @@
21# define _GL_VERIFY_H 21# define _GL_VERIFY_H
22 22
23 23
24/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the 24/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
25 C1X draft N1548 section 6.7.10. This is supported by GCC 4.6.0 and 25 This is supported by GCC 4.6.0 and later, in C mode, and its use
26 later, in C mode, and its use here generates easier-to-read diagnostics 26 here generates easier-to-read diagnostics when verify (R) fails.
27 when verify (R) fails.
28 27
29 Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the 28 Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
30 C++0X draft N3242 section 7.(4).
31 This will likely be supported by future GCC versions, in C++ mode. 29 This will likely be supported by future GCC versions, in C++ mode.
32 30
33 Use this only with GCC. If we were willing to slow 'configure' 31 Use this only with GCC. If we were willing to slow 'configure'
@@ -188,7 +186,7 @@ template <int w>
188 trailing ';'. If R is false, fail at compile-time, preferably 186 trailing ';'. If R is false, fail at compile-time, preferably
189 with a diagnostic that includes the string-literal DIAGNOSTIC. 187 with a diagnostic that includes the string-literal DIAGNOSTIC.
190 188
191 Unfortunately, unlike C1X, this implementation must appear as an 189 Unfortunately, unlike C11, this implementation must appear as an
192 ordinary declaration, and cannot appear inside struct { ... }. */ 190 ordinary declaration, and cannot appear inside struct { ... }. */
193 191
194# ifdef _GL_HAVE__STATIC_ASSERT 192# ifdef _GL_HAVE__STATIC_ASSERT
@@ -205,7 +203,7 @@ template <int w>
205# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC) 203# define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
206# endif 204# endif
207# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert 205# if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
208# define static_assert _Static_assert /* Draft C1X requires this #define. */ 206# define static_assert _Static_assert /* C11 requires this #define. */
209# endif 207# endif
210# endif 208# endif
211 209