xref: /dflybsd-src/gnu/usr.bin/gdb/libgnu/alloca.h (revision c33252afc5aa9790d4820b568316e03d695f6a65)
1*c33252afSJohn Marino /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2*c33252afSJohn Marino /* Memory allocation on the stack.
3*c33252afSJohn Marino 
4*c33252afSJohn Marino    Copyright (C) 1995, 1999, 2001-2004, 2006-2012 Free Software Foundation,
5*c33252afSJohn Marino    Inc.
6*c33252afSJohn Marino 
7*c33252afSJohn Marino    This program is free software; you can redistribute it and/or modify it
8*c33252afSJohn Marino    under the terms of the GNU General Public License as published
9*c33252afSJohn Marino    by the Free Software Foundation; either version 3, or (at your option)
10*c33252afSJohn Marino    any later version.
11*c33252afSJohn Marino 
12*c33252afSJohn Marino    This program is distributed in the hope that it will be useful,
13*c33252afSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
14*c33252afSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15*c33252afSJohn Marino    General Public License for more details.
16*c33252afSJohn Marino 
17*c33252afSJohn Marino    You should have received a copy of the GNU General Public
18*c33252afSJohn Marino    License along with this program; if not, see
19*c33252afSJohn Marino    <http://www.gnu.org/licenses/>.
20*c33252afSJohn Marino   */
21*c33252afSJohn Marino 
22*c33252afSJohn Marino /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
23*c33252afSJohn Marino    means there is a real alloca function.  */
24*c33252afSJohn Marino #ifndef _GL_ALLOCA_H
25*c33252afSJohn Marino #define _GL_ALLOCA_H
26*c33252afSJohn Marino 
27*c33252afSJohn Marino /* alloca (N) returns a pointer to N bytes of memory
28*c33252afSJohn Marino    allocated on the stack, which will last until the function returns.
29*c33252afSJohn Marino    Use of alloca should be avoided:
30*c33252afSJohn Marino      - inside arguments of function calls - undefined behaviour,
31*c33252afSJohn Marino      - in inline functions - the allocation may actually last until the
32*c33252afSJohn Marino        calling function returns,
33*c33252afSJohn Marino      - for huge N (say, N >= 65536) - you never know how large (or small)
34*c33252afSJohn Marino        the stack is, and when the stack cannot fulfill the memory allocation
35*c33252afSJohn Marino        request, the program just crashes.
36*c33252afSJohn Marino  */
37*c33252afSJohn Marino 
38*c33252afSJohn Marino #ifndef alloca
39*c33252afSJohn Marino # ifdef __GNUC__
40*c33252afSJohn Marino #  define alloca __builtin_alloca
41*c33252afSJohn Marino # elif defined _AIX
42*c33252afSJohn Marino #  define alloca __alloca
43*c33252afSJohn Marino # elif defined _MSC_VER
44*c33252afSJohn Marino #  include <malloc.h>
45*c33252afSJohn Marino #  define alloca _alloca
46*c33252afSJohn Marino # elif defined __DECC && defined __VMS
47*c33252afSJohn Marino #  define alloca __ALLOCA
48*c33252afSJohn Marino # elif defined __TANDEM && defined _TNS_E_TARGET
49*c33252afSJohn Marino #  ifdef  __cplusplus
50*c33252afSJohn Marino extern "C"
51*c33252afSJohn Marino #  endif
52*c33252afSJohn Marino void *_alloca (unsigned short);
53*c33252afSJohn Marino #  pragma intrinsic (_alloca)
54*c33252afSJohn Marino #  define alloca _alloca
55*c33252afSJohn Marino # else
56*c33252afSJohn Marino #  include <stddef.h>
57*c33252afSJohn Marino #  ifdef  __cplusplus
58*c33252afSJohn Marino extern "C"
59*c33252afSJohn Marino #  endif
60*c33252afSJohn Marino void *alloca (size_t);
61*c33252afSJohn Marino # endif
62*c33252afSJohn Marino #endif
63*c33252afSJohn Marino 
64*c33252afSJohn Marino #endif /* _GL_ALLOCA_H */
65