ggc-none.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Null garbage collection for the GNU compiler.
  2. Copyright (C) 1998-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  11. License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. /* This version is used by the gen* programs and certain language-specific
  16. targets (such as java), where we don't really need GC at all.
  17. This prevents problems with pulling in all the tree stuff. */
  18. #ifdef GENERATOR_FILE
  19. #include "bconfig.h"
  20. #else
  21. #include "config.h"
  22. #endif
  23. #include "system.h"
  24. #include "coretypes.h"
  25. #include "ggc.h"
  26. /* For a given size of memory requested for allocation, return the
  27. actual size that is going to be allocated. */
  28. size_t
  29. ggc_round_alloc_size (size_t requested_size)
  30. {
  31. return requested_size;
  32. }
  33. void *
  34. ggc_internal_alloc (size_t size, void (*f)(void *), size_t, size_t
  35. MEM_STAT_DECL)
  36. {
  37. gcc_assert (!f); // ggc-none doesn't support finalizers
  38. return xmalloc (size);
  39. }
  40. void *
  41. ggc_internal_cleared_alloc (size_t size, void (*f)(void *), size_t, size_t
  42. MEM_STAT_DECL)
  43. {
  44. gcc_assert (!f); // ggc-none doesn't support finalizers
  45. return xcalloc (size, 1);
  46. }
  47. void *
  48. ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
  49. {
  50. return xrealloc (x, size);
  51. }
  52. void
  53. ggc_free (void *p)
  54. {
  55. free (p);
  56. }
  57. void
  58. ggc_grow (void)
  59. {
  60. }