]> Savannah Git Hosting - gnulib.git/commitdiff
Go back to dynamic largefile, year2038 tests
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 18 Apr 2023 21:25:09 +0000 (14:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 18 Apr 2023 21:26:01 +0000 (14:26 -0700)
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2023-04/msg00134.html
* modules/largefile-tests, modules/year2038-tests (Depends-on):
Remove assert-h.
* tests/test-largefile.c, tests/test-year2038.c:
Test dynamically, not via static_assert.

ChangeLog
modules/largefile-tests
modules/year2038-tests
tests/test-largefile.c
tests/test-year2038.c

index 14bbfc2be751db6a369af35f142d224dbbec1875..32fbef51e358faa8b153df8c57a9d7a26be76720 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2023-04-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Go back to dynamic largefile, year2038 tests
+       Problem reported by Bruno Haible in:
+       https://lists.gnu.org/r/bug-gnulib/2023-04/msg00134.html
+       * modules/largefile-tests, modules/year2038-tests (Depends-on):
+       Remove assert-h.
+       * tests/test-largefile.c, tests/test-year2038.c:
+       Test dynamically, not via static_assert.
+
        doc: mention when O_* defaults to 0
        * doc/posix-headers/fcntl.texi: Document in more detail which O_*
        macros default to 0 in Gnulib.
index 544070259a4d76e093c3986a367abda8db422f47..bc55b3db63a71c3a3f73bc306f75956305b8eed7 100644 (file)
@@ -2,7 +2,6 @@ Files:
 tests/test-largefile.c
 
 Depends-on:
-assert-h
 intprops
 sys_types
 sys_stat
index 63f00ee7f8ca3b9823f08336a58d8bedec968c5f..95fb6bdaf8650946521066e64c91b2e56b90edff 100644 (file)
@@ -2,7 +2,6 @@ Files:
 tests/test-year2038.c
 
 Depends-on:
-assert-h
 intprops
 
 configure.ac:
index ce5d8a0e2e28d5fdeb98a2f8b9478e9ffffb8ff4..eb7861dae3872ecf28b5eddb62d4a02405eaf9fd 100644 (file)
 #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));
+/* Although these tests could be done with static_assert, the test
+   harness prefers dynamic checking.  */
 
 int
 main (void)
 {
-  return 0;
+  int result = 0;
+
+  /* Check the range of off_t.
+     With MSVC, this test succeeds only thanks to the 'sys_types' module.  */
+  if (TYPE_MAXIMUM (off_t) >> 31 >> 31 == 0)
+    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 != sizeof (off_t))
+      result |= 2;
+  }
+
+  return result;
 }
index 0facf930ed121355e5ace2924d5f3aa79a721d8f..d1989eb4329f73a7aeafbb74ea22e1b907aa99b7 100644 (file)
 #include <sys/types.h>
 #include "intprops.h"
 
-/* Check the range of time_t.  */
-static_assert (TYPE_MAXIMUM (time_t) >> 31 != 0);
+/* Although this test could be done with static_assert, the test
+   harness prefers dynamic checking.  */
 
 int
 main (void)
 {
-  return 0;
+  /* Check the range of time_t.  */
+  return TYPE_MAXIMUM (time_t) >> 31 == 0;
 }