From: Eric Blake Date: Wed, 12 Aug 2009 16:23:03 +0000 (-0600) Subject: stddef: fix NetBSD 5.0 NULL bug, rather than working around it X-Git-Tag: v0.1~5655 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=2f5181b1a247323cb2a4a4c6165997674866bb20;p=gnulib.git stddef: fix NetBSD 5.0 NULL bug, rather than working around it * tests/test-locale.c: Revert previous patch related to NULL. * tests/test-stdio.c: Likewise. * tests/test-stdlib.c: Likewise. * tests/test-string.c: Likewise. * tests/test-unistd.c: Likewise. * modules/time-tests (Depends-on): Add verify. * modules/wchar-tests (Depends-on): Likewise. * tests/test-time.c: Test for NULL compliance. * tests/test-wchar.c: Likewise. * modules/locale (Depends-on): Add stddef. * modules/stdio (Depends-on): Likewise. * modules/stdlib (Depends-on): Likewise. * modules/string (Depends-on): Likewise. * modules/time (Depends-on): Likewise. * modules/unistd (Depends-on): Likewise. * modules/wchar (Depends-on): Likewise. * lib/locale.in.h (includes): Use to fix NULL. * lib/stdlib.in.h (includes): Likewise. * lib/string.in.h (includes): Likewise. * lib/time.in.h (includes): Likewise. * lib/unistd.in.h (includes): Likewise. * m4/locale_h.m4 (gl_LOCALE_H): Replace locale.h if stddef.h was replaced. * m4/wchar.m4 (gl_WCHAR_H): Likewise. * m4/stddef_h.m4: New file. * modules/stddef: Likewise. * lib/stddef.in.h: Likewise. * modules/stddef-tests: Likewise. * tests/test-stddef.c: Likewise. * MODULES.html.sh (Basic types ): Mention new module. * doc/posix-headers/stddef.texi (stddef.h): Document the bug. * doc/posix-headers/locale.texi (locale.h): Likewise. * doc/posix-headers/stdio.texi (stdio.h): Likewise. * doc/posix-headers/stdlib.texi (stdlib.h): Likewise. * doc/posix-headers/string.texi (string.h): Likewise. * doc/posix-headers/time.texi (time.h): Likewise. * doc/posix-headers/unistd.texi (unistd.h): Likewise. * doc/posix-headers/wchar.texi (wchar.h): Likewise. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index a18e8ea2e..3c0089bdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,47 @@ 2009-08-14 Eric Blake + and Bruno Haible + + stddef: fix NetBSD 5.0 NULL bug, rather than working around it + * tests/test-locale.c: Revert previous patch related to NULL. + * tests/test-stdio.c: Likewise. + * tests/test-stdlib.c: Likewise. + * tests/test-string.c: Likewise. + * tests/test-unistd.c: Likewise. + * modules/time-tests (Depends-on): Add verify. + * modules/wchar-tests (Depends-on): Likewise. + * tests/test-time.c: Test for NULL compliance. + * tests/test-wchar.c: Likewise. + * modules/locale (Depends-on): Add stddef. + * modules/stdio (Depends-on): Likewise. + * modules/stdlib (Depends-on): Likewise. + * modules/string (Depends-on): Likewise. + * modules/time (Depends-on): Likewise. + * modules/unistd (Depends-on): Likewise. + * modules/wchar (Depends-on): Likewise. + * lib/locale.in.h (includes): Use to fix NULL. + * lib/stdlib.in.h (includes): Likewise. + * lib/string.in.h (includes): Likewise. + * lib/time.in.h (includes): Likewise. + * lib/unistd.in.h (includes): Likewise. + * m4/locale_h.m4 (gl_LOCALE_H): Replace locale.h if stddef.h was + replaced. + * m4/wchar.m4 (gl_WCHAR_H): Likewise. + * m4/stddef_h.m4: New file. + * modules/stddef: Likewise. + * lib/stddef.in.h: Likewise. + * modules/stddef-tests: Likewise. + * tests/test-stddef.c: Likewise. + * MODULES.html.sh (Basic types ): Mention new module. + * doc/posix-headers/stddef.texi (stddef.h): Document the bug. + * doc/posix-headers/locale.texi (locale.h): Likewise. + * doc/posix-headers/stdio.texi (stdio.h): Likewise. + * doc/posix-headers/stdlib.texi (stdlib.h): Likewise. + * doc/posix-headers/string.texi (string.h): Likewise. + * doc/posix-headers/time.texi (time.h): Likewise. + * doc/posix-headers/unistd.texi (unistd.h): Likewise. + * doc/posix-headers/wchar.texi (wchar.h): Likewise. + +2009-08-14 Eric Blake doc: improve git diff of texinfo files * .gitattributes: Add rule for *.texi files, with hint on how to diff --git a/MODULES.html.sh b/MODULES.html.sh index ce5ac80c0..298b65565 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2032,6 +2032,16 @@ func_all_modules () func_module stdbool func_end_table + element="Basic types " + element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"` + func_section_wrap isoc_sup_stddef + func_wrap H3 + func_echo "$element" + + func_begin_table + func_module stddef + func_end_table + element="Integer types and values " element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"` func_section_wrap isoc_sup_stdint diff --git a/doc/posix-headers/locale.texi b/doc/posix-headers/locale.texi index a65da977d..df0673b5a 100644 --- a/doc/posix-headers/locale.texi +++ b/doc/posix-headers/locale.texi @@ -10,6 +10,11 @@ Portability problems fixed by Gnulib: @item The definition of @samp{LC_MESSAGES} is missing on some platforms: mingw. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/stddef.texi b/doc/posix-headers/stddef.texi index df28e0fb7..92ff294cb 100644 --- a/doc/posix-headers/stddef.texi +++ b/doc/posix-headers/stddef.texi @@ -3,10 +3,17 @@ POSIX specification: @url{http://www.opengroup.org/susv3xbd/stddef.h.html} -Gnulib module: --- +Gnulib module: stddef Portability problems fixed by Gnulib: @itemize +@item +Some old platforms fail to provide @code{wchar_t}. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/stdio.texi b/doc/posix-headers/stdio.texi index c41361634..1135791ff 100644 --- a/doc/posix-headers/stdio.texi +++ b/doc/posix-headers/stdio.texi @@ -7,6 +7,10 @@ Gnulib module: stdio Portability problems fixed by Gnulib: @itemize +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/stdlib.texi b/doc/posix-headers/stdlib.texi index 2fc6280f7..6ca0c4b25 100644 --- a/doc/posix-headers/stdlib.texi +++ b/doc/posix-headers/stdlib.texi @@ -12,6 +12,11 @@ The macros @code{EXIT_SUCCESS} and @code{EXIT_FAILURE} are not defined on some platforms. @item The macro @code{EXIT_FAILURE} is incorrectly defined on Tandem/NSK. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/string.texi b/doc/posix-headers/string.texi index 42f67b90b..56a5dfce7 100644 --- a/doc/posix-headers/string.texi +++ b/doc/posix-headers/string.texi @@ -7,6 +7,10 @@ Gnulib module: string Portability problems fixed by Gnulib: @itemize +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/time.texi b/doc/posix-headers/time.texi index e9ca581df..7974cea2c 100644 --- a/doc/posix-headers/time.texi +++ b/doc/posix-headers/time.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item @samp{struct timespec} is not defined on some platforms. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/unistd.texi b/doc/posix-headers/unistd.texi index 855eefbbe..d550143e1 100644 --- a/doc/posix-headers/unistd.texi +++ b/doc/posix-headers/unistd.texi @@ -18,6 +18,11 @@ OS/2 EMX, mingw. @item The @code{_exit} function is not declared in this file on some platforms: mingw. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-headers/wchar.texi b/doc/posix-headers/wchar.texi index bdd8232d4..b797b6b8f 100644 --- a/doc/posix-headers/wchar.texi +++ b/doc/posix-headers/wchar.texi @@ -16,6 +16,11 @@ OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1. @item The type @code{wint_t} and macro @code{WEOF} are missing on some platforms: IRIX 5.3. + +@item +Some platforms provide a @code{NULL} macro that cannot be used in arbitrary +expressions: +NetBSD 5.0 @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/locale.in.h b/lib/locale.in.h index 10629f6c7..0557c9f17 100644 --- a/lib/locale.in.h +++ b/lib/locale.in.h @@ -1,5 +1,5 @@ /* A POSIX . - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -26,6 +26,9 @@ #ifndef _GL_LOCALE_H #define _GL_LOCALE_H +/* NetBSD 5.0 mis-defines NULL. */ +#include + /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C. On systems that don't define it, use the same value as GNU libintl. */ #if !defined LC_MESSAGES diff --git a/lib/stddef.in.h b/lib/stddef.in.h new file mode 100644 index 000000000..874420794 --- /dev/null +++ b/lib/stddef.in.h @@ -0,0 +1,86 @@ +/* A substitute for POSIX 2008 , for platforms that have issues. + + Copyright (C) 2009 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake. */ + +/* + * POSIX 2008 for platforms that have issues. + * + */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + +#if defined __need_wchar_t || defined __need_size_t \ + || defined __need_ptrdiff_t || defined __need_NULL \ + || defined __need_wint_t +/* Special invocation convention inside gcc header files. In + particular, gcc provides a version of that blindly + redefines NULL even when __need_wint_t was defined, even though + wint_t is not normally provided by . Hence, we must + remember if special invocation has ever been used to obtain wint_t, + in which case we need to clean up NULL yet again. */ + +# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) +# ifdef __need_wint_t +# undef _GL_STDDEF_H +# define _GL_STDDEF_WINT_T +# endif +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ +# endif + +#else +/* Normal invocation convention. */ + +# ifndef _GL_STDDEF_H + +/* The include_next requires a split double-inclusion guard. */ + +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + +# ifndef _GL_STDDEF_H +# define _GL_STDDEF_H + +/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ +#if @REPLACE_NULL@ +# undef NULL +# ifdef __cplusplus + /* ISO C++ says that the macro NULL must expand to an integer constant + expression, hence '((void *) 0)' is not allowed in C++. */ +# if __GNUG__ >= 3 + /* GNU C++ has a __null macro that behaves like an integer ('int' or + 'long') but has the same size as a pointer. Use that, to avoid + warnings. */ +# define NULL __null +# else +# define NULL 0L +# endif +# else +# define NULL ((void *) 0) +# endif +#endif + +/* Some platforms lack wchar_t. */ +#if !@HAVE_WCHAR_T@ +# define wchar_t int +#endif + +# endif /* _GL_STDDEF_H */ +# endif /* _GL_STDDEF_H */ +#endif /* __need_XXX */ diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index f99767f60..c7c8e8fb7 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -35,6 +35,8 @@ #ifndef _GL_STDLIB_H #define _GL_STDLIB_H +/* NetBSD 5.0 mis-defines NULL. */ +#include /* Solaris declares getloadavg() in . */ #if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ diff --git a/lib/string.in.h b/lib/string.in.h index 9f98b0df9..8eaeeb882 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -28,6 +28,8 @@ #ifndef _GL_STRING_H #define _GL_STRING_H +/* NetBSD 5.0 mis-defines NULL. */ +#include #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ diff --git a/lib/time.in.h b/lib/time.in.h index b9c2230d6..e8e7c197f 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -37,6 +37,9 @@ # @INCLUDE_NEXT@ @NEXT_TIME_H@ +/* NetBSD 5.0 mis-defines NULL. */ +#include + # ifdef __cplusplus extern "C" { # endif diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 5cad6c8ad..769617879 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -29,6 +29,9 @@ #ifndef _GL_UNISTD_H #define _GL_UNISTD_H +/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ +#include + /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) # include @@ -375,7 +378,6 @@ extern int gethostname(char *name, size_t len); See . */ # if !@HAVE_DECL_GETLOGIN_R@ -# include extern int getlogin_r (char *name, size_t size); # endif #elif defined GNULIB_POSIXCHECK @@ -536,7 +538,6 @@ extern int link (const char *path1, const char *path2); See the POSIX:2001 specification . */ # if !@HAVE_READLINK@ -# include extern int readlink (const char *file, char *buf, size_t bufsize); # endif #elif defined GNULIB_POSIXCHECK diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 2bf5abcca..86123670f 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,5 +1,5 @@ -# locale_h.m4 serial 2 -dnl Copyright (C) 2007 Free Software Foundation, Inc. +# locale_h.m4 serial 3 +dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,7 +12,11 @@ AC_DEFUN([gl_LOCALE_H], int x = LC_MESSAGES;], [], [gl_cv_header_working_locale_h=yes], [gl_cv_header_working_locale_h=no])]) - if test $gl_cv_header_working_locale_h = yes; then + + dnl If is replaced, then must also be replaced. + AC_REQUIRE([gl_STDDEF_H]) + + if test $gl_cv_header_working_locale_h = yes && test -z "$STDDEF_H"; then LOCALE_H= else gl_CHECK_NEXT_HEADERS([locale.h]) diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 new file mode 100644 index 000000000..682e9c626 --- /dev/null +++ b/m4/stddef_h.m4 @@ -0,0 +1,45 @@ +dnl A placeholder for POSIX 2008 , for platforms that have issues. +# stddef_h.m4 serial 1 +dnl Copyright (C) 2009 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STDDEF_H], +[ + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], + [gl_cv_decl_null_works], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include + int test[2 * (sizeof NULL == sizeof (void *)) -1]; +]])], + [gl_cv_decl_null_works=yes], + [gl_cv_decl_null_works=no])]) + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h + fi + if test -n "$STDDEF_H"; then + gl_CHECK_NEXT_HEADERS([stddef.h]) + fi +]) + +AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1 +]) + +AC_DEFUN([gl_STDDEF_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) + HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) + STDDEF_H=''; AC_SUBST([STDDEF_H]) +]) diff --git a/m4/wchar.m4 b/m4/wchar.m4 index 2e52a82ac..08cb078dc 100644 --- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar.m4 serial 23 +# wchar.m4 serial 24 AC_DEFUN([gl_WCHAR_H], [ @@ -27,7 +27,10 @@ wchar_t w;]], fi AC_SUBST([HAVE_WINT_T]) - if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then + dnl If is replaced, then must also be replaced. + AC_REQUIRE([gl_STDDEF_H]) + + if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes || test -n "$STDDEF_H"; then WCHAR_H=wchar.h fi @@ -42,7 +45,9 @@ wchar_t w;]], HAVE_WCHAR_H=0 fi AC_SUBST([HAVE_WCHAR_H]) - gl_CHECK_NEXT_HEADERS([wchar.h]) + if test -n "$WCHAR_H"; then + gl_CHECK_NEXT_HEADERS([wchar.h]) + fi ]) dnl Unconditionally enables the replacement of . diff --git a/modules/locale b/modules/locale index d15d5d347..0afc5cb6b 100644 --- a/modules/locale +++ b/modules/locale @@ -7,6 +7,7 @@ m4/locale_h.m4 Depends-on: include_next +stddef configure.ac: gl_LOCALE_H diff --git a/modules/stddef b/modules/stddef new file mode 100644 index 000000000..c68e00bfc --- /dev/null +++ b/modules/stddef @@ -0,0 +1,40 @@ +Description: +A that works around platform issues. + +Files: +lib/stddef.in.h +m4/stddef_h.m4 +m4/wchar_t.m4 + +Depends-on: +include_next + +configure.ac: +gl_STDDEF_H + +Makefile.am: +BUILT_SOURCES += $(STDDEF_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stddef.h: stddef.in.h + rm -f $@-t $@ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ + -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ + -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ + < $(srcdir)/stddef.in.h; \ + } > $@-t + mv $@-t $@ +MOSTLYCLEANFILES += stddef.h stddef.h-t + +Include: +#include + +License: +LGPLv2+ + +Maintainer: +all diff --git a/modules/stddef-tests b/modules/stddef-tests new file mode 100644 index 000000000..04be2f5b6 --- /dev/null +++ b/modules/stddef-tests @@ -0,0 +1,14 @@ +Files: +tests/test-stddef.c + +Depends-on: +verify + +configure.ac: + +Makefile.am: +TESTS += test-stddef +check_PROGRAMS += test-stddef + +License: +LGPL diff --git a/modules/stdio b/modules/stdio index 87308a6ab..cf886301b 100644 --- a/modules/stdio +++ b/modules/stdio @@ -10,6 +10,7 @@ Depends-on: include_next link-warning raise +stddef configure.ac: gl_STDIO_H diff --git a/modules/stdlib b/modules/stdlib index fda33728e..49798ad8b 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -9,6 +9,7 @@ Depends-on: include_next link-warning unistd +stddef stdint configure.ac: diff --git a/modules/string b/modules/string index b2c802c54..738deebf9 100644 --- a/modules/string +++ b/modules/string @@ -9,6 +9,7 @@ Depends-on: extensions include_next link-warning +stddef configure.ac: gl_HEADER_STRING_H diff --git a/modules/time b/modules/time index a6c9fa74d..6450cb347 100644 --- a/modules/time +++ b/modules/time @@ -8,6 +8,7 @@ m4/time_h.m4 Depends-on: extensions include_next +stddef configure.ac: gl_HEADER_TIME_H diff --git a/modules/time-tests b/modules/time-tests index c8f6f79ad..c4b18d2cc 100644 --- a/modules/time-tests +++ b/modules/time-tests @@ -2,6 +2,7 @@ Files: tests/test-time.c Depends-on: +verify configure.ac: diff --git a/modules/unistd b/modules/unistd index 06f77c5d3..5977bf986 100644 --- a/modules/unistd +++ b/modules/unistd @@ -8,6 +8,7 @@ lib/unistd.in.h Depends-on: include_next link-warning +stddef configure.ac: gl_UNISTD_H diff --git a/modules/wchar b/modules/wchar index f46150c5f..d4dad6c80 100644 --- a/modules/wchar +++ b/modules/wchar @@ -9,6 +9,7 @@ m4/wint_t.m4 Depends-on: include_next link-warning +stddef configure.ac: gl_WCHAR_H diff --git a/modules/wchar-tests b/modules/wchar-tests index 9a55d2bdf..dac05ec11 100644 --- a/modules/wchar-tests +++ b/modules/wchar-tests @@ -2,6 +2,7 @@ Files: tests/test-wchar.c Depends-on: +verify configure.ac: diff --git a/tests/test-stddef.c b/tests/test-stddef.c new file mode 100644 index 000000000..f8484987c --- /dev/null +++ b/tests/test-stddef.c @@ -0,0 +1,38 @@ +/* Test of substitute. + Copyright (C) 2009 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 . */ + +/* Written by Eric Blake , 2009. */ + +#include + +#include + +#include "verify.h" + +/* Check that appropriate types are defined. */ +wchar_t a = 'c'; +ptrdiff_t b = 1; +size_t c = 2; + +/* Check that NULL can be passed through varargs as a pointer type, + per POSIX 2008. */ +verify (sizeof NULL == sizeof (void *)); + +int +main () +{ + return 0; +} diff --git a/tests/test-time.c b/tests/test-time.c index 9238ac486..ea8143737 100644 --- a/tests/test-time.c +++ b/tests/test-time.c @@ -1,5 +1,5 @@ /* Test of substitute. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009 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 @@ -20,8 +20,14 @@ #include +#include "verify.h" + struct timespec a; +/* Check that NULL can be passed through varargs as a pointer type, + per POSIX 2008. */ +verify (sizeof NULL == sizeof (void *)); + int main () { diff --git a/tests/test-wchar.c b/tests/test-wchar.c index 19da7d93c..28660688d 100644 --- a/tests/test-wchar.c +++ b/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,10 +20,16 @@ #include +#include "verify.h" + /* Check that the types wchar_t and wint_t are defined. */ wchar_t a = 'c'; wint_t b = 'x'; +/* Check that NULL can be passed through varargs as a pointer type, + per POSIX 2008. */ +verify (sizeof NULL == sizeof (void *)); + int main () {