+2003-01-10 Bruno Haible <bruno@clisp.org>
+
+ * modules/alloca: Change Makefile.am requirements. Simplify Include
+ requirements. Add lib/alloca_.h to file list.
+
2003-01-09 Bruno Haible <bruno@clisp.org>
* modules/stdbool: Change configure.ac, Makefile.am requirements.
+2003-01-10 Bruno Haible <bruno@clisp.org>
+
+ * alloca_.h: New file.
+ * getdate.y: Unconditionally include alloca.h.
+ * makepath.c: Likewise.
+ * setenv.c: Likewise.
+ * userspec.c: Likewise.
+
2003-01-09 Bruno Haible <bruno@clisp.org>
* stdbool.h.in: New file.
--- /dev/null
+/* Memory allocation on the stack.
+ Copyright (C) 1995, 1999, 2001-2003 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* When this file is included, it may be preceded only by preprocessor
+ declarations. Thanks to AIX 3. Therefore we include it right after
+ "config.h", not later. */
+
+#ifndef _ALLOCA_H
+#define _ALLOCA_H
+
+/* alloca(N) returns a pointer (void* or char*) to N bytes of memory
+ allocated on the stack, and which will last until the function returns.
+ Use of alloca should be avoided:
+ - inside arguments of function calls - undefined behaviour,
+ - in inline functions - the allocation may actually last until the
+ calling function returns,
+ - for huge N (say, N >= 65536) - you never know how large (or small)
+ the stack is, and when the stack cannot fulfill the memory allocation
+ request, the program just crashes.
+ */
+
+#ifdef __GNUC__
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifdef __hpux /* This section must match that of bison generated files. */
+# ifdef __cplusplus
+extern "C" void *alloca (unsigned int);
+# else /* not __cplusplus */
+extern void *alloca ();
+# endif /* not __cplusplus */
+# else /* not __hpux */
+# ifndef alloca
+extern char *alloca ();
+# endif
+# endif /* __hpux */
+# endif
+# endif
+# endif
+#endif
+
+#endif /* _ALLOCA_H */
%{
/* Parse a string into an internal time stamp.
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifdef HAVE_CONFIG_H
# include <config.h>
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# endif
#endif
+#include <alloca.h>
+
/* Since the code of getdate.y is not included in the Emacs executable
itself, there is no need to #define static in this file. Even if
the code were included in the Emacs executable, it probably
/* makepath.c -- Ensure that a directory path exists.
- Copyright (C) 1990, 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1997-1999, 2000, 2002-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
# include <config.h>
#endif
-#if __GNUC__
-# define alloca __builtin_alloca
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- # pragma alloca
-# else
-char *alloca ();
-# endif
-# endif
-#endif
+#include <alloca.h>
#include <stdio.h>
#include <sys/types.h>
-/* Copyright (C) 1992,1995-1999,2000-2002 Free Software Foundation, Inc.
+/* Copyright (C) 1992,1995-1999,2000-2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
# include <config.h>
#endif
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-# endif
-#endif
+#include <alloca.h>
#include <errno.h>
#if !_LIBC
/* userspec.c -- Parse a user and group string.
- Copyright (C) 1989-1992, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
# include <config.h>
#endif
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- # pragma alloca
-# else
-char *alloca ();
-# endif
-# endif
-#endif
+#include <alloca.h>
#include <stdio.h>
#include <sys/types.h>
+2003-01-10 Bruno Haible <bruno@clisp.org>
+
+ * alloca.m4 (gl_FUNC_ALLOCA): Also define ALLOCA_H.
+
2003-01-09 Bruno Haible <bruno@clisp.org>
* stdbool.m4 (AM_STDBOOL_H): New macro.
-# alloca.m4 serial 1
-dnl Copyright (C) 2002 Free Software Foundation, Inc.
+# alloca.m4 serial 2
+dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
if test $ac_cv_func_alloca_works = no; then
gl_PREREQ_ALLOCA
fi
+
+ # Define an additional variable used in the Makefile substitution.
+
+ AC_EGREP_CPP([Need own alloca], [
+#if defined __GNUC__ || defined _MSC_VER || !HAVE_ALLOCA_H
+ Need own alloca
+#endif
+ ],
+ ALLOCA_H=alloca.h,
+ ALLOCA_H=)
+ AC_SUBST([ALLOCA_H])
])
# Prerequisites of lib/alloca.c.
Description:
+Memory allocation on the stack.
Files:
+lib/alloca_.h
lib/alloca.c
m4/alloca.m4
gl_FUNC_ALLOCA
Makefile.am:
+EXTRA_DIST += alloca_.h
+
+# The following is needed in order to create an <alloca.h> when the system
+# doesn't have one that works with the given compiler.
+all-local: @ALLOCA_H@
+alloca.h: alloca_.h
+ cp $(srcdir)/alloca_.h alloca.h
+MOSTLYCLEANFILES += alloca.h
Include:
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-# endif
-#endif
+#include <alloca.h>