annotate lib/alloca.in.h @ 276:23034db7dd8a 2.5

fixed expression 'slots' to not store null on a pass 1 store
author lost
date Mon, 31 Aug 2009 08:39:36 +0000
parents d5392bb5da3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
d5392bb5da3c Added generated files
lost
parents:
diff changeset
1 /* Memory allocation on the stack.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
2
d5392bb5da3c Added generated files
lost
parents:
diff changeset
3 Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
d5392bb5da3c Added generated files
lost
parents:
diff changeset
4 Foundation, Inc.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
5
d5392bb5da3c Added generated files
lost
parents:
diff changeset
6 This program is free software; you can redistribute it and/or modify it
d5392bb5da3c Added generated files
lost
parents:
diff changeset
7 under the terms of the GNU General Public License as published
d5392bb5da3c Added generated files
lost
parents:
diff changeset
8 by the Free Software Foundation; either version 3, or (at your option)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
9 any later version.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
10
d5392bb5da3c Added generated files
lost
parents:
diff changeset
11 This program is distributed in the hope that it will be useful,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
d5392bb5da3c Added generated files
lost
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d5392bb5da3c Added generated files
lost
parents:
diff changeset
14 General Public License for more details.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
15
d5392bb5da3c Added generated files
lost
parents:
diff changeset
16 You should have received a copy of the GNU General Public
d5392bb5da3c Added generated files
lost
parents:
diff changeset
17 License along with this program; if not, write to the Free Software
d5392bb5da3c Added generated files
lost
parents:
diff changeset
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
19 USA. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
20
d5392bb5da3c Added generated files
lost
parents:
diff changeset
21 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
22 means there is a real alloca function. */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
23 #ifndef _GL_ALLOCA_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
24 #define _GL_ALLOCA_H
d5392bb5da3c Added generated files
lost
parents:
diff changeset
25
d5392bb5da3c Added generated files
lost
parents:
diff changeset
26 /* alloca (N) returns a pointer to N bytes of memory
d5392bb5da3c Added generated files
lost
parents:
diff changeset
27 allocated on the stack, which will last until the function returns.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
28 Use of alloca should be avoided:
d5392bb5da3c Added generated files
lost
parents:
diff changeset
29 - inside arguments of function calls - undefined behaviour,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
30 - in inline functions - the allocation may actually last until the
d5392bb5da3c Added generated files
lost
parents:
diff changeset
31 calling function returns,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
32 - for huge N (say, N >= 65536) - you never know how large (or small)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
33 the stack is, and when the stack cannot fulfill the memory allocation
d5392bb5da3c Added generated files
lost
parents:
diff changeset
34 request, the program just crashes.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
35 */
d5392bb5da3c Added generated files
lost
parents:
diff changeset
36
d5392bb5da3c Added generated files
lost
parents:
diff changeset
37 #ifndef alloca
d5392bb5da3c Added generated files
lost
parents:
diff changeset
38 # ifdef __GNUC__
d5392bb5da3c Added generated files
lost
parents:
diff changeset
39 # define alloca __builtin_alloca
d5392bb5da3c Added generated files
lost
parents:
diff changeset
40 # elif defined _AIX
d5392bb5da3c Added generated files
lost
parents:
diff changeset
41 # define alloca __alloca
d5392bb5da3c Added generated files
lost
parents:
diff changeset
42 # elif defined _MSC_VER
d5392bb5da3c Added generated files
lost
parents:
diff changeset
43 # include <malloc.h>
d5392bb5da3c Added generated files
lost
parents:
diff changeset
44 # define alloca _alloca
d5392bb5da3c Added generated files
lost
parents:
diff changeset
45 # elif defined __DECC && defined __VMS
d5392bb5da3c Added generated files
lost
parents:
diff changeset
46 # define alloca __ALLOCA
d5392bb5da3c Added generated files
lost
parents:
diff changeset
47 # else
d5392bb5da3c Added generated files
lost
parents:
diff changeset
48 # include <stddef.h>
d5392bb5da3c Added generated files
lost
parents:
diff changeset
49 # ifdef __cplusplus
d5392bb5da3c Added generated files
lost
parents:
diff changeset
50 extern "C"
d5392bb5da3c Added generated files
lost
parents:
diff changeset
51 # endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
52 void *alloca (size_t);
d5392bb5da3c Added generated files
lost
parents:
diff changeset
53 # endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
54 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
55
d5392bb5da3c Added generated files
lost
parents:
diff changeset
56 #endif /* _GL_ALLOCA_H */