Blame gettext-tools/gnulib-lib/alloca.in.h

Packit 5b56b6
/* Memory allocation on the stack.
Packit 5b56b6
   Copyright (C) 1995, 1999, 2001-2007, 2015 Free Software Foundation,
Packit 5b56b6
   Inc.
Packit 5b56b6
Packit 5b56b6
   This program is free software: you can redistribute it and/or modify
Packit 5b56b6
   it under the terms of the GNU General Public License as published by
Packit 5b56b6
   the Free Software Foundation; either version 3 of the License, or
Packit 5b56b6
   (at your option) any later version.
Packit 5b56b6
Packit 5b56b6
   This program is distributed in the hope that it will be useful,
Packit 5b56b6
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 5b56b6
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 5b56b6
   GNU General Public License for more details.
Packit 5b56b6
Packit 5b56b6
   You should have received a copy of the GNU General Public License
Packit 5b56b6
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit 5b56b6
Packit 5b56b6
/* When this file is included, it may be preceded only by preprocessor
Packit 5b56b6
   declarations.  Thanks to AIX.  Therefore we include it right after
Packit 5b56b6
   "config.h", not later.  */
Packit 5b56b6
Packit 5b56b6
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
Packit 5b56b6
   means there is a real alloca function.  */
Packit 5b56b6
#ifndef _GL_ALLOCA_H
Packit 5b56b6
#define _GL_ALLOCA_H
Packit 5b56b6
Packit 5b56b6
/* alloca(N) returns a pointer (void* or char*) to N bytes of memory
Packit 5b56b6
   allocated on the stack, and which will last until the function returns.
Packit 5b56b6
   Use of alloca should be avoided:
Packit 5b56b6
     - inside arguments of function calls - undefined behaviour,
Packit 5b56b6
     - in inline functions - the allocation may actually last until the
Packit 5b56b6
       calling function returns,
Packit 5b56b6
     - for huge N (say, N >= 65536) - you never know how large (or small)
Packit 5b56b6
       the stack is, and when the stack cannot fulfill the memory allocation
Packit 5b56b6
       request, the program just crashes.
Packit 5b56b6
 */
Packit 5b56b6
Packit 5b56b6
#ifndef alloca
Packit 5b56b6
# ifdef __GNUC__
Packit 5b56b6
#   define alloca __builtin_alloca
Packit 5b56b6
# else
Packit 5b56b6
#  ifdef _MSC_VER
Packit 5b56b6
#   include <malloc.h>
Packit 5b56b6
#   define alloca _alloca
Packit 5b56b6
#  else
Packit 5b56b6
#   if HAVE_ALLOCA_H
Packit 5b56b6
#    include <alloca.h>
Packit 5b56b6
#   else
Packit 5b56b6
#    ifdef _AIX
Packit 5b56b6
 #pragma alloca
Packit 5b56b6
#    else
Packit 5b56b6
#     ifdef __hpux /* This section must match that of bison generated files. */
Packit 5b56b6
#      ifdef __cplusplus
Packit 5b56b6
extern "C" void *alloca (unsigned int);
Packit 5b56b6
#      else /* not __cplusplus */
Packit 5b56b6
extern void *alloca ();
Packit 5b56b6
#      endif /* not __cplusplus */
Packit 5b56b6
#     else /* not __hpux */
Packit 5b56b6
#      ifndef alloca
Packit 5b56b6
extern char *alloca ();
Packit 5b56b6
#      endif
Packit 5b56b6
#     endif /* __hpux */
Packit 5b56b6
#    endif
Packit 5b56b6
#   endif
Packit 5b56b6
#  endif
Packit 5b56b6
# endif
Packit 5b56b6
#endif
Packit 5b56b6
Packit 5b56b6
#endif /* _GL_ALLOCA_H */