Subject: "emacsclient.c (main) <environ>: Remove declaration," breaks build on Mac OS X

From: David Caldwell <[email-masked]>
Date: Mon, 28 Nov 2011 01:34:48 -0800

FYI, I get this error when compiling Emacs for Mac OS X (x86_64, i386,
and  PowerPC):

> gcc -mmacosx-version-min=10.5 -std=gnu99   -Wimplicit-function-declaration -Wold-style-definition -Wdeclaration-after-statement  -DHAVE_CONFIG_H -I. -I../src -I../lib -I/Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src -I/Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/../src -I/Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/../lib    -g -O2 /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c \
> 	   -DVERSION="\"24.0.91\"" \
> 	   ../lib/libgnu.a  -o emacsclient
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c: In function 'set_local_socket':
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c:1281: warning: passing argument 2 of 'confstr' discards qualifiers from pointer target type
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c: In function 'main':
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c:1639: error: 'environ' undeclared (first use in this function)
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c:1639: error: (Each undeclared identifier is reported only once
> /Users/david/src/emacs-dev/emacs-bzr/build-2011-11-28/lib-src/emacsclient.c:1639: error: for each function it appears in.)

It appears to be caused by this checkin:

> revno: 106533
> fixes bug(s): http://debbugs.gnu.org/9960
> committer: Eli Zaretskii <[email-masked]>
> branch nick: trunk
> timestamp: Sun 2011-11-27 20:52:53 +0200
> message:
>   Fix MS-Windows build with MSVC compiler.

I'm guessing it's this hunk:

=== modified file 'lib-src/emacsclient.c'
--- lib-src/emacsclient.c       2011-11-14 20:23:26 +0000
+++ lib-src/emacsclient.c       2011-11-27 18:52:53 +0000
@@ -1635,7 +1635,6 @@
   /* Send over our environment and current directory. */
   if (!current_frame)
     {
-      extern char **environ;
       int i;
       for (i = 0; environ[i]; i++)
         {

Thanks,
  David