diff options
author | Simon Josefsson <simon@josefsson.org> | 2009-08-15 09:58:09 +0200 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2009-08-15 09:58:09 +0200 |
commit | b5157c8944c1d999a45e4177ebcc52b9feea088f (patch) | |
tree | b03af6d0c4e8b931c57cccc737cc056ac11b5116 /gl | |
parent | 331dc98fc52955825a5bbc91b2cc4c24e97c8e8b (diff) | |
download | gnutls-b5157c8944c1d999a45e4177ebcc52b9feea088f.tar.gz |
Update gnulib files.
Diffstat (limited to 'gl')
-rw-r--r-- | gl/Makefile.am | 23 | ||||
-rw-r--r-- | gl/m4/gnulib-comp.m4 | 4 | ||||
-rw-r--r-- | gl/m4/wchar.m4 | 7 | ||||
-rw-r--r-- | gl/stddef.in.h | 86 | ||||
-rw-r--r-- | gl/stdlib.in.h | 2 | ||||
-rw-r--r-- | gl/string.in.h | 2 | ||||
-rw-r--r-- | gl/tests/Makefile.am | 9 | ||||
-rw-r--r-- | gl/tests/test-stdio.c | 2 | ||||
-rw-r--r-- | gl/tests/test-stdlib.c | 2 | ||||
-rw-r--r-- | gl/tests/test-string.c | 2 | ||||
-rw-r--r-- | gl/tests/test-unistd.c | 2 | ||||
-rw-r--r-- | gl/tests/test-wchar.c | 8 | ||||
-rw-r--r-- | gl/unistd.in.h | 5 |
13 files changed, 145 insertions, 9 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index 95489dd196..1c21e7d450 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -599,6 +599,29 @@ EXTRA_DIST += stdbool.in.h ## end gnulib module stdbool +## begin gnulib module stddef + +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. +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 + +EXTRA_DIST += stddef.in.h + +## end gnulib module stddef + ## begin gnulib module stdint BUILT_SOURCES += $(STDINT_H) diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 88719afb8a..e471c1cae8 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -173,6 +173,7 @@ AC_SUBST([LTALLOCA]) gl_TYPE_SOCKLEN_T gl_STDARG_H AM_STDBOOL_H + gl_STDDEF_H gl_STDINT_H gl_STDIO_H gl_STDLIB_H @@ -417,6 +418,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/sockets.h lib/stdarg.in.h lib/stdbool.in.h + lib/stddef.in.h lib/stdint.in.h lib/stdio-impl.h lib/stdio-write.c @@ -489,6 +491,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/sockpfaf.m4 m4/stdarg.m4 m4/stdbool.m4 + m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 @@ -537,6 +540,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-snprintf.c tests/test-sockets.c tests/test-stdbool.c + tests/test-stddef.c tests/test-stdint.c tests/test-stdio.c tests/test-stdlib.c diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4 index 2e52a82acf..ce53a45cf5 100644 --- a/gl/m4/wchar.m4 +++ b/gl/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 25 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 <stddef.h> is replaced, then <wchar.h> 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 diff --git a/gl/stddef.in.h b/gl/stddef.in.h new file mode 100644 index 0000000000..aff3b94c0f --- /dev/null +++ b/gl/stddef.in.h @@ -0,0 +1,86 @@ +/* A substitute for POSIX 2008 <stddef.h>, 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 3, 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 <stddef.h> for platforms that have issues. + * <http://www.opengroup.org/susv3xbd/stddef.h.html> + */ + +#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 <stddef.h> that blindly + redefines NULL even when __need_wint_t was defined, even though + wint_t is not normally provided by <stddef.h>. 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/gl/stdlib.in.h b/gl/stdlib.in.h index f99767f600..c7c8e8fb7f 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h @@ -35,6 +35,8 @@ #ifndef _GL_STDLIB_H #define _GL_STDLIB_H +/* NetBSD 5.0 mis-defines NULL. */ +#include <stddef.h> /* Solaris declares getloadavg() in <sys/loadavg.h>. */ #if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ diff --git a/gl/string.in.h b/gl/string.in.h index 97da28fb77..079f2df5cf 100644 --- a/gl/string.in.h +++ b/gl/string.in.h @@ -28,6 +28,8 @@ #ifndef _GL_STRING_H #define _GL_STRING_H +/* NetBSD 5.0 mis-defines NULL. */ +#include <stddef.h> #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index 4c3bcb5b9e..375c8bf7c6 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -244,6 +244,15 @@ EXTRA_DIST += test-stdbool.c ## end gnulib module stdbool-tests +## begin gnulib module stddef-tests + +TESTS += test-stddef +check_PROGRAMS += test-stddef + +EXTRA_DIST += test-stddef.c + +## end gnulib module stddef-tests + ## begin gnulib module stdint-tests TESTS += test-stdint diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c index 41299e2159..dcfe38dd51 100644 --- a/gl/tests/test-stdio.c +++ b/gl/tests/test-stdio.c @@ -27,7 +27,7 @@ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ -verify (sizeof (NULL) == sizeof (void *)); +verify (sizeof NULL == sizeof (void *)); int main () diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c index 711cfa6315..ae46ba1662 100644 --- a/gl/tests/test-stdlib.c +++ b/gl/tests/test-stdlib.c @@ -26,7 +26,7 @@ int exitcode; /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ -verify (sizeof (NULL) == sizeof (void *)); +verify (sizeof NULL == sizeof (void *)); int main () diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c index 688d0d31c3..fe53cd9b15 100644 --- a/gl/tests/test-string.c +++ b/gl/tests/test-string.c @@ -24,7 +24,7 @@ /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ -verify (sizeof (NULL) == sizeof (void *)); +verify (sizeof NULL == sizeof (void *)); int main () diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c index e0b82918a9..129367b4d7 100644 --- a/gl/tests/test-unistd.c +++ b/gl/tests/test-unistd.c @@ -24,7 +24,7 @@ /* Check that NULL can be passed through varargs as a pointer type, per POSIX 2008. */ -verify (sizeof (NULL) == sizeof (void *)); +verify (sizeof NULL == sizeof (void *)); /* Check that the various SEEK_* macros are defined. */ int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c index 19da7d93c0..28660688d2 100644 --- a/gl/tests/test-wchar.c +++ b/gl/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> 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 <wchar.h> +#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 () { diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 578121e328..aada3643ef 100644 --- a/gl/unistd.in.h +++ b/gl/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 <stddef.h> + /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) # include <stdio.h> @@ -375,7 +378,6 @@ extern int gethostname(char *name, size_t len); See <http://www.opengroup.org/susv3xsh/getlogin.html>. */ # if !@HAVE_DECL_GETLOGIN_R@ -# include <stddef.h> 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 <http://www.opengroup.org/susv3xsh/readlink.html>. */ # if !@HAVE_READLINK@ -# include <stddef.h> extern int readlink (const char *file, char *buf, size_t bufsize); # endif #elif defined GNULIB_POSIXCHECK |