1 /* Test of largefile module.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
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
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2023. */
19 /* This test may fail if AC_SYS_LARGEFILE could not arrange for a 64-bit off_t.
20 This should be rare, though: only very old systems don't have support for
21 files larger than 2 GiB. */
25 #include <sys/types.h>
29 /* Although these tests could be done with static_assert, the test
30 harness prefers dynamic checking. */
37 /* Check the range of off_t.
38 With MSVC, this test succeeds only thanks to the 'sys_types' module. */
39 if (TYPE_MAXIMUM (off_t
) >> 31 >> 31 == 0)
42 /* Check the size of the 'struct stat' field 'st_size'.
43 With MSVC, this test succeeds only thanks to the 'sys_stat' module. */
46 if (sizeof st
.st_size
!= sizeof (off_t
))