diff options
author | Eric Blake <ebb9@byu.net> | 2009-12-31 13:28:59 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2010-01-11 06:51:55 -0700 |
commit | 718991da5f5026e1a8ce2efcca58359d9b67b2f5 (patch) | |
tree | 2f139f6538b05f21913260dd1a8d64776343ddff /m4 | |
parent | 524d6a2ef5cb6f367d4f14d5ab5a35df4c7fe08f (diff) | |
download | gnulib-718991da5f5026e1a8ce2efcca58359d9b67b2f5.tar.gz |
unistd: warn on use of environ without module
_GL_WARN_ON_USE only works for functions; so we wrap access to
environ through a function when CFLAGS has -DGNULIB_POSIXCHECK=1.
* modules/unistd (Depends-on): Add warn-on-use.
(Makefile.am): Provide new substitutions.
* m4/unistd_h.m4 (gl_UNISTD_H): Check for inline and environ.
* lib/unistd.in.h (environ): Wrap with a warning helper function.
Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/unistd_h.m4 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index f3074ea8ac..aacec2b15b 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 37 +# unistd_h.m4 serial 38 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,7 @@ AC_DEFUN([gl_UNISTD_H], dnl Use AC_REQUIRE here, so that the default behavior below is expanded dnl once only, before all statements that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_C_INLINE]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -21,6 +22,15 @@ AC_DEFUN([gl_UNISTD_H], HAVE_UNISTD_H=0 fi AC_SUBST([HAVE_UNISTD_H]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <unistd.h> +/* Some systems declare environ in the wrong header. */ +#ifndef __GLIBC__ +# include <stdlib.h> +#endif + ]], [environ]) ]) AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], |