bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] Re: fnmatch.c includes alloca.h conditionally?


From: Derek Robert Price
Subject: Re: [Bug-gnulib] Re: fnmatch.c includes alloca.h conditionally?
Date: Fri, 23 Apr 2004 15:11:28 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul Eggert wrote:

>Derek Robert Price <derek@ximbiot.com> writes:
>
>>>Wouldn't it be simpler to change gl_FUNC_ALLOCA to always define
>>
>>HAVE_ALLOCA_H?
>>
>>This would work if you removed the #include <alloca.h> from
>>alloca_.h.  In this case, I should think alloca_.h should #define
>>HAVE_ALLOCA on platforms where it is deemed faster than malloc, such
>>as when #ifdef _MSC_VER, as well.
>
>
>Yes, that makes sense.
>
>How about this idea: wait a day or two for Bruno to comment, and if he
>doesn't then write up a patch?


Patch included.  I assumed that the Windows & AIX builtins will be
"fast" for purposes of defining HAVE_ALLOCA.  I assumed that the hp_ux
#ifdef stuff is defining a prototype for the version of alloca() in
lib/alloca.c.  If this is wrong then the hp_ux stuff deserves a
HAVE_ALLOCA definition too.

Is there a good reason that alloca_.h defines alloca() to return a
char * on most platforms even though alloca.c only defines alloca() to
return a void *?

bug-autoconf & bug-automake again removed from CC.

Derek

- --
                *8^)

Email: derek@ximbiot.com

Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAiWpfLD1OTBfyMaQRAu7TAKC1zgPOXPWrEXPAJafzsnb0683ofQCg4MBv
I3VLJNKgJ3sVoTfCg/79wrs=
=imy8
-----END PGP SIGNATURE-----

Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/ChangeLog,v
retrieving revision 1.147
diff -u -p -r1.147 ChangeLog
--- ChangeLog   20 Apr 2004 08:52:03 -0000      1.147
+++ ChangeLog   23 Apr 2004 19:05:04 -0000
@@ -1,3 +1,10 @@
+2004-04-23  Derek Price  <derek@ximbiot.com>
+
+       * m4/alloca.m4: Define HAVE_ALLOCA_H when alloca.h is created.
+       * lib/alloca_.h: Define HAVE_ALLOCA when a native version is found.
+       Don't try to source the system alloca.h since it will not be found and
+       to prevent recursively including its replacement.
+
 2004-04-20  Jim Meyering  <jim@meyering.net>
 
        * modules/dirfd: Change UTILS_ macro name prefix to gl_.
Index: lib/alloca_.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/alloca_.h,v
retrieving revision 1.4
diff -u -p -r1.4 alloca_.h
--- lib/alloca_.h       9 Aug 2003 08:57:49 -0000       1.4
+++ lib/alloca_.h       23 Apr 2004 19:05:04 -0000
@@ -42,25 +42,23 @@
 #  ifdef _MSC_VER
 #   include <malloc.h>
 #   define alloca _alloca
+#   define HAVE_ALLOCA 1
 #  else
-#   if HAVE_ALLOCA_H
-#    include <alloca.h>
-#   else
-#    ifdef _AIX
+#   ifdef _AIX
  #    pragma alloca
-#    else
-#     ifdef __hpux /* This section must match that of bison generated files. */
-#      ifdef __cplusplus
+ #    define HAVE_ALLOCA 1
+#   else
+#    ifdef __hpux /* This section must match that of bison generated files. */
+#     ifdef __cplusplus
 extern "C" void *alloca (unsigned int);
-#      else /* not __cplusplus */
+#     else /* not __cplusplus */
 extern void *alloca ();
-#      endif /* not __cplusplus */
-#     else /* not __hpux */
-#      ifndef alloca
+#     endif /* not __cplusplus */
+#    else /* not __hpux */
+#     ifndef alloca
 extern char *alloca ();
-#      endif
-#     endif /* __hpux */
-#    endif
+#     endif
+#    endif /* __hpux */
 #   endif
 #  endif
 # endif
Index: m4/alloca.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/alloca.m4,v
retrieving revision 1.5
diff -u -p -r1.5 alloca.m4
--- m4/alloca.m4        8 Sep 2003 22:58:10 -0000       1.5
+++ m4/alloca.m4        23 Apr 2004 19:05:04 -0000
@@ -24,7 +24,10 @@ AC_DEFUN([gl_FUNC_ALLOCA],
   Need own alloca
 #endif
     ],
-    ALLOCA_H=alloca.h,
+    [ALLOCA_H=alloca.h
+    dnl Don't need a comment below since AC_FUNC_ALLOCA will already have
+    dnl defined one.
+    AC_DEFINE(HAVE_ALLOCA_H, 1)],
     ALLOCA_H=)
   AC_SUBST([ALLOCA_H])
 ])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]