This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: prototypes ld/


On Thu, Aug 09, 2001 at 06:32:17PM -0700, Ian Lance Taylor wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> > The following should fix gas/as.h.  I'll make a similar change to
> > macro.c  Any reason why we shouldn't do this?  Ian?
> > 
> > 	* as.h (alloca): Test HAVE_ALLOCA_H before __GNUC__.
> > 	Comment indentation of #pragma.
> 
> You shouldn't do that.  When using gcc, you want to use gcc's alloca.
> The system <alloca.h> may redefine alloca to be something else which
> gcc won't recognize and may not even implement.

Thanks, that's the sort of thing I was worried about.  Looking a little
deeper, I can't see why we need the __GNUC__ definition of alloca
at all.  libiberty.h provides it for us.  Thus..

	* as.h (alloca): Don't declare if __GNUC__.  Remove an old comment.
	Comment indentation of #pragma.

--- as.h	2001/03/08 23:24:21	1.23
+++ as.h	2001/08/10 02:14:10
@@ -43,28 +43,19 @@
 /* This is the code recommended in the autoconf documentation, almost
    verbatim.  If it doesn't work for you, let me know, and notify
    djm@gnu.ai.mit.edu as well.  */
-/* Added #undef for DJ Delorie.  The right fix is to ensure that as.h
-   is included first, before even any system header files, in all files
-   that use it.  KR 1994.11.03 */
 /* Added void* version for STDC case.  This is to be compatible with
    the declaration in bison.simple, used for m68k operand parsing.
    --KR 1995.08.08 */
 /* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
 
-/* AIX requires this to be the first thing in the file.  */
-#ifdef __GNUC__
-# ifndef alloca
-#  ifdef __STDC__
-extern void *alloca ();
-#  else
-extern char *alloca ();
-#  endif
-# endif
-#else
+#ifndef __GNUC__
 # if HAVE_ALLOCA_H
 #  include <alloca.h>
 # else
 #  ifdef _AIX
+/* Indented so that pre-ansi C compilers will ignore it, rather than
+   choke on it.  Some versions of AIX require this to be the first
+   thing in the file.  */
  #pragma alloca
 #  else
 #   ifndef alloca /* predefined by HP cc +Olibcalls */
@@ -76,7 +67,7 @@ extern void *alloca ();
 #   endif /* alloca */
 #  endif /* _AIX */
 # endif /* HAVE_ALLOCA_H */
-#endif
+#endif /* __GNUC__ */
 
 /* Now, tend to the rest of the configuration.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]