HAVE_ALLOCA_H vs __GNUC__

David Boyce <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
Paul,

Would you consider the following little patch or something like it? My
config.h on Solaris says:

/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
#define HAVE_ALLOCA_H 1

But when using gcc I get a lot of spurious warnings which are
traceable to the fact that the logic in make.h leaves out alloca.h in
direct contradiction of the comment. Once included, the alloca
warnings disappear.

Of course the #if HAVE_ALLOCA_H could be hoisted out of the block
instead of what I show. I have no preference.

I don't know what to make of the Ultrix comment. I'm not an autoconf
expert by any means but it seems to me that if Ultrix has alloca.h and
doesn't want you to use it, that should be a configure-time
determination affecting the value of HAVE_ALLOCA_H.

DSB

Index: make.h
===================================================================
RCS file: /sources/make/make/make.h,v
retrieving revision 1.134
diff -u -r1.134 make.h
--- make.h	16 Sep 2009 17:07:01 -0000	1.134
+++ make.h	2 Oct 2009 18:57:47 -0000
@@ -24,7 +24,11 @@
 #define HAVE_CONFIG_H 1

 /* AIX requires this to be the first thing in the file.  */
-#ifndef __GNUC__
+#ifdef __GNUC__
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# endif
+#else
 # if HAVE_ALLOCA_H
 #  include <alloca.h>
 # else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.