Blame gnulib/lib/alloca.in.h

Packit eba2e2
/* Memory allocation on the stack.
Packit eba2e2
Packit eba2e2
   Copyright (C) 1995, 1999, 2001-2004, 2006-2014 Free Software Foundation,
Packit eba2e2
   Inc.
Packit eba2e2
Packit eba2e2
   This program is free software; you can redistribute it and/or modify it
Packit eba2e2
   under the terms of the GNU General Public License as published
Packit eba2e2
   by the Free Software Foundation; either version 3, or (at your option)
Packit eba2e2
   any later version.
Packit eba2e2
Packit eba2e2
   This program is distributed in the hope that it will be useful,
Packit eba2e2
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit eba2e2
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit eba2e2
   General Public License for more details.
Packit eba2e2
Packit eba2e2
   You should have received a copy of the GNU General Public
Packit eba2e2
   License along with this program; if not, see
Packit eba2e2
   <http://www.gnu.org/licenses/>.
Packit eba2e2
  */
Packit eba2e2
Packit eba2e2
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
Packit eba2e2
   means there is a real alloca function.  */
Packit eba2e2
#ifndef _GL_ALLOCA_H
Packit eba2e2
#define _GL_ALLOCA_H
Packit eba2e2
Packit eba2e2
/* alloca (N) returns a pointer to N bytes of memory
Packit eba2e2
   allocated on the stack, which will last until the function returns.
Packit eba2e2
   Use of alloca should be avoided:
Packit eba2e2
     - inside arguments of function calls - undefined behaviour,
Packit eba2e2
     - in inline functions - the allocation may actually last until the
Packit eba2e2
       calling function returns,
Packit eba2e2
     - for huge N (say, N >= 65536) - you never know how large (or small)
Packit eba2e2
       the stack is, and when the stack cannot fulfill the memory allocation
Packit eba2e2
       request, the program just crashes.
Packit eba2e2
 */
Packit eba2e2
Packit eba2e2
#ifndef alloca
Packit eba2e2
# ifdef __GNUC__
Packit eba2e2
#  define alloca __builtin_alloca
Packit eba2e2
# elif defined _AIX
Packit eba2e2
#  define alloca __alloca
Packit eba2e2
# elif defined _MSC_VER
Packit eba2e2
#  include <malloc.h>
Packit eba2e2
#  define alloca _alloca
Packit eba2e2
# elif defined __DECC && defined __VMS
Packit eba2e2
#  define alloca __ALLOCA
Packit eba2e2
# elif defined __TANDEM && defined _TNS_E_TARGET
Packit eba2e2
#  ifdef  __cplusplus
Packit eba2e2
extern "C"
Packit eba2e2
#  endif
Packit eba2e2
void *_alloca (unsigned short);
Packit eba2e2
#  pragma intrinsic (_alloca)
Packit eba2e2
#  define alloca _alloca
Packit eba2e2
# else
Packit eba2e2
#  include <stddef.h>
Packit eba2e2
#  ifdef  __cplusplus
Packit eba2e2
extern "C"
Packit eba2e2
#  endif
Packit eba2e2
void *alloca (size_t);
Packit eba2e2
# endif
Packit eba2e2
#endif
Packit eba2e2
Packit eba2e2
#endif /* _GL_ALLOCA_H */