From c944cad7b1539549078d7e512dac84d543deef77 Mon Sep 17 00:00:00 2001 From: Slobodan Predolac Date: Tue, 2 Jun 2026 09:50:20 -0700 Subject: [PATCH] Break two include cycles - test_hooks.h: drop the #include of jemalloc_preamble.h. preamble pulls test_hooks.h, and test_hooks.h needs nothing from preamble. - edata.h: drop the #include of prof_types.h in favor of forward declarations of prof_tctx_t and prof_recent_t (used only as pointer types). prof_structs.h can then drop its #include of edata.h, severing the edata <-> prof_types coupling. --- include/jemalloc/internal/edata.h | 5 ++++- include/jemalloc/internal/prof_structs.h | 1 - include/jemalloc/internal/test_hooks.h | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/jemalloc/internal/edata.h b/include/jemalloc/internal/edata.h index 217232f7..198d55e1 100644 --- a/include/jemalloc/internal/edata.h +++ b/include/jemalloc/internal/edata.h @@ -8,13 +8,16 @@ #include "jemalloc/internal/hpdata.h" #include "jemalloc/internal/nstime.h" #include "jemalloc/internal/ph.h" -#include "jemalloc/internal/prof_types.h" #include "jemalloc/internal/ql.h" #include "jemalloc/internal/sc.h" #include "jemalloc/internal/slab_data.h" #include "jemalloc/internal/sz.h" #include "jemalloc/internal/typed_list.h" +/* Opaque to edata; only stored as pointers in e_prof_info_t. */ +typedef struct prof_tctx_s prof_tctx_t; +typedef struct prof_recent_s prof_recent_t; + /* * sizeof(edata_t) is 128 bytes on 64-bit architectures. Ensure the alignment * to free up the low bits in the rtree leaf. diff --git a/include/jemalloc/internal/prof_structs.h b/include/jemalloc/internal/prof_structs.h index d38b15ea..d3a13718 100644 --- a/include/jemalloc/internal/prof_structs.h +++ b/include/jemalloc/internal/prof_structs.h @@ -3,7 +3,6 @@ #include "jemalloc/internal/jemalloc_preamble.h" #include "jemalloc/internal/ckh.h" -#include "jemalloc/internal/edata.h" #include "jemalloc/internal/mutex.h" #include "jemalloc/internal/prng.h" #include "jemalloc/internal/rb.h" diff --git a/include/jemalloc/internal/test_hooks.h b/include/jemalloc/internal/test_hooks.h index 9df15383..1b56c717 100644 --- a/include/jemalloc/internal/test_hooks.h +++ b/include/jemalloc/internal/test_hooks.h @@ -1,8 +1,6 @@ #ifndef JEMALLOC_INTERNAL_TEST_HOOKS_H #define JEMALLOC_INTERNAL_TEST_HOOKS_H -#include "jemalloc/internal/jemalloc_preamble.h" - extern JEMALLOC_EXPORT void (*test_hooks_arena_new_hook)(void); extern JEMALLOC_EXPORT void (*test_hooks_libc_hook)(void); extern JEMALLOC_EXPORT void (*test_hooks_safety_check_abort)(const char *);