annotate lib/alloca.in.h @ 448:5cccf90bf838 3.0 tip

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