changeset 11658:8b1dcb465dff

tests: add test for bogus NULL definition * tests/test-stdio.c: Ensure POSIX 2008 requirement on NULL. * tests/test-stdlib.c: Likewise. * tests/test-string.c: Likewise. * tests/test-locale.c: Likewise. * tests/test-unistd.c: Likewise. * modules/stdio-tests (Depends-on): Add verify. * modules/stdlib-tests (Depends-on): Likewise. * modules/string-tests (Depends-on): Likewise. * modules/locale-tests (Depends-on): Likewise. * modules/unistd-tests (Depends-on): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Fri, 26 Jun 2009 08:00:28 -0600
parents f6b541f158c1
children 9456d3e6e79a
files ChangeLog modules/locale-tests modules/stdio-tests modules/stdlib-tests modules/string-tests modules/unistd-tests tests/test-locale.c tests/test-stdio.c tests/test-stdlib.c tests/test-string.c tests/test-unistd.c
diffstat 11 files changed, 53 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-06-27  Eric Blake  <ebb9@byu.net>
+
+	tests: add test for bogus NULL definition
+	* tests/test-stdio.c: Ensure POSIX 2008 requirement on NULL.
+	* tests/test-stdlib.c: Likewise.
+	* tests/test-string.c: Likewise.
+	* tests/test-locale.c: Likewise.
+	* tests/test-unistd.c: Likewise.
+	* modules/stdio-tests (Depends-on): Add verify.
+	* modules/stdlib-tests (Depends-on): Likewise.
+	* modules/string-tests (Depends-on): Likewise.
+	* modules/locale-tests (Depends-on): Likewise.
+	* modules/unistd-tests (Depends-on): Likewise.
+
 2009-06-27  Paolo Bonzini  <bonzini@gnu.org>
 
 	* m4/selinux-context-h (gl_HEADERS_SELINUX_CONTEXT_H): Remove
--- a/modules/locale-tests
+++ b/modules/locale-tests
@@ -2,6 +2,7 @@
 tests/test-locale.c
 
 Depends-on:
+verify
 
 configure.ac:
 
--- a/modules/stdio-tests
+++ b/modules/stdio-tests
@@ -2,6 +2,7 @@
 tests/test-stdio.c
 
 Depends-on:
+verify
 
 configure.ac:
 
--- a/modules/stdlib-tests
+++ b/modules/stdlib-tests
@@ -2,6 +2,7 @@
 tests/test-stdlib.c
 
 Depends-on:
+verify
 
 configure.ac:
 
--- a/modules/string-tests
+++ b/modules/string-tests
@@ -2,6 +2,7 @@
 tests/test-string.c
 
 Depends-on:
+verify
 
 configure.ac:
 
--- a/modules/unistd-tests
+++ b/modules/unistd-tests
@@ -2,6 +2,7 @@
 tests/test-unistd.c
 
 Depends-on:
+verify
 
 configure.ac:
 
--- a/tests/test-locale.c
+++ b/tests/test-locale.c
@@ -1,5 +1,5 @@
 /* Test of <locale.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,6 +20,8 @@
 
 #include <locale.h>
 
+#include "verify.h"
+
 int a[] =
   {
     LC_ALL,
@@ -31,6 +33,10 @@
     LC_TIME
   };
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
--- a/tests/test-stdio.c
+++ b/tests/test-stdio.c
@@ -1,5 +1,5 @@
 /* Test of <stdio.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,9 +20,15 @@
 
 #include <stdio.h>
 
+#include "verify.h"
+
 /* Check that the various SEEK_* macros are defined.  */
 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 *));
+
 int
 main ()
 {
--- a/tests/test-stdlib.c
+++ b/tests/test-stdlib.c
@@ -1,5 +1,5 @@
 /* Test of <stdlib.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 <stdlib.h>
 
+#include "verify.h"
+
 int exitcode;
 
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
--- a/tests/test-string.c
+++ b/tests/test-string.c
@@ -1,5 +1,5 @@
 /* Test of <string.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,6 +20,12 @@
 
 #include <string.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 int
 main ()
 {
--- a/tests/test-unistd.c
+++ b/tests/test-unistd.c
@@ -20,6 +20,12 @@
 
 #include <unistd.h>
 
+#include "verify.h"
+
+/* Check that NULL can be passed through varargs as a pointer type,
+   per POSIX 2008.  */
+verify (sizeof NULL == sizeof (void *));
+
 /* Check that the various SEEK_* macros are defined.  */
 int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET };