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

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