[06/40] sim/cris: Move declarations of f_specific_init

Message ID 3904a5c3e80f8548150d8088a92059dd728c7ff8.1666257885.git.research_trasio@irq.a4lg.com
State Accepted
Headers
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Tsukasa OI Oct. 20, 2022, 9:25 a.m. UTC
  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(+)
  

Comments

Hans-Peter Nilsson Oct. 22, 2022, 1:46 a.m. UTC | #1
On Thu, 20 Oct 2022, Tsukasa OI via Binutils 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)
>  {
> -- 
> 2.34.1
> 
> 

Ok, thanks.

brgds, H-P
  

Patch

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)
 {