[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 <noreply@anthropic.com>
This commit is contained in:
Skef Iterum committed 2026-06-07 23:25:20 -07:00
1 parent 71984479b1
commit 0d87bb8e7f
1 file changed
+3 -3
+3 -3
View File
@@ -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 <hb-subset.h> instead."
#endif
#ifndef HB_SUBSET_DEPEND_H
#define HB_SUBSET_DEPEND_H
#include "hb.h"
HB_BEGIN_DECLS