  This paper studies a generic fourth-order theory of gravity with Lagrangian
density $f(R,R_c^2,R_m^2, \mathscr{L}_m)$. By considering explicit $R^2$
dependence and imposing the "coherence condition" $f_{R^2}\!=\!f_{R_m^2}\!=\!
-f_{R_c^2}/4$, the field equations of $f(R,R^2,R_c^2,R_m^2, \mathscr{L}_m)$
gravity can be smoothly reduced to that of $f(R,\mathcal{G},\mathscr{L}_m)$
generalized Gauss-Bonnet gravity. We use Noether's conservation law to study
the $f(\mathcal{R}_1,\mathcal{R}_2\ldots,\mathcal{R}_n,\mathscr{L}_m)$ model
with nonminimal coupling between $\mathscr{L}_m$ and Riemannian invariants $
\mathcal{R}_i$, and conjecture that the gradient of nonminimal gravitational
coupling strength $\nabla^\mu f_{\!\mathscr{L}_m}$ is the only source for
energy-momentum non-conservation. This conjecture is applied to the
$f(R,R_c^2,R_m^2, \mathscr{L}_m)$ model, and the equations of continuity and
non-geodesic motion of different matter contents are investigated. Finally, the
field equation for Lagrangians including the traceless-Ricci square and
traceless-Riemann (Weyl) square invariants is derived, the $f(R,R_c^2,R_m^2,
\mathscr{L}_m)$ model is compared with the $f(R,R_c^2,R_m^2,T)+2\kappa
\mathscr{L}_m$ model, and consequences of nonminimal coupling for black hole
and wormhole physics are considered.
