public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/committed 1/2] sim: mn10300: switch abort to sim_engine_abort
@ 2021-06-15  3:47 Mike Frysinger
  2021-06-15  3:47 ` [PATCH/committed 2/2] sim: mn10300: enable -Werror Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2021-06-15  3:47 UTC (permalink / raw)
  To: gdb-patches

This allows the caller to catch engine aborts if they want, and fixes
the warning about missing stdlib.h include by not using abort().
---
 sim/mn10300/ChangeLog    | 4 ++++
 sim/mn10300/mn10300.igen | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index 9a2c1d1929ca..ff7d6c18f117 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-14  Mike Frysinger  <vapier@gentoo.org>
+
+	* mn10300.igen: Change abort to sim_engine_abort.
+
 2021-06-12  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac: Delete call to SIM_AC_OPTION_ALIGNMENT.
diff --git a/sim/mn10300/mn10300.igen b/sim/mn10300/mn10300.igen
index 80a394309c90..f67468da17eb 100644
--- a/sim/mn10300/mn10300.igen
+++ b/sim/mn10300/mn10300.igen
@@ -3624,7 +3624,7 @@
 {
   /* OP_F0FF (); */
   PC = cia;
-  abort ();
+  sim_engine_abort (SD, CPU, cia, "F0FF");
 }
 
 
-- 
2.31.1


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

* [PATCH/committed 2/2] sim: mn10300: enable -Werror
  2021-06-15  3:47 [PATCH/committed 1/2] sim: mn10300: switch abort to sim_engine_abort Mike Frysinger
@ 2021-06-15  3:47 ` Mike Frysinger
  2021-06-16 15:35   ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2021-06-15  3:47 UTC (permalink / raw)
  To: gdb-patches

Now that all warnings are fixed in this port, enable -Werror by default.
---
 sim/mn10300/ChangeLog    |   5 +
 sim/mn10300/configure    | 213 ++++++++++++++++++++-------------------
 sim/mn10300/configure.ac |   1 -
 3 files changed, 113 insertions(+), 106 deletions(-)

diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index ff7d6c18f117..0083c1a433cb 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-14  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac: Delete all to SIM_AC_OPTION_WARNINGS.
+	* configure: Regenerate.
+
 2021-06-14  Mike Frysinger  <vapier@gentoo.org>
 
 	* mn10300.igen: Change abort to sim_engine_abort.
diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac
index b09159d7d47f..6754136f6d96 100644
--- a/sim/mn10300/configure.ac
+++ b/sim/mn10300/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
 SIM_AC_OPTION_HARDWARE(mn103cpu mn103int mn103tim mn103ser mn103iop)
-- 
2.31.1


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

* Re: [PATCH/committed 2/2] sim: mn10300: enable -Werror
  2021-06-15  3:47 ` [PATCH/committed 2/2] sim: mn10300: enable -Werror Mike Frysinger
@ 2021-06-16 15:35   ` Simon Marchi
  2021-06-16 15:47     ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-06-16 15:35 UTC (permalink / raw)
  To: Mike Frysinger, gdb-patches

On 2021-06-14 11:47 p.m., Mike Frysinger via Gdb-patches wrote:
> Now that all warnings are fixed in this port, enable -Werror by default.

Hi Mike,

I get:

$ gcc --version
gcc (GCC) 11.1.0
$ ccache gcc  -DHAVE_CONFIG_H  -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -DWITH_RESERVED_BITS=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/mn10300 -I../common -I/home/simark/src/binutils-gdb/sim/mn10300/../common -I../../include -I/home/simark/src/binutils-gdb/sim/mn10300/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/mn10300/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/mn10300/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/mn10300/../../gnulib/import -I../../gnulib/import -DPOLL_QUIT_INTERVAL=0x20 -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -c -o idecode.o -MT idecode.o -MMD -MP -MF .deps/idecode.Tpo idecode.c
In file included from /home/simark/src/binutils-gdb/sim/mn10300/sim-main.h:47,
                 from /home/simark/src/binutils-gdb/sim/mn10300/../common/sim-inline.c:33,
                 from idecode.c:26:
/home/simark/src/binutils-gdb/sim/mn10300/mn10300_sim.h:189:1: error: ‘dw2u64’ defined but not used [-Werror=unused-function]
  189 | dw2u64 (dword data)
      | ^~~~~~

Simon

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

* Re: [PATCH/committed 2/2] sim: mn10300: enable -Werror
  2021-06-16 15:35   ` Simon Marchi
@ 2021-06-16 15:47     ` Simon Marchi
  2021-06-16 17:52       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-06-16 15:47 UTC (permalink / raw)
  To: Mike Frysinger, gdb-patches



