+2023-04-17 Paul Eggert <eggert@cs.ucla.edu>
+
+ Slightly nicer largefile, year2038 tests
+ * modules/largefile-tests, modules/year2038-tests (Depends-on):
+ Add assert-h, intprops.
+ * tests/test-largefile.c, tests/test-year2038.c:
+ Prefer compile-time to run-time tests.
+ Don’t assume CHAR_BIT == 8.
+
2023-04-17 Bruno Haible <bruno@clisp.org>
MODULES.html.sh: Ensure hyperlinked files are displayable.
#include <sys/types.h>
#include <sys/stat.h>
+#include "intprops.h"
+
+/* Check the range of off_t.
+ With MSVC, this test succeeds only thanks to the 'sys_types' module. */
+static_assert (TYPE_MAXIMUM (off_t) >> 31 >> 31 != 0);
+
+/* Check the size of the 'struct stat' field 'st_size'.
+ ,With MSVC, this test succeeds only thanks to the 'sys_stat' module. */
+static struct stat st;
+static_assert (sizeof st.st_size == sizeof (off_t));
int
main (void)
{
- int result = 0;
-
- /* Check the size of off_t.
- With MSVC, this test succeeds only thanks to the 'sys_types' module. */
- if (sizeof (off_t) <= 4)
- result |= 1;
-
- /* Check the size of the 'struct stat' field 'st_size'.
- With MSVC, this test succeeds only thanks to the 'sys_stat' module. */
- {
- struct stat st;
- if (sizeof (st.st_size) <= 4)
- result |= 2;
- }
-
- return result;
+ return 0;
}
#include <config.h>
#include <sys/types.h>
+#include "intprops.h"
+
+/* Check the range of time_t. */
+static_assert (TYPE_MAXIMUM (time_t) >> 31 != 0);
int
main (void)
{
- /* Check the size and sign of time_t. */
- if (sizeof (time_t) <= 4 && (time_t)-1 < 0)
- /* time_t is only 32 bits wide and signed. */
- return 1;
-
return 0;
}