Move GC-related definitions to eval-gc.hh

This commit is contained in:
Eelco Dolstra 2024-09-19 20:54:30 +02:00
parent 31d408c351
commit 589d8f1f2b
7 changed files with 19 additions and 39 deletions

View file

@ -29,11 +29,6 @@
#include "ref.hh" #include "ref.hh"
#include "value.hh" #include "value.hh"
#if HAVE_BOEHMGC
#define GC_INCLUDE_NEW
#include <gc/gc_cpp.h>
#endif
#include "strings.hh" #include "strings.hh"
namespace nix { namespace nix {

View file

@ -14,12 +14,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#if HAVE_BOEHMGC
# include "gc/gc.h"
# define GC_INCLUDE_NEW 1
# include "gc_cpp.h"
#endif
void nix_set_string_return(nix_string_return * str, const char * c) void nix_set_string_return(nix_string_return * str, const char * c)
{ {
str->str = c; str->str = c;

View file

@ -14,12 +14,6 @@
#include "nix_api_value.h" #include "nix_api_value.h"
#include "value/context.hh" #include "value/context.hh"
#if HAVE_BOEHMGC
# include "gc/gc.h"
# define GC_INCLUDE_NEW 1
# include "gc_cpp.h"
#endif
// Internal helper functions to check [in] and [out] `Value *` parameters // Internal helper functions to check [in] and [out] `Value *` parameters
static const nix::Value & check_value_not_null(const nix_value * value) static const nix::Value & check_value_not_null(const nix_value * value)
{ {

View file

@ -3,6 +3,24 @@
#include <cstddef> #include <cstddef>
#if HAVE_BOEHMGC
# define GC_INCLUDE_NEW
# include <gc/gc.h>
# include <gc/gc_cpp.h>
# include <gc/gc_allocator.h>
#else
template<typename T>
using traceable_allocator = std::allocator<T>;
template<typename T>
using gc_allocator = std::allocator<T>;
#endif
namespace nix { namespace nix {
/** /**

View file

@ -1,5 +1,4 @@
#include "eval.hh" #include "eval.hh"
#include "eval-gc.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "primops.hh" #include "primops.hh"
#include "print-options.hh" #include "print-options.hh"
@ -39,16 +38,6 @@
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
#if HAVE_BOEHMGC
# define GC_INCLUDE_NEW
# include <gc/gc.h>
# include <gc/gc_cpp.h>
# include <gc/gc_allocator.h>
#endif
#include "strings-inline.hh" #include "strings-inline.hh"
using json = nlohmann::json; using json = nlohmann::json;

View file

@ -4,22 +4,13 @@
#include <cassert> #include <cassert>
#include <span> #include <span>
#include "eval-gc.hh"
#include "symbol-table.hh" #include "symbol-table.hh"
#include "value/context.hh" #include "value/context.hh"
#include "source-path.hh" #include "source-path.hh"
#include "print-options.hh" #include "print-options.hh"
#include "checked-arithmetic.hh" #include "checked-arithmetic.hh"
#if HAVE_BOEHMGC
#include <gc/gc_allocator.h>
#else
template<typename T>
using traceable_allocator = std::allocator<T>;
template<typename T>
using gc_allocator = std::allocator<T>;
#endif
#include <nlohmann/json_fwd.hpp> #include <nlohmann/json_fwd.hpp>
namespace nix { namespace nix {

View file

@ -2,7 +2,6 @@
#include "current-process.hh" #include "current-process.hh"
#include "command.hh" #include "command.hh"
#include "common-args.hh" #include "common-args.hh"
#include "eval-gc.hh"
#include "eval.hh" #include "eval.hh"
#include "eval-settings.hh" #include "eval-settings.hh"
#include "globals.hh" #include "globals.hh"