Re: Re: fnmatch.c includes alloca.h conditionally?

Paul Eggert <[email protected]> Mon, 17 May 2004 12:13:30 -0700
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
Derek Robert Price <[email protected]> writes:

> Unless my brain is playing new tricks on me, the double-negative of
> _not being defined in GNU applications_ and an _#ifndef IN_LIBINTL_
> (_if not defined_) will cause alloca.h to be included in GNU
> applications.

Yes, you're quite right.  Sorry about the confusion.

> Thus it should be okay for vasnprintf to include alloca.h
> unconditionally and rely on HAVE_ALLOCA being set correctly, whether
> IN_LIBINTL or not.

Yes, but only if the vasnprintf module wants to make alloca a
prerequisite module.  Bruno may prefer not having that dependency,
in which case the #include <alloca.h> must be protected by some
sort of #ifdef.

>>Similar stylistic cleanups are possible in argp too, now that
>>"#include <alloca.h>" always works (if you assume the alloca module).
>>I don't have time to pursue this right now, though.
>
>
> Patch attached.

Hmm, there wasn't a patch attached to that message (at least, not in
my copy).  Also, we'd need to change srclist.txt, surely.  How about
this patch?

Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/ChangeLog,v
retrieving revision 1.150
diff -p -u -r1.150 ChangeLog
--- ChangeLog	17 May 2004 05:41:42 -0000	1.150
+++ ChangeLog	17 May 2004 19:10:32 -0000
@@ -1,3 +1,8 @@
+2004-05-17  Derek R. Price  <[email protected]>
+	    Paul Eggert  <[email protected]>
+
+	* modules/argp: Depend on alloca.
+
 2004-05-16  Paul Eggert  <[email protected]>
 
 	* modules/getdate: Depend on alloca.
Index: config/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/config/ChangeLog,v
retrieving revision 1.73
diff -p -u -r1.73 ChangeLog
--- config/ChangeLog	21 Apr 2004 12:53:26 -0000	1.73
+++ config/ChangeLog	17 May 2004 19:10:33 -0000
@@ -1,3 +1,8 @@
+2004-05-17  Paul Eggert  <[email protected]>
+
+	* srclist.txt: Break link for argp-help.c and argp-parse.c until
+	we can get this patch merged into glibc.
+
 2004-04-21  Karl Berry  <[email protected]>
 
 	* srclist.txt (localcharset.c): break sync.
Index: config/srclist.txt
===================================================================
RCS file: /cvsroot/gnulib/gnulib/config/srclist.txt,v
retrieving revision 1.37
diff -p -u -r1.37 srclist.txt
--- config/srclist.txt	21 Apr 2004 12:53:26 -0000	1.37
+++ config/srclist.txt	17 May 2004 19:10:33 -0000
@@ -80,9 +80,11 @@ $LIBCSRC/argp/argp-eexst.c		lib gpl
 $LIBCSRC/argp/argp-fmtstream.c		lib gpl
 $LIBCSRC/argp/argp-fmtstream.h		lib gpl
 $LIBCSRC/argp/argp-fs-xinl.c		lib gpl
-$LIBCSRC/argp/argp-help.c		lib gpl
+# Currently not quite the same, due to alloca-related patch in gnulib.
+#$LIBCSRC/argp/argp-help.c		lib gpl
 $LIBCSRC/argp/argp-namefrob.h		lib gpl
-$LIBCSRC/argp/argp-parse.c		lib gpl
+# Currently not quite the same, due to alloca-related patch in gnulib.
+#$LIBCSRC/argp/argp-parse.c		lib gpl
 $LIBCSRC/argp/argp-pv.c			lib gpl
 $LIBCSRC/argp/argp-pvh.c		lib gpl
 $LIBCSRC/argp/argp-xinl.c		lib gpl
Index: lib/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.663
diff -p -u -r1.663 ChangeLog
--- lib/ChangeLog	17 May 2004 11:27:08 -0000	1.663
+++ lib/ChangeLog	17 May 2004 19:10:33 -0000
@@ -1,3 +1,8 @@
+2004-05-17  Derek R. Price  <[email protected]>
+	    Paul Eggert  <[email protected]>
+
+	* argp-help.c, argp-parse.c: Assume <alloca.h> rather than freecoding.
+
 2004-05-14  Bruno Haible  <[email protected]>
 
 	* vasnprintf.c (VASNPRINTF): Correctly handle the case of a precision
Index: lib/argp-help.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-help.c,v
retrieving revision 1.8
diff -p -u -r1.8 argp-help.c
--- lib/argp-help.c	4 Apr 2004 13:32:34 -0000	1.8
+++ lib/argp-help.c	17 May 2004 19:10:33 -0000
@@ -25,21 +25,7 @@
 #include <config.h>
 #endif
 
-/* AIX requires this to be the first thing in the file.  */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H || defined _LIBC
-#  include <alloca.h>
-# else
-#  ifdef _AIX
-#pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-
+#include <alloca.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
Index: lib/argp-parse.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-parse.c,v
retrieving revision 1.7
diff -p -u -r1.7 argp-parse.c
--- lib/argp-parse.c	9 Mar 2004 19:42:23 -0000	1.7
+++ lib/argp-parse.c	17 May 2004 19:10:33 -0000
@@ -21,21 +21,7 @@
 #include <config.h>
 #endif
 
-/* AIX requires this to be the first thing in the file.  */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H || defined _LIBC
-#  include <alloca.h>
-# else
-#  ifdef _AIX
-#pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-
+#include <alloca.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
Index: m4/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.553
diff -p -u -r1.553 ChangeLog
--- m4/ChangeLog	17 May 2004 05:41:42 -0000	1.553
+++ m4/ChangeLog	17 May 2004 19:10:34 -0000
@@ -1,3 +1,8 @@
+2004-05-17  Derek R. Price  <[email protected]>
+	    Paul Eggert  <[email protected]>
+
+	* argp: Depend on alloca.
+
 2004-05-16  Paul Eggert  <[email protected]>
 
 	* alloca.m4 (gl_FUNC_ALLOCA): Define HAVE_ALLOCA_H always,
Index: modules/argp
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/argp,v
retrieving revision 1.4
diff -p -u -r1.4 argp
--- modules/argp	4 May 2004 18:39:43 -0000	1.4
+++ modules/argp	17 May 2004 19:10:34 -0000
@@ -17,6 +17,7 @@ lib/argp-xinl.c
 m4/argp.m4
 
 Depends-on:
+alloca
 getopt
 strchrnul
 sysexits