+2010-08-17 Eric Blake <eblake@redhat.com>
+
+ test-stddef: test for (some) offsetof bugs
+ * tests/test-stddef.c: Enhance test to ensure correct type of
+ offsetof.
+ * doc/posix-headers/stddef.texi (stddef.h): Document a Solaris bug
+ that we are not fixing at this time.
+
2010-08-15 Bruno Haible <bruno@clisp.org>
stpncpy: Allow stpncpy to be defined as a macro.
Portability problems not fixed by Gnulib:
@itemize
+@item
+Some platforms provide an @code{offsetof} macro that cannot be used in
+arbitrary expressions:
+Solaris 10
+This problem can be worked around by parenthesizing the
+@code{offsetof} expression in the unlikely case you use it with
+@code{sizeof} or @samp{[]}.
@end itemize
per POSIX 2008. */
verify (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. */
+/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */
+verify (sizeof (offsetof (struct d, e)) == sizeof (size_t));
+verify (offsetof (struct d, e) < -1); /* Must be unsigned. */
+verify (offsetof (struct d, f) == 1);
+
int
main (void)
{