Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] sim/aarch64: Fix type error in declaration
@ 2022-08-25 12:14 Jan-Benedict Glaw
  2022-08-25 12:21 ` Luis Machado via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Jan-Benedict Glaw @ 2022-08-25 12:14 UTC (permalink / raw)
  To: gdb-patches, Nick Clifton, Jim Wilson

[-- Attachment #1: Type: text/plain, Size: 3314 bytes --]

Hi!

While building with very recent GCC versions, I noticed these build
issues for aarch64-{elf,linux-gnu,linux,rtems}:

.../configure --prefix=/tmp/gdb-aarch64-elf --target=aarch64-elf
[...]
make V=1 all-gdb
[...]
/usr/lib/gcc-snapshot/bin/gcc  -DHAVE_CONFIG_H   -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror  -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../..  -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import  -g -O2   -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c
cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch]
  270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask)
      | ^~~~~~~~~~~~~~~~~~~~~
In file included from sim-main.h:30,
                 from cpustate.c:28:
cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'}
  310 | extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
      |                    ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:509: cpustate.o] Error 1
make[3]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64'
make[2]: *** [Makefile:1929: all-recursive] Error 1
make[2]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
make[1]: *** [Makefile:1181: all] Error 2
make[1]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
make: *** [Makefile:11309: all-sim] Error 2


This fixes the declaration:


diff --git a/sim/aarch64/cpustate.h b/sim/aarch64/cpustate.h
index 1d25b3af15a..94e0bc80333 100644
--- a/sim/aarch64/cpustate.h
+++ b/sim/aarch64/cpustate.h
@@ -307,7 +307,7 @@ extern void        aarch64_save_LR (sim_cpu *);
 /* Flag register accessors.  */
 extern uint32_t    aarch64_get_CPSR       (sim_cpu *);
 extern void        aarch64_set_CPSR       (sim_cpu *, uint32_t);
-extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
+extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, FlagMask);
 extern void        aarch64_set_CPSR_bits  (sim_cpu *, uint32_t, uint32_t);
 extern uint32_t    aarch64_test_CPSR_bit  (sim_cpu *, FlagMask);
 extern void        aarch64_set_CPSR_bit   (sim_cpu *, FlagMask);


OK to install?

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim/aarch64: Fix type error in declaration
  2022-08-25 12:14 [PATCH] sim/aarch64: Fix type error in declaration Jan-Benedict Glaw
@ 2022-08-25 12:21 ` Luis Machado via Gdb-patches
  2022-08-25 12:55   ` Andrew Burgess via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado via Gdb-patches @ 2022-08-25 12:21 UTC (permalink / raw)
  To: Jan-Benedict Glaw, gdb-patches, Nick Clifton, Jim Wilson, Andrew Burgess

On 8/25/22 13:14, Jan-Benedict Glaw wrote:
> Hi!
> 
> While building with very recent GCC versions, I noticed these build
> issues for aarch64-{elf,linux-gnu,linux,rtems}:
> 
> .../configure --prefix=/tmp/gdb-aarch64-elf --target=aarch64-elf
> [...]
> make V=1 all-gdb
> [...]
> /usr/lib/gcc-snapshot/bin/gcc  -DHAVE_CONFIG_H   -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror  -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../..  -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import  -g -O2   -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c
> cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch]
>    270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask)
>        | ^~~~~~~~~~~~~~~~~~~~~
> In file included from sim-main.h:30,
>                   from cpustate.c:28:
> cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'}
>    310 | extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
>        |                    ^~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[3]: *** [Makefile:509: cpustate.o] Error 1
> make[3]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64'
> make[2]: *** [Makefile:1929: all-recursive] Error 1
> make[2]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
> make[1]: *** [Makefile:1181: all] Error 2
> make[1]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
> make: *** [Makefile:11309: all-sim] Error 2
> 
> 
> This fixes the declaration:
> 
> 
> diff --git a/sim/aarch64/cpustate.h b/sim/aarch64/cpustate.h
> index 1d25b3af15a..94e0bc80333 100644
> --- a/sim/aarch64/cpustate.h
> +++ b/sim/aarch64/cpustate.h
> @@ -307,7 +307,7 @@ extern void        aarch64_save_LR (sim_cpu *);
>   /* Flag register accessors.  */
>   extern uint32_t    aarch64_get_CPSR       (sim_cpu *);
>   extern void        aarch64_set_CPSR       (sim_cpu *, uint32_t);
> -extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
> +extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, FlagMask);
>   extern void        aarch64_set_CPSR_bits  (sim_cpu *, uint32_t, uint32_t);
>   extern uint32_t    aarch64_test_CPSR_bit  (sim_cpu *, FlagMask);
>   extern void        aarch64_set_CPSR_bit   (sim_cpu *, FlagMask);
> 
> 
> OK to install?
> 
> Thanks,
>    Jan-Benedict
> 

LGTM. I think Andrew might be able to OK this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim/aarch64: Fix type error in declaration
  2022-08-25 12:21 ` Luis Machado via Gdb-patches
