On Thu, Jan 12, 2023 at 2:46 AM Palmer Dabbelt <pal...@rivosinc.com> wrote: > > As of 6f5b06032eb ("Finish gimple_build API enhancement") gimple-fold.h > uses some of the declarations from gimple-iterator.h, which causes > issues when building Linux's stackprotector plugin. > > gcc/ChangeLog: > > * gimple-fold.h: Add gimple-iterator.h include. > > --- > > I'm not sure if this should instead be fixed in Linux by reordering the > includes along the lines of > > diff --git a/scripts/gcc-plugins/gcc-common.h > b/scripts/gcc-plugins/gcc-common.h > index 9a1895747b15..2c3a3079128a 100644 > --- a/scripts/gcc-plugins/gcc-common.h > +++ b/scripts/gcc-plugins/gcc-common.h > @@ -72,6 +72,7 @@ > #include "stor-layout.h" > #include "internal-fn.h" > #include "gimple-expr.h" > +#include "gimple-iterator.h" > #include "gimple-fold.h" > #include "context.h" > #include "tree-ssa-alias.h" > @@ -88,7 +89,6 @@ > #include "gimple.h" > #include "tree-phinodes.h" > #include "tree-cfg.h" > -#include "gimple-iterator.h" > #include "gimple-ssa.h" > #include "ssa-iterators.h"
The above change is OK. > but I figured it was slightly easier for users to keep these compatible. > It looks like many GCC-internal uses of gimple-fold.h already have the > gimple-iterator.h include right before, though, so not sure if that's > how things are meant to be. > --- > gcc/gimple-fold.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h > index 2fd58db9a2e..66bee2b75df 100644 > --- a/gcc/gimple-fold.h > +++ b/gcc/gimple-fold.h > @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see > #ifndef GCC_GIMPLE_FOLD_H > #define GCC_GIMPLE_FOLD_H > > +#include "gimple-iterator.h" > + But this is not - we try to avoid #include directives in headers, we want the include dependences to be "flat" > extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL); > extern tree canonicalize_constructor_val (tree, tree); > extern tree get_symbol_constant_value (tree); > -- > 2.39.0 >