On 2021-06-16 11:35 a.m., Simon Marchi via Gdb-patches wrote:
> On 2021-06-14 11:47 p.m., Mike Frysinger via Gdb-patches wrote:
>> Now that all warnings are fixed in this port, enable -Werror by default.
> 
> Hi Mike,
> 
> I get:
> 
> $ gcc --version
> gcc (GCC) 11.1.0
> $ ccache gcc  -DHAVE_CONFIG_H  -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -DWITH_RESERVED_BITS=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/mn10300 -I../common -I/home/simark/src/binutils-gdb/sim/mn10300/../common -I../../include -I/home/simark/src/binutils-gdb/sim/mn10300/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/mn10300/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/mn10300/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/mn10300/../../gnulib/import -I../../gnulib/import -DPOLL_QUIT_INTERVAL=0x20 -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -c -o idecode.o -MT idecode.o -MMD -MP -MF .deps/idecode.Tpo idecode.c
> In file included from /home/simark/src/binutils-gdb/sim/mn10300/sim-main.h:47,
>                  from /home/simark/src/binutils-gdb/sim/mn10300/../common/sim-inline.c:33,
>                  from idecode.c:26:
> /home/simark/src/binutils-gdb/sim/mn10300/mn10300_sim.h:189:1: error: ‘dw2u64’ defined but not used [-Werror=unused-function]
>   189 | dw2u64 (dword data)
>       | ^~~~~~
> 
> Simon
> 

This fixes it for me, I guess that INLINE is undefined at this point.
I don't see any reason not to use "inline".


diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h
index c63efaa6c769..b2ed70ecfe1d 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300_sim.h
@@ -158,7 +158,7 @@ sim_core_read_unaligned_4 (STATE_CPU (simulator, 0), PC, read_map, (ADDR))
 u642dw (sim_core_read_unaligned_8 (STATE_CPU (simulator, 0), \
                                   PC, read_map, (ADDR)))
 
