From 0d87bb8e7fac3ad65610fefefc109a399c4d5f2a Mon Sep 17 00:00:00 2001 From: Skef Iterum Date: Sun, 7 Jun 2026 23:25:20 -0700 Subject: [PATCH] [depend] Fix unity build: move include guard before error check In the unity build (harfbuzz-subset.cc), hb-subset.h is included transitively through hb-open-type.hh before hb-depend.cc is compiled. hb-subset.h defines HB_SUBSET_H_IN, includes subheaders, then #undefs it. When hb-depend.hh later re-includes hb-subset-depend.h, the #error check fired because HB_SUBSET_H_IN was no longer defined. Fix by moving the include guard (#ifndef HB_SUBSET_DEPEND_H) before the direct-include error check. On the first include (from hb-subset.h, where HB_SUBSET_H_IN is set), both pass. On subsequent includes, the include guard skips everything, including the error check. The guard still catches truly direct includes from user code that never included hb-subset.h. Assisted-by: Claude --- src/hb-subset-depend.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-subset-depend.h b/src/hb-subset-depend.h index a776a82e1..24917991e 100644 --- a/src/hb-subset-depend.h +++ b/src/hb-subset-depend.h @@ -24,13 +24,13 @@ * Adobe Author(s): Skef Iterum */ +#ifndef HB_SUBSET_DEPEND_H +#define HB_SUBSET_DEPEND_H + #if !defined(HB_SUBSET_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR) #error "Include instead." #endif -#ifndef HB_SUBSET_DEPEND_H -#define HB_SUBSET_DEPEND_H - #include "hb.h" HB_BEGIN_DECLS