diff mbox

[Ada] Fix bootstrapping on darwin9/10 (PR ada/64349)

Message ID 20150130151336.GA15772@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 30, 2015, 3:13 p.m. UTC
Avoid possible warning on darwin during compiler build.

Should hopefully close PR 64349, committed on trunk

2015-01-30  Tristan Gingold  <gingold@adacore.com>

	PR ada/64349
	* env.c: Move vxworks and darwin includes out of #ifdef IN_RTS.

Comments

Iain Sandoe Jan. 30, 2015, 4:59 p.m. UTC | #1
Hi Tristan,

On 30 Jan 2015, at 15:13, Arnaud Charlet wrote:

> Avoid possible warning on darwin during compiler build.

it's not "just a warning" it's a documented incorrect usage which causes a link error (and thus bootstrap fail) on systems that are not using the catch-all "-Wl, -undefined, dynamic_lookup".

> Should hopefully close PR 64349,

I don't think this is going to work because ... 
... as I pointed out before... 
(and provided a working patch to resolve)....

char **
__gnat_environ (void)
{
#if defined (VMS) || defined (RTX)
  /* Not implemented */
  return NULL;
#elif defined (__MINGW32__)
  return _environ;
#elif defined (sun)
  extern char **_environ;
  return _environ;
#elif ! (defined (__vxworks))

^^^^^^ __vxworks will not be defined by anything other than a vxworks compiler, I'd assume (it is certainly not defined by Darwin toolchains)

  extern char **environ;
  return environ;

vvvvvvv so I don't see how this case will ever be exercised.
#elif defined (__APPLE__) && !defined (__arm__)
  return *_NSGetEnviron ();
#else
  return environ;
#endif
}



> committed on trunk
> 
> 2015-01-30  Tristan Gingold  <gingold@adacore.com>
> 
> 	PR ada/64349
> 	* env.c: Move vxworks and darwin includes out of #ifdef IN_RTS.
> 
> <difs.txt>
Tristan Gingold Feb. 4, 2015, 9:27 a.m. UTC | #2
> #elif ! (defined (__vxworks))
> 
> ^^^^^^ __vxworks will not be defined by anything other than a vxworks compiler, I'd assume (it is certainly not defined by Darwin toolchains)
> 
>  extern char **environ;
>  return environ;
> 
> vvvvvvv so I don't see how this case will ever be exercised.
> #elif defined (__APPLE__) && !defined (__arm__)
>  return *_NSGetEnviron ();
> #else
>  return environ;
> #endif
> }

Ehh, you're right.  They must be swapped.  I missed the '!' in the vxworks case, and that wasn't detected by our build.

Tristan.
diff mbox

Patch

Index: env.c
===================================================================
--- env.c	(revision 220273)
+++ env.c	(working copy)
@@ -6,7 +6,7 @@ 
  *                                                                          *
  *                          C Implementation File                           *
  *                                                                          *
- *            Copyright (C) 2005-2014, Free Software Foundation, Inc.       *
+ *            Copyright (C) 2005-2015, Free Software Foundation, Inc.       *
  *                                                                          *
  * GNAT is free software;  you can  redistribute it  and/or modify it under *
  * terms of the  GNU General Public License as published  by the Free Soft- *
@@ -30,15 +30,21 @@ 
  ****************************************************************************/
 
 #ifdef IN_RTS
-#include "tconfig.h"
-#include "tsystem.h"
+# include "tconfig.h"
+# include "tsystem.h"
 
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <time.h>
-#ifdef VMS
-#include <unixio.h>
-#endif
+# include <sys/stat.h>
+# include <fcntl.h>
+# include <time.h>
+# ifdef VMS
+#  include <unixio.h>
+# endif
+/* We don't have libiberty, so use malloc.  */
+# define xmalloc(S) malloc (S)
+#else /* IN_RTS */
+# include "config.h"
+# include "system.h"
+#endif /* IN_RTS */
 
 #if defined (__MINGW32__)
 #include <stdlib.h>
@@ -71,13 +77,6 @@ 
   #endif
 #endif
 
-/* We don't have libiberty, so use malloc.  */
-#define xmalloc(S) malloc (S)
-#else /* IN_RTS */
-#include "config.h"
-#include "system.h"
-#endif /* IN_RTS */
-
 #ifdef __cplusplus
 extern "C" {
 #endif