On 20 Oct 2022 09:32, Tsukasa OI wrote: > Declarations for MY (f_specific_init) functions are defined in CGEN- > generated header files: sim/cris/decodev10.h (crisv10f_specific_init) and > sim/cris/decodev32.h (crisv32f_specific_init). However, those declarations > are manually added by the commit 4e6e8ba7c565 ("sim: cris: clean up missing > func prototype warnings") as a hack and not a CGEN-generated part. > > Those definitions are required by $(builddir)/sim/cris/mloopv{10,32}f.c, > generated from $(srcdir)/sim/cris/mloop.in. If we define a declaration in > mloop.in, we no longer need manually added one. > > This commit adds a template for function declaration so that we no longer > have to touch CGEN-generated code. With this and the previous commit > "cpu/cris: Add stall unit to CRIS v32", we can now safely regenerate > CRIS CPU declarations with CGEN. > --- > sim/cris/cris-tmpl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sim/cris/cris-tmpl.c b/sim/cris/cris-tmpl.c > index 9f0c06e755e..8694d38b2af 100644 > --- a/sim/cris/cris-tmpl.c > +++ b/sim/cris/cris-tmpl.c > @@ -264,6 +264,8 @@ MY (make_thread_cpu_data) (SIM_CPU *current_cpu, void *context) > > /* Hook function for per-cpu simulator initialization. */ > > +extern void MY (f_specific_init) (SIM_CPU *); > + > void > MY (f_specific_init) (SIM_CPU *current_cpu) > { putting the prototype here means function definition & function usage can fall out of sync and not get any compile error. that's why it has to be in a header that both places include. cris uses cris-sim.h for non-standard funcs like this (e.g. break_handler), so the specific_init prototypes should be moved there too. -mike