-static INLINE dword
+static inline dword
 u642dw (unsigned64 dw)
 {
   dword r;
@@ -185,7 +185,7 @@ sim_core_write_unaligned_4 (STATE_CPU (simulator, 0), \
 sim_core_write_unaligned_8 (STATE_CPU (simulator, 0), \
                            PC, write_map, (ADDR), dw2u64 (DATA))
 
-static INLINE unsigned64
+static inline unsigned64
 dw2u64 (dword data)
 {
   return data.low | (((unsigned64)data.high) << 32);


Simon


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

* Re: [PATCH/committed 2/2] sim: mn10300: enable -Werror
  2021-06-16 15:47     ` Simon Marchi
@ 2021-06-16 17:52       ` Mike Frysinger
  2021-06-16 18:01         ` Simon Marchi
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2021-06-16 17:52 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 16 Jun 2021 11:47, Simon Marchi wrote:
> On 2021-06-16 11:35 a.m., Simon Marchi via Gdb-patches wrote:
> > On 2021-06-14 11:47 p.m., Mike Frysinger via Gdb-patches wrote:
> >> Now that all warnings are fixed in this port, enable -Werror by default.
> > 
> > I get:
> > 
> > $ gcc --version
> > gcc (GCC) 11.1.0
> > $ ccache gcc  -DHAVE_CONFIG_H  -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -DWITH_RESERVED_BITS=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/mn10300 -I../common -I/home/simark/src/binutils-gdb/sim/mn10300/../common -I../../include -I/home/simark/src/binutils-gdb/sim/mn10300/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/mn10300/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/mn10300/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/mn10300/../../gnulib/import -I../../gnulib/import -DPOLL_QUIT_INTERVAL=0x20 -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -c -o idecode.o -MT idecode.o -MMD -MP -MF .deps/idecode.Tpo idecode.c
> > In file included from /home/simark/src/binutils-gdb/sim/mn10300/sim-main.h:47,
> >                  from /home/simark/src/binutils-gdb/sim/mn10300/../common/sim-inline.c:33,
> >                  from idecode.c:26:
> > /home/simark/src/binutils-gdb/sim/mn10300/mn10300_sim.h:189:1: error: ‘dw2u64’ defined but not used [-Werror=unused-function]
> >   189 | dw2u64 (dword data)
> >       | ^~~~~~
> 
> This fixes it for me, I guess that INLINE is undefined at this point.
> I don't see any reason not to use "inline".

looks like the failure only comes up with -O0:

#if defined (__GNUC__) && defined (__OPTIMIZE__)
#define INLINE __inline__
#else           
#define INLINE /*inline*/
#endif

we could use INLINE2 here instead as it doesn't check OPTIMIZE.
-mike

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

* Re: [PATCH/committed 2/2] sim: mn10300: enable -Werror
  2021-06-16 17:52       ` Mike Frysinger
@ 2021-06-16 18:01         ` Simon Marchi
  2021-06-17  4:14           ` [PATCH/committed] sim: mn10300: tweak static inlines Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-06-16 18:01 UTC (permalink / raw)
  To: gdb-patches

On 2021-06-16 1:52 p.m., Mike Frysinger wrote:
> On 16 Jun 2021 11:47, Simon Marchi wrote:
>> On 2021-06-16 11:35 a.m., Simon Marchi via Gdb-patches wrote:
>>> On 2021-06-14 11:47 p.m., Mike Frysinger via Gdb-patches wrote:
>>>> Now that all warnings are fixed in this port, enable -Werror by default.
>>>
>>> I get:
>>>
>>> $ gcc --version
>>> gcc (GCC) 11.1.0
>>> $ ccache gcc  -DHAVE_CONFIG_H  -DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31 -DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE  -DWITH_HW=1 -DHAVE_DV_SOCKSER -DDEFAULT_INLINE=0 -DWITH_RESERVED_BITS=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wpointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wmissing-prototypes -Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type -Wold-style-declaration -Werror  -I. -I/home/simark/src/binutils-gdb/sim/mn10300 -I../common -I/home/simark/src/binutils-gdb/sim/mn10300/../common -I../../include -I/home/simark/src/binutils-gdb/sim/mn10300/../../include -I../../bfd -I/home/simark/src/binutils-gdb/sim/mn10300/../../bfd -I../../opcodes -I/home/simark/src/binutils-gdb/sim/mn10300/../../opcodes -I../..  -I/home/simark/src/binutils-gdb/sim/mn10300/../../gnulib/import -I../../gnulib/import -DPOLL_QUIT_INTERVAL=0x20 -g3 -O0 -fsanitize=address -fmax-errors=1 -fdiagnostics-color=always   -c -o idecode.o -MT idecode.o -MMD -MP -MF .deps/idecode.Tpo idecode.c
>>> In file included from /home/simark/src/binutils-gdb/sim/mn10300/sim-main.h:47,
>>>                  from /home/simark/src/binutils-gdb/sim/mn10300/../common/sim-inline.c:33,
>>>                  from idecode.c:26:
>>> /home/simark/src/binutils-gdb/sim/mn10300/mn10300_sim.h:189:1: error: ‘dw2u64’ defined but not used [-Werror=unused-function]
>>>   189 | dw2u64 (dword data)
>>>       | ^~~~~~
>>
>> This fixes it for me, I guess that INLINE is undefined at this point.
>> I don't see any reason not to use "inline".
> 
> looks like the failure only comes up with -O0:
> 
> #if defined (__GNUC__) && defined (__OPTIMIZE__)
> #define INLINE __inline__
> #else           
> #define INLINE /*inline*/
> #endif
> 
> we could use INLINE2 here instead as it doesn't check OPTIMIZE.
> -mike
> 

OK, I'll let you fix it.

Simon

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

* [PATCH/committed] sim: mn10300: tweak static inlines
  2021-06-16 18:01         ` Simon Marchi
@ 2021-06-17  4:14           ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-06-17  4:14 UTC (permalink / raw)
  To: gdb-patches

Use INLINE2 instead of INLINE to fix builds when -O0 are used -- the
latter define is omitted at -O0 levels while the former is always
set to inline.  These helper funcs are used by defines in here but
the defines aren't always called.
---
 sim/mn10300/ChangeLog     | 4 ++++
 sim/mn10300/mn10300_sim.h | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sim/mn10300/ChangeLog b/sim/mn10300/ChangeLog
index e4db482bd298..0e2c36f5672d 100644
--- a/sim/mn10300/ChangeLog
+++ b/sim/mn10300/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17  Mike Frysinger  <vapier@gentoo.org>
+
+	* mn10300_sim.h (u642dw, dw2u64): Change INLINE to INLINE2.
+
 2021-06-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure: Regenerate.
diff --git a/sim/mn10300/mn10300_sim.h b/sim/mn10300/mn10300_sim.h
index c63efaa6c769..1f696d5b7bef 100644
--- a/sim/mn10300/mn10300_sim.h
+++ b/sim/mn10300/mn10300_sim.h
@@ -158,7 +158,7 @@ sim_core_read_unaligned_4 (STATE_CPU (simulator, 0), PC, read_map, (ADDR))
 u642dw (sim_core_read_unaligned_8 (STATE_CPU (simulator, 0), \
 				   PC, read_map, (ADDR)))
 
-static INLINE dword
+static INLINE2 dword
 u642dw (unsigned64 dw)
 {
   dword r;
@@ -185,7 +185,7 @@ sim_core_write_unaligned_4 (STATE_CPU (simulator, 0), \
 sim_core_write_unaligned_8 (STATE_CPU (simulator, 0), \
 			    PC, write_map, (ADDR), dw2u64 (DATA))
 
-static INLINE unsigned64
+static INLINE2 unsigned64
 dw2u64 (dword data)
 {
   return data.low | (((unsigned64)data.high) << 32);
-- 
2.31.1


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

end of thread, other threads:[~2021-06-17  4:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15  3:47 [PATCH/committed 1/2] sim: mn10300: switch abort to sim_engine_abort Mike Frysinger
2021-06-15  3:47 ` [PATCH/committed 2/2] sim: mn10300: enable -Werror Mike Frysinger
2021-06-16 15:35   ` Simon Marchi
2021-06-16 15:47     ` Simon Marchi
2021-06-16 17:52       ` Mike Frysinger
2021-06-16 18:01         ` Simon Marchi
2021-06-17  4:14           ` [PATCH/committed] sim: mn10300: tweak static inlines Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).