@ 2022-08-25 12:55   ` Andrew Burgess via Gdb-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess via Gdb-patches @ 2022-08-25 12:55 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: Jim Wilson, Nick Clifton, gdb-patches

* Luis Machado <luis.machado@arm.com> [2022-08-25 13:21:35 +0100]:

> On 8/25/22 13:14, Jan-Benedict Glaw wrote:
> > Hi!
> > 
> > While building with very recent GCC versions, I noticed these build
> > issues for aarch64-{elf,linux-gnu,linux,rtems}:
> > 
> > .../configure --prefix=/tmp/gdb-aarch64-elf --target=aarch64-elf
> > [...]
> > make V=1 all-gdb
> > [...]
> > /usr/lib/gcc-snapshot/bin/gcc  -DHAVE_CONFIG_H   -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -Wall -Wdeclaration-after-statement -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wno-error=maybe-uninitialized -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wmissing-parameter-type -Wpointer-sign -Wold-style-declaration -Werror  -I. -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64 -I../common -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../common -I../../include -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../include -I../../bfd -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../bfd -I../../opcodes -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../opcodes -I../..  -I/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64/../../gnulib/import -I../../gnulib/import  -g -O2   -c -o cpustate.o -MT cpustate.o -MMD -MP -MF .deps/cpustate.Tpo cpustate.c
> > cpustate.c:270:1: error: conflicting types for 'aarch64_get_CPSR_bits' due to enum/integer mismatch; have 'uint32_t(sim_cpu *, FlagMask)' {aka 'unsigned int(struct _sim_cpu *, FlagMask)'} [-Werror=enum-int-mismatch]
> >    270 | aarch64_get_CPSR_bits (sim_cpu *cpu, FlagMask mask)
> >        | ^~~~~~~~~~~~~~~~~~~~~
> > In file included from sim-main.h:30,
> >                   from cpustate.c:28:
> > cpustate.h:310:20: note: previous declaration of 'aarch64_get_CPSR_bits' with type 'uint32_t(sim_cpu *, uint32_t)' {aka 'unsigned int(struct _sim_cpu *, unsigned int)'}
> >    310 | extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
> >        |                    ^~~~~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
> > make[3]: *** [Makefile:509: cpustate.o] Error 1
> > make[3]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim/aarch64'
> > make[2]: *** [Makefile:1929: all-recursive] Error 1
> > make[2]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
> > make[1]: *** [Makefile:1181: all] Error 2
> > make[1]: Leaving directory '/var/lib/laminar/run/gdb-aarch64-elf/1/binutils-gdb/sim'
> > make: *** [Makefile:11309: all-sim] Error 2
> > 
> > 
> > This fixes the declaration:
> > 
> > 
> > diff --git a/sim/aarch64/cpustate.h b/sim/aarch64/cpustate.h
> > index 1d25b3af15a..94e0bc80333 100644
> > --- a/sim/aarch64/cpustate.h
> > +++ b/sim/aarch64/cpustate.h
> > @@ -307,7 +307,7 @@ extern void        aarch64_save_LR (sim_cpu *);
> >   /* Flag register accessors.  */
> >   extern uint32_t    aarch64_get_CPSR       (sim_cpu *);
> >   extern void        aarch64_set_CPSR       (sim_cpu *, uint32_t);
> > -extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, uint32_t);
> > +extern uint32_t    aarch64_get_CPSR_bits  (sim_cpu *, FlagMask);
> >   extern void        aarch64_set_CPSR_bits  (sim_cpu *, uint32_t, uint32_t);
> >   extern uint32_t    aarch64_test_CPSR_bit  (sim_cpu *, FlagMask);
> >   extern void        aarch64_set_CPSR_bit   (sim_cpu *, FlagMask);
> > 
> > 
> > OK to install?
> > 
> > Thanks,
> >    Jan-Benedict
> > 
> 
> LGTM. I think Andrew might be able to OK this.

Thanks for this fix.  Please go ahead and apply it.

Thanks,
Andrew


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-25 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25 12:14 [PATCH] sim/aarch64: Fix type error in declaration Jan-Benedict Glaw
2022-08-25 12:21 ` Luis Machado via Gdb-patches
2022-08-25 12:55   ` Andrew Burgess via Gdb-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox