IIRC you can't do `g_return_if_fail(DOC_VALID(doc))` because this macro uses `G_LIKELY()` and so does `g_return_if_fail()`.