This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
No need for environ
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 10 Jan 2002 14:21:36 -0800
- Subject: No need for environ
GCC does not use the 'environ' global anywhere in the compiler. There
are a few mentions in target code under config/, but nothing that will
get put into the compiler itself. Yet it's declared in toplev.c -
with a guard for it, and a configure check, and a #define in
xm-mingw32.h. This patch removes all of that.
Applied as obvious. I built cc1 with "#pragma GCC poison environ"
inserted in system.h, just to make sure, but it's pretty hard to fool
"find . -type f | xargs egrep -l" ...
zw
* toplev.c: Don't declare environ (it's not used anywhere).
* configure.in: Don't check for declaration of environ.
* config/i386/xm-mingw32.h: Don't #define environ.
* config.in, configure: Regenerate.
===================================================================
Index: configure.in
--- configure.in 2002/01/10 22:03:03 1.575
+++ configure.in 2002/01/10 22:15:33
@@ -637,7 +637,7 @@ saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -I${srcdir} -I${srcdir}/../include"
gcc_AC_CHECK_DECLS(getenv atol sbrk abort atof getcwd getwd \
strsignal putc_unlocked fputs_unlocked fwrite_unlocked \
- fprintf_unlocked strstr environ errno \
+ fprintf_unlocked strstr errno \
malloc realloc calloc free basename getopt clock, , ,[
#include "ansidecl.h"
#include "system.h"])
===================================================================
Index: toplev.c
--- toplev.c 2002/01/10 20:12:56 1.569
+++ toplev.c 2002/01/10 22:15:35
@@ -115,10 +115,6 @@ vms_fopen (fname, type)
#define fopen vms_fopen
#endif /* VMS */
-#if defined (HAVE_DECL_ENVIRON) && !HAVE_DECL_ENVIRON
-extern char **environ;
-#endif
-
/* Carry information from ASM_DECLARE_OBJECT_NAME
to ASM_FINISH_DECLARE_OBJECT. */
===================================================================
Index: config/i386/xm-mingw32.h
--- config/i386/xm-mingw32.h 2001/10/31 14:32:30 1.14
+++ config/i386/xm-mingw32.h 2002/01/10 22:15:37
@@ -19,8 +19,6 @@ along with GNU CC; see the file COPYING.
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#define environ _environ
-
/* Even though we support "/", allow "\" since everybody tests both. */
#define DIR_SEPARATOR '\\'
#define DIR_SEPARATOR_2 '/'