summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-02-11 14:58:56 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-02-11 14:59:20 -0800
commit49adc7288d58c1db38d72be52d719e987f71233a (patch)
treef18c93c5691507a3cf0cfff2dd5abdee42711d77
parentd704fa2c9fda8c29635b346165a1f2802644cffa (diff)
downloadgnulib-49adc7288d58c1db38d72be52d719e987f71233a.tar.gz
unsetenv etc.: port to Solaris 11 + GNU Emacs
* lib/canonicalize-lgpl.c, lib/getaddrinfo.c, lib/getdelim.c: * lib/glob.c, lib/random_r.c, lib/setenv.c, lib/tsearch.c: * lib/unsetenv.c (_GL_ARG_NONNULL): Define before including <config.h>. GNU Emacs's <config.h> includes <stdlib.h> (which is not a great idea but is too painful to fix right now), and without this gnulib change <stdlib.h> was defining _GL_ARG_NONNULL incorrectly when compiling unsetenv.c on Solaris 11. Fix the problem for unsetenv.c, and fix other similar occurrences.
-rw-r--r--ChangeLog12
-rw-r--r--lib/canonicalize-lgpl.c8
-rw-r--r--lib/getaddrinfo.c4
-rw-r--r--lib/getdelim.c4
-rw-r--r--lib/glob.c7
-rw-r--r--lib/random_r.c4
-rw-r--r--lib/setenv.c8
-rw-r--r--lib/tsearch.c4
-rw-r--r--lib/unsetenv.c4
9 files changed, 33 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index df283055f0..9b002b19a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-02-11 Paul Eggert <eggert@cs.ucla.edu>
+
+ unsetenv etc.: port to Solaris 11 + GNU Emacs
+ * lib/canonicalize-lgpl.c, lib/getaddrinfo.c, lib/getdelim.c:
+ * lib/glob.c, lib/random_r.c, lib/setenv.c, lib/tsearch.c:
+ * lib/unsetenv.c (_GL_ARG_NONNULL): Define before including <config.h>.
+ GNU Emacs's <config.h> includes <stdlib.h> (which is not a great
+ idea but is too painful to fix right now), and without this gnulib
+ change <stdlib.h> was defining _GL_ARG_NONNULL incorrectly when
+ compiling unsetenv.c on Solaris 11. Fix the problem for
+ unsetenv.c, and fix other similar occurrences.
+
2013-02-09 Paul Eggert <eggert@cs.ucla.edu>
secure_getenv: fix C++ declaration typo
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index d4178fae47..6cbd2e08a0 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -16,16 +16,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+# define _GL_ARG_NONNULL(params)
+
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
/* Specification. */
#include <stdlib.h>
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 4324dd772c..a6a4066323 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -15,12 +15,12 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the sa == NULL test below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
#include <netdb.h>
#if HAVE_NETINET_IN_H
diff --git a/lib/getdelim.c b/lib/getdelim.c
index 20d1da3c5b..b6a061e1f8 100644
--- a/lib/getdelim.c
+++ b/lib/getdelim.c
@@ -17,12 +17,12 @@
/* Ported from glibc by Simon Josefsson. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the lineptr == NULL || n == NULL || fp == NULL tests below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
#include <stdio.h>
#include <limits.h>
diff --git a/lib/glob.c b/lib/glob.c
index c65270f793..bf90a00450 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -15,12 +15,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
-# include <config.h>
-#endif
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the pattern == NULL || pglob == NULL tests below. */
-#define _GL_ARG_NONNULL(params)
+# define _GL_ARG_NONNULL(params)
+# include <config.h>
+#endif
#include <glob.h>
diff --git a/lib/random_r.c b/lib/random_r.c
index 349a7ba66f..78f777670e 100644
--- a/lib/random_r.c
+++ b/lib/random_r.c
@@ -50,13 +50,13 @@
* Rewritten to be reentrant by Ulrich Drepper, 1995
*/
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the buf == NULL, arg_state == NULL, result == NULL tests
below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
/* Specification. */
#include <stdlib.h>
diff --git a/lib/setenv.c b/lib/setenv.c
index d7851a8b7a..995a0f26a1 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -15,14 +15,14 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#if !_LIBC
+/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
+ optimizes away the name == NULL test below. */
+# define _GL_ARG_NONNULL(params)
+
# define _GL_USE_STDLIB_ALLOC 1
# include <config.h>
#endif
-/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
- optimizes away the name == NULL test below. */
-#define _GL_ARG_NONNULL(params)
-
#include <alloca.h>
/* Specification. */
diff --git a/lib/tsearch.c b/lib/tsearch.c
index 7cefa33fa0..96cc9991b7 100644
--- a/lib/tsearch.c
+++ b/lib/tsearch.c
@@ -85,12 +85,12 @@
In this case, A has been rotated left. This preserves the ordering of the
binary tree. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the rootp == NULL tests below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
/* Specification. */
#ifdef IN_LIBINTL
# include "tsearch.h"
diff --git a/lib/unsetenv.c b/lib/unsetenv.c
index eea2112903..c58c82f4f4 100644
--- a/lib/unsetenv.c
+++ b/lib/unsetenv.c
@@ -14,12 +14,12 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include <config.h>
-
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
optimizes away the name == NULL test below. */
#define _GL_ARG_NONNULL(params)
+#include <config.h>
+
/* Specification. */
#include <stdlib.h>