root/maint/gnulib/lib/malloc.in.h

/* [previous][next][first][last][top][bottom][index][help] */
   1 /* Substitute for and wrapper around <malloc.h>.
   2    Copyright (C) 2020-2021 Free Software Foundation, Inc.
   3 
   4    This file is free software: you can redistribute it and/or modify
   5    it under the terms of the GNU Lesser General Public License as
   6    published by the Free Software Foundation; either version 2.1 of the
   7    License, or (at your option) any later version.
   8 
   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 
  14    You should have received a copy of the GNU Lesser General Public License
  15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  16 
  17 #ifndef _@GUARD_PREFIX@_MALLOC_H
  18 
  19 #if __GNUC__ >= 3
  20 @PRAGMA_SYSTEM_HEADER@
  21 #endif
  22 @PRAGMA_COLUMNS@
  23 
  24 /* The include_next requires a split double-inclusion guard.  */
  25 #if @HAVE_MALLOC_H@
  26 # @INCLUDE_NEXT@ @NEXT_MALLOC_H@
  27 #endif
  28 
  29 #ifndef _@GUARD_PREFIX@_MALLOC_H
  30 #define _@GUARD_PREFIX@_MALLOC_H
  31 
  32 /* Solaris declares memalign() in <stdlib.h>, not in <malloc.h>.
  33    Also get size_t and free().  */
  34 #include <stdlib.h>
  35 
  36 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
  37 
  38 /* The definition of _GL_WARN_ON_USE is copied here.  */
  39 
  40 
  41 /* Declare overridden functions.  */
  42 
  43 #if @GNULIB_MEMALIGN@
  44 # if @REPLACE_MEMALIGN@
  45 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  46 #   undef memalign
  47 #   define memalign rpl_memalign
  48 #  endif
  49 _GL_FUNCDECL_RPL (memalign, void *,
  50                   (size_t alignment, size_t size)
  51                   _GL_ATTRIBUTE_DEALLOC_FREE);
  52 _GL_CXXALIAS_RPL (memalign, void *, (size_t alignment, size_t size));
  53 # else
  54 #  if @HAVE_MEMALIGN@
  55 #   if __GNUC__ >= 11
  56 /* For -Wmismatched-dealloc: Associate memalign with free or rpl_free.  */
  57 _GL_FUNCDECL_SYS (memalign, void *,
  58                   (size_t alignment, size_t size)
  59                   _GL_ATTRIBUTE_DEALLOC_FREE);
  60 #   endif
  61 _GL_CXXALIAS_SYS (memalign, void *, (size_t alignment, size_t size));
  62 #  endif
  63 # endif
  64 # if @HAVE_MEMALIGN@
  65 _GL_CXXALIASWARN (memalign);
  66 # endif
  67 #else
  68 # if __GNUC__ >= 11 && !defined memalign
  69 /* For -Wmismatched-dealloc: Associate memalign with free or rpl_free.  */
  70 _GL_FUNCDECL_SYS (memalign, void *,
  71                   (size_t alignment, size_t size)
  72                   _GL_ATTRIBUTE_DEALLOC_FREE);
  73 # endif
  74 # if defined GNULIB_POSIXCHECK
  75 #  undef memalign
  76 #  if HAVE_RAW_DECL_MEMALIGN
  77 _GL_WARN_ON_USE (memalign, "memalign is not portable - "
  78                  "use gnulib module memalign for portability");
  79 #  endif
  80 # endif
  81 #endif
  82 
  83 
  84 #endif /* _@GUARD_PREFIX@_MALLOC_H */
  85 #endif /* _@GUARD_PREFIX@_MALLOC_H */

/* [previous][next][first][last][top][bottom][index][help] */