alloca.h 2.5 KB

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