]> Savannah Git Hosting - gnulib.git/commitdiff
Rename module stddef to stddef-h.
authorBruno Haible <bruno@clisp.org>
Fri, 27 Dec 2024 22:23:10 +0000 (23:23 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 27 Dec 2024 22:35:36 +0000 (23:35 +0100)
* modules/stddef-h: Renamed from modules/stddef.
* modules/stddef-h-tests: Renamed from modules/stddef-tests.
* modules/stddef-h-c++-tests: Renamed from modules/stddef-c++-tests.
* tests/test-stddef-h.c: Renamed from tests/test-stddef.c.
* tests/test-stddef-h-c++.cc: Renamed from tests/test-stddef-c++.cc.
* tests/test-stddef-h-c++2.cc: Renamed from tests/test-stddef-c++2.cc.
* doc/posix-headers/stddef.texi: Update.
* modules/* (Depends-on): Update.
* modules/stddef: New file.

29 files changed:
ChangeLog
doc/posix-headers/stddef.texi
modules/c-stack
modules/dfa
modules/error
modules/fts
modules/glibc-internal/dynarray
modules/glibc-internal/scratch_buffer
modules/locale-h
modules/malloc-h
modules/relocatable-prog-wrapper
modules/stddef
modules/stddef-c++-tests [deleted file]
modules/stddef-h [new file with mode: 0644]
modules/stddef-h-c++-tests [new file with mode: 0644]
modules/stddef-h-tests [new file with mode: 0644]
modules/stddef-tests [deleted file]
modules/stdio
modules/stdlib
modules/string
modules/time-h
modules/unistd
modules/wchar
tests/test-stddef-c++.cc [deleted file]
tests/test-stddef-c++2.cc [deleted file]
tests/test-stddef-h-c++.cc [new file with mode: 0644]
tests/test-stddef-h-c++2.cc [new file with mode: 0644]
tests/test-stddef-h.c [new file with mode: 0644]
tests/test-stddef.c [deleted file]

index a910bc094dc4ca9783e499eb56aab55ffacaa76d..e09072ad314d67e59ed703e64e14f023e783cb04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-12-27  Bruno Haible  <bruno@clisp.org>
+
+       Rename module stddef to stddef-h.
+       * modules/stddef-h: Renamed from modules/stddef.
+       * modules/stddef-h-tests: Renamed from modules/stddef-tests.
+       * modules/stddef-h-c++-tests: Renamed from modules/stddef-c++-tests.
+       * tests/test-stddef-h.c: Renamed from tests/test-stddef.c.
+       * tests/test-stddef-h-c++.cc: Renamed from tests/test-stddef-c++.cc.
+       * tests/test-stddef-h-c++2.cc: Renamed from tests/test-stddef-c++2.cc.
+       * doc/posix-headers/stddef.texi: Update.
+       * modules/* (Depends-on): Update.
+       * modules/stddef: New file.
+
 2024-12-27  Bruno Haible  <bruno@clisp.org>
 
        Rename module stdckdint to stdckdint-h.
index 2df361446136075046871aa028ef22dd4b572e37..ac84f00779e127974476487a523614dcff7b0a77 100644 (file)
@@ -3,8 +3,8 @@
 
 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/stddef.h.html}
 
-Gnulib module: stddef
-@mindex stddef
+Gnulib module: stddef-h
+@mindex stddef-h
 
 Portability problems fixed by Gnulib:
 @itemize
index 23d1da5af86ce3e3463df9ebe503225f9c581a4a..a9d0805e26251f64115538ecd864364a876939d1 100644 (file)
@@ -19,7 +19,7 @@ inttypes-h
 mempcpy
 raise
 sigsegv
-stddef
+stddef-h
 unistd
 
 configure.ac:
index 3fd3a10eb54aaa9928f7a5cf7ae9b3d8785b803f..7c09f1f4b118f6ad83e8e77b7695b8e6521eb57a 100644 (file)
@@ -26,7 +26,7 @@ mbrtoc32-regular
 mbszero
 regex
 stdbool-h
-stddef
+stddef-h
 stdint
 stdio
 stdlib
index 3f8a226933ee036a5ef22f91bd991cf9fc48f897..86ff70048327ff2f2b82a0d815e78e4fba041bbc 100644 (file)
@@ -7,7 +7,7 @@ m4/error.m4
 
 Depends-on:
 error-h
-stddef
+stddef-h
 stdio
 getprogname     [test $COMPILE_ERROR_C = 1]
 gettext-h       [test $COMPILE_ERROR_C = 1]
index 0bc757e901c5f4dd836cc1dc957e0c113d88847e..e7cbf9e2f437d16a0e5014b2221efe5249ca4698 100644 (file)
@@ -35,7 +35,7 @@ opendirat
 readdir
 realloc-posix
 stdbool-h
-stddef
+stddef-h
 stdint
 
 configure.ac:
index 3271e69b4ebfff390b5e2a67a5e437b48b1afb1e..b86e06391bbbc0c43fce68bc203f807b6902efce 100644 (file)
@@ -18,7 +18,7 @@ gen-header
 libc-config
 stdbool-h
 stdckdint-h
-stddef
+stddef-h
 
 configure.ac:
 AC_PROG_MKDIR_P
index 193a18ccf41ab48ebfc2219244467006bbc56a81..656a8f32af3c929169c9d1538228fa81559bb3c7 100644 (file)
@@ -14,7 +14,7 @@ builtin-expect
 gen-header
 libc-config
 stdbool-h
-stddef
+stddef-h
 malloc-posix
 realloc-posix
 free-posix
index df0237723d712f76bde3929d5275f0abb1ae0aa5..c81bd908d74d99123ca6779b7230d4f48b745843 100644 (file)
@@ -12,7 +12,7 @@ include_next
 snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
-stddef
+stddef-h
 
 configure.ac:
 gl_LOCALE_H
index 7c241d2943bcba084f12c9fb4e5f0beaaf725c8d..d308515b7726bd8cb15015b1292f32aac56ca7fa 100644 (file)
@@ -10,7 +10,7 @@ gen-header
 include_next
 snippet/c++defs
 snippet/warn-on-use
-stddef
+stddef-h
 stdlib
 
 configure.ac:
index 00ebccc575eb702cf4e4b763b828e5a8ecd0b5c8..c538512c7b1a3f43950a26c6451f04acd3777ca6 100644 (file)
@@ -70,7 +70,7 @@ limits-h
 pathmax
 ssize_t
 stdbool-h
-stddef
+stddef-h
 stdckdint-h
 stdint
 stdlib
index 96eeeaf88bc3149ee3abc97b5666f1d7796a6b9a..890eaba27701f55847ad951f38300dbf5efc874a 100644 (file)
@@ -1,46 +1,20 @@
 Description:
 A <stddef.h> that works around platform issues.
 
+Status:
+deprecated
+
+Notice:
+This module is deprecated. Use the module 'stddef-h' instead.
+
 Files:
-lib/stddef.in.h
-m4/stddef_h.m4
 
 Depends-on:
-gen-header
-include_next
-extensions
+stddef-h
 
 configure.ac:
-gl_STDDEF_H
-gl_STDDEF_H_REQUIRE_DEFAULTS
-gl_CONDITIONAL_HEADER([stddef.h])
-AC_PROG_MKDIR_P
 
 Makefile.am:
-BUILT_SOURCES += $(STDDEF_H)
-
-# We need the following in order to create <stddef.h> when the system
-# doesn't have one that works with the given compiler.
-if GL_GENERATE_STDDEF_H
-stddef.h: stddef.in.h $(top_builddir)/config.status
-@NMD@  $(AM_V_GEN)$(MKDIR_P) '%reldir%'
-       $(gl_V_at)$(SED_HEADER_STDOUT) \
-             -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
-             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-             -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
-             -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \
-             -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \
-             -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
-             -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
-             $(srcdir)/stddef.in.h > $@-t
-       $(AM_V_at)mv $@-t $@
-else
-stddef.h: $(top_builddir)/config.status
-       rm -f $@
-endif
-MOSTLYCLEANFILES += stddef.h stddef.h-t
 
 Include:
 <stddef.h>
@@ -49,4 +23,3 @@ License:
 LGPLv2+
 
 Maintainer:
-all
diff --git a/modules/stddef-c++-tests b/modules/stddef-c++-tests
deleted file mode 100644 (file)
index c11a16f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Files:
-tests/test-stddef-c++.cc
-tests/test-stddef-c++2.cc
-
-Status:
-c++-test
-
-Depends-on:
-ansi-c++-opt
-
-configure.ac:
-
-Makefile.am:
-if ANSICXX
-TESTS += test-stddef-c++
-check_PROGRAMS += test-stddef-c++
-test_stddef_c___SOURCES = test-stddef-c++.cc test-stddef-c++2.cc
-endif
diff --git a/modules/stddef-h b/modules/stddef-h
new file mode 100644 (file)
index 0000000..96eeeaf
--- /dev/null
@@ -0,0 +1,52 @@
+Description:
+A <stddef.h> that works around platform issues.
+
+Files:
+lib/stddef.in.h
+m4/stddef_h.m4
+
+Depends-on:
+gen-header
+include_next
+extensions
+
+configure.ac:
+gl_STDDEF_H
+gl_STDDEF_H_REQUIRE_DEFAULTS
+gl_CONDITIONAL_HEADER([stddef.h])
+AC_PROG_MKDIR_P
+
+Makefile.am:
+BUILT_SOURCES += $(STDDEF_H)
+
+# We need the following in order to create <stddef.h> when the system
+# doesn't have one that works with the given compiler.
+if GL_GENERATE_STDDEF_H
+stddef.h: stddef.in.h $(top_builddir)/config.status
+@NMD@  $(AM_V_GEN)$(MKDIR_P) '%reldir%'
+       $(gl_V_at)$(SED_HEADER_STDOUT) \
+             -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \
+             -e 's|@''NULLPTR_T_NEEDS_STDDEF''@|$(NULLPTR_T_NEEDS_STDDEF)|g' \
+             -e 's|@''STDDEF_NOT_IDEMPOTENT''@|$(STDDEF_NOT_IDEMPOTENT)|g' \
+             -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \
+             -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \
+             $(srcdir)/stddef.in.h > $@-t
+       $(AM_V_at)mv $@-t $@
+else
+stddef.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += stddef.h stddef.h-t
+
+Include:
+<stddef.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/stddef-h-c++-tests b/modules/stddef-h-c++-tests
new file mode 100644 (file)
index 0000000..b464188
--- /dev/null
@@ -0,0 +1,18 @@
+Files:
+tests/test-stddef-h-c++.cc
+tests/test-stddef-h-c++2.cc
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-stddef-h-c++
+check_PROGRAMS += test-stddef-h-c++
+test_stddef_h_c___SOURCES = test-stddef-h-c++.cc test-stddef-h-c++2.cc
+endif
diff --git a/modules/stddef-h-tests b/modules/stddef-h-tests
new file mode 100644 (file)
index 0000000..9a9ec39
--- /dev/null
@@ -0,0 +1,13 @@
+Files:
+tests/test-stddef-h.c
+
+Depends-on:
+alignasof
+assert-h
+stddef-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stddef-h
+check_PROGRAMS += test-stddef-h
diff --git a/modules/stddef-tests b/modules/stddef-tests
deleted file mode 100644 (file)
index f81ca47..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-Files:
-tests/test-stddef.c
-
-Depends-on:
-alignasof
-assert-h
-stddef-c++-tests
-
-configure.ac:
-
-Makefile.am:
-TESTS += test-stddef
-check_PROGRAMS += test-stddef
index 0e6b6e4d2112e77644e9238a9bc7fbbb0f670c79..dfae001260a847dd68d2d77f1219564b2f344f1d 100644 (file)
@@ -16,7 +16,7 @@ snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
 ssize_t
-stddef
+stddef-h
 sys_types
 
 configure.ac-early:
index ddf6d5725f0208642463ccdeb4bfeeab15cdf4a4..e1fe525665a99fd11e99dcdbb878961aca8bc416 100644 (file)
@@ -16,7 +16,7 @@ snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
 snippet/_Noreturn
-stddef
+stddef-h
 unistd
 
 configure.ac:
index eb0b215437e6a733edd71e5371072699b3e71a8e..79d21a5634eb34928cb944772824b7cbba6e9105 100644 (file)
@@ -13,7 +13,7 @@ include_next
 snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
-stddef
+stddef-h
 stdlib
 
 configure.ac:
index 76921979f0d893e5e5db28c729fa7b2fdaa56781..b3affe343350080a46c4f09fcd7d1d080710bbc9 100644 (file)
@@ -12,7 +12,7 @@ include_next
 snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
-stddef
+stddef-h
 
 configure.ac:
 gl_TIME_H
index f3c84660c346b9ab6347938a96a438a707f3931f..b9cfa25072328d0b49c9c16541a13d28e1255eff 100644 (file)
@@ -16,7 +16,7 @@ snippet/arg-nonnull
 snippet/c++defs
 snippet/warn-on-use
 ssize_t
-stddef
+stddef-h
 sys_types
 
 configure.ac:
index f4b7518751bed69a9b7502dc3e9fa9b801568ff9..a24e25cdf9909b89aba812d909b007fc1ed20917 100644 (file)
@@ -15,7 +15,7 @@ snippet/c++defs
 snippet/warn-on-use
 extern-inline
 inttypes-h-incomplete
-stddef
+stddef-h
 stdlib
 
 configure.ac:
diff --git a/tests/test-stddef-c++.cc b/tests/test-stddef-c++.cc
deleted file mode 100644 (file)
index e843b2c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Test of <stddef.h> substitute in C++ mode.
-   Copyright (C) 2019-2024 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
-
-#define GNULIB_NAMESPACE gnulib
-#include <config.h>
-
-#include <stddef.h>
-
-
-int
-main ()
-{
-}
diff --git a/tests/test-stddef-c++2.cc b/tests/test-stddef-c++2.cc
deleted file mode 100644 (file)
index 3fb1423..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Test of <stddef.h> substitute in C++ mode.
-   Copyright (C) 2019-2024 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#define GNULIB_NAMESPACE gnulib
-#include <config.h>
-
-#include <cstddef>
diff --git a/tests/test-stddef-h-c++.cc b/tests/test-stddef-h-c++.cc
new file mode 100644 (file)
index 0000000..e843b2c
--- /dev/null
@@ -0,0 +1,28 @@
+/* Test of <stddef.h> substitute in C++ mode.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2019.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <stddef.h>
+
+
+int
+main ()
+{
+}
diff --git a/tests/test-stddef-h-c++2.cc b/tests/test-stddef-h-c++2.cc
new file mode 100644 (file)
index 0000000..3fb1423
--- /dev/null
@@ -0,0 +1,20 @@
+/* Test of <stddef.h> substitute in C++ mode.
+   Copyright (C) 2019-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <cstddef>
diff --git a/tests/test-stddef-h.c b/tests/test-stddef-h.c
new file mode 100644 (file)
index 0000000..5bceb18
--- /dev/null
@@ -0,0 +1,100 @@
+/* Test of <stddef.h> substitute.
+   Copyright (C) 2009-2024 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
+
+#include <config.h>
+
+#include <stddef.h>
+
+/* Check that appropriate types are defined.  */
+wchar_t a = 'c';
+ptrdiff_t b = 1;
+size_t c = 2;
+max_align_t mat;
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+static_assert (sizeof NULL == sizeof (void *));
+
+/* Check that offsetof produces integer constants with correct type.  */
+struct d
+{
+  char e;
+  char f;
+};
+/* Solaris 10 has a bug where offsetof is under-parenthesized, and
+   cannot be used as an arbitrary expression.  However, since it is
+   unlikely to bite real code, we ignore that short-coming.  */
+/* static_assert (sizeof offsetof (struct d, e) == sizeof (size_t)); */
+static_assert (sizeof (offsetof (struct d, e)) == sizeof (size_t));
+static_assert (offsetof (struct d, f) == 1);
+
+/* Check max_align_t's alignment.  */
+static_assert (alignof (double) <= alignof (max_align_t));
+static_assert (alignof (int) <= alignof (max_align_t));
+static_assert (alignof (long double) <= alignof (max_align_t));
+static_assert (alignof (long int) <= alignof (max_align_t));
+static_assert (alignof (ptrdiff_t) <= alignof (max_align_t));
+static_assert (alignof (size_t) <= alignof (max_align_t));
+static_assert (alignof (wchar_t) <= alignof (max_align_t));
+static_assert (alignof (struct d) <= alignof (max_align_t));
+#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
+static_assert (__alignof__ (double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long double) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (long int) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (size_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (wchar_t) <= __alignof__ (max_align_t));
+static_assert (__alignof__ (struct d) <= __alignof__ (max_align_t));
+#endif
+
+int test_unreachable_optimization (int x);
+_Noreturn void test_unreachable_noreturn (void);
+
+int
+test_unreachable_optimization (int x)
+{
+  /* Check that the compiler uses 'unreachable' for optimization.
+     This function, when compiled with optimization, should have code
+     equivalent to
+       return x + 3;
+     Use 'objdump --disassemble test-stddef.o' to verify this.  */
+  if (x < 4)
+    unreachable ();
+  return (x > 1 ? x + 3 : 2 * x + 10);
+}
+
+_Noreturn void
+test_unreachable_noreturn (void)
+{
+  /* Check that the compiler's data-flow analysis recognizes 'unreachable ()'.
+     This function should not elicit a warning.  */
+  unreachable ();
+}
+
+#include <limits.h> /* INT_MAX */
+
+/* offsetof promotes to an unsigned integer if and only if sizes do
+   not fit in int.  */
+static_assert ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
+
+int
+main (void)
+{
+  return 0;
+}
diff --git a/tests/test-stddef.c b/tests/test-stddef.c
deleted file mode 100644 (file)
index 5bceb18..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Test of <stddef.h> substitute.
-   Copyright (C) 2009-2024 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-/* Written by Eric Blake <ebb9@byu.net>, 2009.  */
-
-#include <config.h>
-
-#include <stddef.h>
-
-/* Check that appropriate types are defined.  */
-wchar_t a = 'c';
-ptrdiff_t b = 1;
-size_t c = 2;
-max_align_t mat;
-
-/* Check that NULL can be passed through varargs as a pointer type,
-   per POSIX 2008.  */
-static_assert (sizeof NULL == sizeof (void *));
-
-/* Check that offsetof produces integer constants with correct type.  */
-struct d
-{
-  char e;
-  char f;
-};
-/* Solaris 10 has a bug where offsetof is under-parenthesized, and
-   cannot be used as an arbitrary expression.  However, since it is
-   unlikely to bite real code, we ignore that short-coming.  */
-/* static_assert (sizeof offsetof (struct d, e) == sizeof (size_t)); */
-static_assert (sizeof (offsetof (struct d, e)) == sizeof (size_t));
-static_assert (offsetof (struct d, f) == 1);
-
-/* Check max_align_t's alignment.  */
-static_assert (alignof (double) <= alignof (max_align_t));
-static_assert (alignof (int) <= alignof (max_align_t));
-static_assert (alignof (long double) <= alignof (max_align_t));
-static_assert (alignof (long int) <= alignof (max_align_t));
-static_assert (alignof (ptrdiff_t) <= alignof (max_align_t));
-static_assert (alignof (size_t) <= alignof (max_align_t));
-static_assert (alignof (wchar_t) <= alignof (max_align_t));
-static_assert (alignof (struct d) <= alignof (max_align_t));
-#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
-static_assert (__alignof__ (double) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (int) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (long double) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (long int) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (ptrdiff_t) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (size_t) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (wchar_t) <= __alignof__ (max_align_t));
-static_assert (__alignof__ (struct d) <= __alignof__ (max_align_t));
-#endif
-
-int test_unreachable_optimization (int x);
-_Noreturn void test_unreachable_noreturn (void);
-
-int
-test_unreachable_optimization (int x)
-{
-  /* Check that the compiler uses 'unreachable' for optimization.
-     This function, when compiled with optimization, should have code
-     equivalent to
-       return x + 3;
-     Use 'objdump --disassemble test-stddef.o' to verify this.  */
-  if (x < 4)
-    unreachable ();
-  return (x > 1 ? x + 3 : 2 * x + 10);
-}
-
-_Noreturn void
-test_unreachable_noreturn (void)
-{
-  /* Check that the compiler's data-flow analysis recognizes 'unreachable ()'.
-     This function should not elicit a warning.  */
-  unreachable ();
-}
-
-#include <limits.h> /* INT_MAX */
-
-/* offsetof promotes to an unsigned integer if and only if sizes do
-   not fit in int.  */
-static_assert ((offsetof (struct d, e) < -1) == (INT_MAX < (size_t) -1));
-
-int
-main (void)
-{
-  return 0;
-}