aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2011-06-21 09:15:07 -0700
committerPaul Eggert2011-06-21 09:15:07 -0700
commitfa23e171f4d9390c1c4151355ec72f9ff6fc90ab (patch)
tree3545fbfe6da37d20d6cc37a4d2f1be884a868a6a /lib
parent9e9de01439b2c57e79505ba0668894c9addc3bf1 (diff)
downloademacs-fa23e171f4d9390c1c4151355ec72f9ff6fc90ab.tar.gz
emacs-fa23e171f4d9390c1c4151355ec72f9ff6fc90ab.zip
Use gnulib's alloca-opt module.
* .bzrignore: Add lib/alloca.h. * Makefile.in (GNULIB_MODULES): Add alloca-opt. * configure.in (AC_FUNC_ALLOCA): Remove almost all the alloca stuff, as gnulib now does that for us. Put alloca check after gl_INIT. * lib/gnulib.mk, m4/gl-comp.m4: Regenerate. * lib/alloca.in.h, m4/alloca.m4: New files, from gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/alloca.in.h56
-rw-r--r--lib/gnulib.mk25
2 files changed, 80 insertions, 1 deletions
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
new file mode 100644
index 00000000000..5b69c6c81a8
--- /dev/null
+++ b/lib/alloca.in.h
@@ -0,0 +1,56 @@
1/* Memory allocation on the stack.
2
3 Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation,
4 Inc.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public
17 License along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 USA. */
20
21/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
22 means there is a real alloca function. */
23#ifndef _GL_ALLOCA_H
24#define _GL_ALLOCA_H
25
26/* alloca (N) returns a pointer to N bytes of memory
27 allocated on the stack, which will last until the function returns.
28 Use of alloca should be avoided:
29 - inside arguments of function calls - undefined behaviour,
30 - in inline functions - the allocation may actually last until the
31 calling function returns,
32 - for huge N (say, N >= 65536) - you never know how large (or small)
33 the stack is, and when the stack cannot fulfill the memory allocation
34 request, the program just crashes.
35 */
36
37#ifndef alloca
38# ifdef __GNUC__
39# define alloca __builtin_alloca
40# elif defined _AIX
41# define alloca __alloca
42# elif defined _MSC_VER
43# include <malloc.h>
44# define alloca _alloca
45# elif defined __DECC && defined __VMS
46# define alloca __ALLOCA
47# else
48# include <stddef.h>
49# ifdef __cplusplus
50extern "C"
51# endif
52void *alloca (size_t);
53# endif
54#endif
55
56#endif /* _GL_ALLOCA_H */
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 5987138fafb..0fd7f520acb 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdarg stdio strftime strtoumax symlink sys_stat 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdarg stdio strftime strtoumax symlink sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -21,6 +21,29 @@ libgnu_a_LIBADD = $(gl_LIBOBJS)
21libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) 21libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
22EXTRA_libgnu_a_SOURCES = 22EXTRA_libgnu_a_SOURCES =
23 23
24## begin gnulib module alloca-opt
25
26BUILT_SOURCES += $(ALLOCA_H)
27
28# We need the following in order to create <alloca.h> when the system
29# doesn't have one that works with the given compiler.
30if GL_GENERATE_ALLOCA_H
31alloca.h: alloca.in.h $(top_builddir)/config.status
32 $(AM_V_GEN)rm -f $@-t $@ && \
33 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
34 cat $(srcdir)/alloca.in.h; \
35 } > $@-t && \
36 mv -f $@-t $@
37else
38alloca.h: $(top_builddir)/config.status
39 rm -f $@
40endif
41MOSTLYCLEANFILES += alloca.h alloca.h-t
42
43EXTRA_DIST += alloca.in.h
44
45## end gnulib module alloca-opt
46
24## begin gnulib module allocator 47## begin gnulib module allocator
25 48
26libgnu_a_SOURCES += allocator.c 49libgnu_a_SOURCES += allocator.c