summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-08-15 09:58:09 +0200
committerSimon Josefsson <simon@josefsson.org>2009-08-15 09:58:09 +0200
commitb5157c8944c1d999a45e4177ebcc52b9feea088f (patch)
treeb03af6d0c4e8b931c57cccc737cc056ac11b5116 /lib
parent331dc98fc52955825a5bbc91b2cc4c24e97c8e8b (diff)
downloadgnutls-b5157c8944c1d999a45e4177ebcc52b9feea088f.tar.gz
Update gnulib files.
Diffstat (limited to 'lib')
-rw-r--r--lib/gl/Makefile.am23
-rw-r--r--lib/gl/m4/gnulib-comp.m44
-rw-r--r--lib/gl/m4/wchar.m47
-rw-r--r--lib/gl/stddef.in.h86
-rw-r--r--lib/gl/stdlib.in.h2
-rw-r--r--lib/gl/string.in.h2
-rw-r--r--lib/gl/tests/Makefile.am9
-rw-r--r--lib/gl/tests/test-stdio.c2
-rw-r--r--lib/gl/tests/test-stdlib.c2
-rw-r--r--lib/gl/tests/test-string.c2
-rw-r--r--lib/gl/tests/test-time.c8
-rw-r--r--lib/gl/tests/test-unistd.c2
-rw-r--r--lib/gl/tests/test-wchar.c8
-rw-r--r--lib/gl/time.in.h3
-rw-r--r--lib/gl/unistd.in.h5
15 files changed, 155 insertions, 10 deletions
diff --git a/lib/gl/Makefile.am b/lib/gl/Makefile.am
index 9ffd6495bc..598561d568 100644
--- a/lib/gl/Makefile.am
+++ b/lib/gl/Makefile.am
@@ -326,6 +326,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/lib/gl/m4/gnulib-comp.m4 b/lib/gl/m4/gnulib-comp.m4
index bc89db4dd1..36c449e1dd 100644
--- a/lib/gl/m4/gnulib-comp.m4
+++ b/lib/gl/m4/gnulib-comp.m4
@@ -76,6 +76,7 @@ AC_DEFUN([lgl_INIT],
gl_SOCKETS
gl_TYPE_SOCKLEN_T
AM_STDBOOL_H
+ gl_STDDEF_H
gl_STDINT_H
gl_STDIO_H
gl_STDLIB_H
@@ -271,6 +272,7 @@ AC_DEFUN([lgl_FILE_LIST], [
lib/sockets.c
lib/sockets.h
lib/stdbool.in.h
+ lib/stddef.in.h
lib/stdint.in.h
lib/stdio-impl.h
lib/stdio-write.c
@@ -348,6 +350,7 @@ AC_DEFUN([lgl_FILE_LIST], [
m4/socklen.m4
m4/sockpfaf.m4
m4/stdbool.m4
+ m4/stddef_h.m4
m4/stdint.m4
m4/stdint_h.m4
m4/stdio_h.m4
@@ -386,6 +389,7 @@ AC_DEFUN([lgl_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/lib/gl/m4/wchar.m4 b/lib/gl/m4/wchar.m4
index 2e52a82acf..ce53a45cf5 100644
--- a/lib/gl/m4/wchar.m4
+++ b/lib/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/lib/gl/stddef.in.h b/lib/gl/stddef.in.h
new file mode 100644
index 0000000000..d47d0d962b
--- /dev/null
+++ b/lib/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 Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1, 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser 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/lib/gl/stdlib.in.h b/lib/gl/stdlib.in.h
index 4e6dfd3bf9..a8a06b8688 100644
--- a/lib/gl/stdlib.in.h
+++ b/lib/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/lib/gl/string.in.h b/lib/gl/string.in.h
index 64ebec91b0..45e0efb8a7 100644
--- a/lib/gl/string.in.h
+++ b/lib/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/lib/gl/tests/Makefile.am b/lib/gl/tests/Makefile.am
index e171efc016..128e4b16da 100644
--- a/lib/gl/tests/Makefile.am
+++ b/lib/gl/tests/Makefile.am
@@ -154,6 +154,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/lib/gl/tests/test-stdio.c b/lib/gl/tests/test-stdio.c
index 41299e2159..dcfe38dd51 100644
--- a/lib/gl/tests/test-stdio.c
+++ b/lib/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/lib/gl/tests/test-stdlib.c b/lib/gl/tests/test-stdlib.c
index 711cfa6315..ae46ba1662 100644
--- a/lib/gl/tests/test-stdlib.c
+++ b/lib/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/lib/gl/tests/test-string.c b/lib/gl/tests/test-string.c
index 688d0d31c3..fe53cd9b15 100644
--- a/lib/gl/tests/test-string.c
+++ b/lib/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/lib/gl/tests/test-time.c b/lib/gl/tests/test-time.c
index 9238ac4864..ea8143737f 100644
--- a/lib/gl/tests/test-time.c
+++ b/lib/gl/tests/test-time.c
@@ -1,5 +1,5 @@
/* Test of <time.h> 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 <time.h>
+#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/lib/gl/tests/test-unistd.c b/lib/gl/tests/test-unistd.c
index e0b82918a9..129367b4d7 100644
--- a/lib/gl/tests/test-unistd.c
+++ b/lib/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/lib/gl/tests/test-wchar.c b/lib/gl/tests/test-wchar.c
index 19da7d93c0..28660688d2 100644
--- a/lib/gl/tests/test-wchar.c
+++ b/lib/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/lib/gl/time.in.h b/lib/gl/time.in.h
index c9fb753d20..6b218e8f11 100644
--- a/lib/gl/time.in.h
+++ b/lib/gl/time.in.h
@@ -37,6 +37,9 @@
# @INCLUDE_NEXT@ @NEXT_TIME_H@
+/* NetBSD 5.0 mis-defines NULL. */
+#include <stddef.h>
+
# ifdef __cplusplus
extern "C" {
# endif
diff --git a/lib/gl/unistd.in.h b/lib/gl/unistd.in.h
index 132d0d3766..b297e16eef 100644
--- a/lib/gl/unistd.in.h
+++ b/lib/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