public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim: create a makefile fragment to pass common settings
@ 2021-06-18  5:21 Mike Frysinger
  2021-06-18  5:21 ` [PATCH 2/2] sim: unify werror build settings Mike Frysinger
  2021-06-18  6:25 ` [PATCH 1.5/2] sim: move -Werror disabling to Makefile Mike Frysinger
  0 siblings, 2 replies; 6+ messages in thread
From: Mike Frysinger @ 2021-06-18  5:21 UTC (permalink / raw)
  To: gdb-patches

As we merge settings from subdirs into the common configure, we
sometimes need to keep the settings working in both dirs.  Create
a makefile fragment to pass them down so we don't have to run the
checks twice.  For now, the file is empty, but we'll start moving
logic in shortly.
---
 sim/Makefile.in           |  4 +++-
 sim/arch-subdir.mk.in     | 18 ++++++++++++++++++
 sim/common/Make-common.in |  3 +++
 sim/configure             |  3 ++-
 sim/configure.ac          |  2 +-
 sim/ppc/Makefile.in       |  3 +++
 6 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 sim/arch-subdir.mk.in

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
new file mode 100644
index 000000000000..9eae1f3e4998
--- /dev/null
+++ b/sim/arch-subdir.mk.in
@@ -0,0 +1,18 @@
+## Fragment to pass common settings into arch subdir builds.
+## NB: This should eventually be merged into sim/Makefile.am once there are no
+## subdir configure scripts.
+#
+#   Copyright (C) 1993-2021 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 7a6a2030a47b..b82e76c91f6f 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -46,6 +46,9 @@ include $(srcroot)/gdb/silent-rules.mk
 GNULIB_PARENT_DIR = ../..
 include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
 
+# Settings from top-level configure.
+include ../arch-subdir.mk
+
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
diff --git a/sim/configure.ac b/sim/configure.ac
index 4ba2921ebaf3..91af0bba5860 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -118,5 +118,5 @@ SIM_AC_OPTION_PROFILE
 SIM_AC_OPTION_STDIO
 SIM_AC_OPTION_TRACE
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([arch-subdir.mk Makefile])
 AC_OUTPUT
-- 
2.31.1


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

* [PATCH 2/2] sim: unify werror build settings
  2021-06-18  5:21 [PATCH 1/2] sim: create a makefile fragment to pass common settings Mike Frysinger
@ 2021-06-18  5:21 ` Mike Frysinger
  2021-06-19 14:39   ` Simon Marchi
  2021-06-18  6:25 ` [PATCH 1.5/2] sim: move -Werror disabling to Makefile Mike Frysinger
  1 sibling, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-06-18  5:21 UTC (permalink / raw)
  To: gdb-patches

Move these options up to the common dir so we only test & export
them once across all ports.  It also enables -Werror usage on the
common files we've been pulling out of arch subdirs.
---
 sim/Makefile.am                |   1 +
 sim/Makefile.in                |   4 ++
 sim/aarch64/aclocal.m4         |   1 -
 sim/aarch64/configure          | 114 +--------------------------------
 sim/aclocal.m4                 |   1 +
 sim/arch-subdir.mk.in          |   3 +
 sim/arm/aclocal.m4             |   1 -
 sim/arm/configure              | 114 +--------------------------------
 sim/avr/aclocal.m4             |   1 -
 sim/avr/configure              | 114 +--------------------------------
 sim/bfin/aclocal.m4            |   1 -
 sim/bfin/configure             | 114 +--------------------------------
 sim/common/Make-common.in      |   2 -
 sim/configure                  | 112 +++++++++++++++++++++++++++++++-
 sim/configure.ac               |   1 +
 sim/cr16/aclocal.m4            |   1 -
 sim/cr16/configure             | 114 +--------------------------------
 sim/d10v/aclocal.m4            |   1 -
 sim/d10v/configure             | 114 +--------------------------------
 sim/example-synacor/aclocal.m4 |   1 -
 sim/example-synacor/configure  | 114 +--------------------------------
 sim/ft32/aclocal.m4            |   1 -
 sim/ft32/configure             | 114 +--------------------------------
 sim/h8300/aclocal.m4           |   1 -
 sim/h8300/configure            | 114 +--------------------------------
 sim/m32c/aclocal.m4            |   1 -
 sim/m32c/configure             | 114 +--------------------------------
 sim/m4/sim_ac_output.m4        |   1 -
 sim/m68hc11/aclocal.m4         |   1 -
 sim/m68hc11/configure          | 114 +--------------------------------
 sim/mcore/aclocal.m4           |   1 -
 sim/mcore/configure            | 114 +--------------------------------
 sim/microblaze/aclocal.m4      |   1 -
 sim/microblaze/configure       | 114 +--------------------------------
 sim/mn10300/aclocal.m4         |   1 -
 sim/mn10300/configure          | 114 +--------------------------------
 sim/moxie/aclocal.m4           |   1 -
 sim/moxie/configure            | 114 +--------------------------------
 sim/msp430/aclocal.m4          |   1 -
 sim/msp430/configure           | 114 +--------------------------------
 sim/pru/aclocal.m4             |   1 -
 sim/pru/configure              | 114 +--------------------------------
 sim/riscv/aclocal.m4           |   1 -
 sim/riscv/configure            | 114 +--------------------------------
 sim/rl78/aclocal.m4            |   1 -
 sim/rl78/configure             | 114 +--------------------------------
 sim/rx/aclocal.m4              |   1 -
 sim/rx/configure               | 114 +--------------------------------
 sim/v850/aclocal.m4            |   1 -
 sim/v850/configure             | 114 +--------------------------------
 50 files changed, 163 insertions(+), 2377 deletions(-)

diff --git a/sim/Makefile.am b/sim/Makefile.am
index 79274beabd8d..8d5311456860 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -35,6 +35,7 @@ CLEANFILES =
 DISTCLEANFILES =
 MOSTLYCLEANFILES = core
 
+AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
 AM_CPPFLAGS = -I$(srcroot)/include
 
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS) $(CFLAGS_FOR_BUILD)
diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index 9eae1f3e4998..6f9d4ad3c370 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -16,3 +16,6 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index b82e76c91f6f..51e4ca7b5ac7 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -96,8 +96,6 @@ SIM_HW = @sim_hw@
 SIM_INLINE = @sim_inline@
 SIM_RESERVED_BITS = @sim_reserved_bits@
 SIM_SCACHE = @sim_scache@
-WARN_CFLAGS = @WARN_CFLAGS@
-WERROR_CFLAGS = @WERROR_CFLAGS@
 SIM_WARN_CFLAGS = $(WARN_CFLAGS)
 SIM_WERROR_CFLAGS = $(WERROR_CFLAGS)
 
diff --git a/sim/configure.ac b/sim/configure.ac
index 91af0bba5860..8e9190040d4c 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -117,6 +117,7 @@ SIM_AC_OPTION_ENVIRONMENT
 SIM_AC_OPTION_PROFILE
 SIM_AC_OPTION_STDIO
 SIM_AC_OPTION_TRACE
+SIM_AC_OPTION_WARNINGS
 
 AC_CONFIG_FILES([arch-subdir.mk Makefile])
 AC_OUTPUT
diff --git a/sim/m4/sim_ac_output.m4 b/sim/m4/sim_ac_output.m4
index db6c3ffbbfe9..98385b99f76d 100644
--- a/sim/m4/sim_ac_output.m4
+++ b/sim/m4/sim_ac_output.m4
@@ -21,7 +21,6 @@ dnl one afterwards.  The two pieces of the common fragment are inserted into
 dnl the target's fragment at the appropriate points.
 AC_DEFUN([SIM_AC_OUTPUT],
 [dnl
-AC_REQUIRE([SIM_AC_OPTION_WARNINGS])dnl
 AC_REQUIRE([SIM_AC_OPTION_HARDWARE])dnl
 
 dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
-- 
2.31.1


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

* [PATCH 1.5/2] sim: move -Werror disabling to Makefile
  2021-06-18  5:21 [PATCH 1/2] sim: create a makefile fragment to pass common settings Mike Frysinger
  2021-06-18  5:21 ` [PATCH 2/2] sim: unify werror build settings Mike Frysinger
@ 2021-06-18  6:25 ` Mike Frysinger
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2021-06-18  6:25 UTC (permalink / raw)
  To: gdb-patches

For the ports that still don't build with -Werror, rather than disable
the flag at configure time, do it at make time.  This will allow us to
unify these tests in the common sim configure script.
---
 sim/aarch64/configure            |   9 +-
 sim/arm/configure                |   9 +-
 sim/avr/configure                |   9 +-
 sim/bfin/configure               |   9 +-
 sim/bpf/Makefile.in              |   3 +
 sim/bpf/configure                |  78 ++++++------
 sim/bpf/configure.ac             |   1 -
 sim/cr16/configure               |   9 +-
 sim/cris/Makefile.in             |   3 +
 sim/cris/configure               | 212 ++++++++++++++++---------------
 sim/cris/configure.ac            |   1 -
 sim/d10v/configure               |   9 +-
 sim/erc32/Makefile.in            |   3 +
 sim/erc32/configure              | 196 ++++++++++++++--------------
 sim/erc32/configure.ac           |   1 -
 sim/example-synacor/configure    |   9 +-
 sim/frv/Makefile.in              |   3 +
 sim/frv/configure                | 118 ++++++++---------
 sim/frv/configure.ac             |   1 -
 sim/ft32/configure               |   9 +-
 sim/h8300/configure              |   9 +-
 sim/iq2000/Makefile.in           |   3 +
 sim/iq2000/configure             |  78 ++++++------
 sim/iq2000/configure.ac          |   1 -
 sim/lm32/Makefile.in             |   3 +
 sim/lm32/configure               | 206 +++++++++++++++---------------
 sim/lm32/configure.ac            |   1 -
 sim/m32c/configure               |   9 +-
 sim/m32r/Makefile.in             |   3 +
 sim/m32r/configure               | 206 +++++++++++++++---------------
 sim/m32r/configure.ac            |   1 -
 sim/m4/sim_ac_option_warnings.m4 |  13 +-
 sim/m68hc11/configure            |   9 +-
 sim/mcore/configure              |   9 +-
 sim/microblaze/configure         |   9 +-
 sim/mips/Makefile.in             |   2 +
 sim/mips/configure               | 212 ++++++++++++++++---------------
 sim/mips/configure.ac            |   1 -
 sim/mn10300/configure            |   9 +-
 sim/moxie/configure              |   9 +-
 sim/msp430/configure             |   9 +-
 sim/or1k/Makefile.in             |   3 +
 sim/or1k/configure               |  78 ++++++------
 sim/or1k/configure.ac            |   1 -
 sim/pru/configure                |   9 +-
 sim/riscv/configure              |   9 +-
 sim/rl78/configure               |   9 +-
 sim/rx/configure                 |   9 +-
 sim/sh/Makefile.in               |   3 +
 sim/sh/configure                 |   7 +-
 sim/sh/configure.ac              |   2 -
 sim/v850/configure               |   9 +-
 52 files changed, 823 insertions(+), 810 deletions(-)

diff --git a/sim/bpf/configure.ac b/sim/bpf/configure.ac
index d2ec00c5a34c..a4138c097a89 100644
--- a/sim/bpf/configure.ac
+++ b/sim/bpf/configure.ac
@@ -7,7 +7,6 @@ SIM_AC_COMMON
 SIM_AC_OPTION_BITSIZE([64])
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([bpf-def])
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
 SIM_AC_OUTPUT
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index 48c4bbeabac2..d94eabb683a9 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_SCACHE(16384)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_HARDWARE(rv cris cris_900000xx)
 
 # The default model shouldn't matter as long as there's a BFD.
diff --git a/sim/erc32/configure.ac b/sim/erc32/configure.ac
index cf7ec5fdb803..3cb35d80f576 100644
--- a/sim/erc32/configure.ac
+++ b/sim/erc32/configure.ac
@@ -18,7 +18,6 @@ AC_INIT(Makefile.in)
 AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
 SIM_AC_COMMON
-SIM_AC_OPTION_WARNINGS(no)
 
 # In the Cygwin environment, we need some additional flags.
 AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin,
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index 39d8de4a5b8e..f652e269a3b8 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(fr500)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
 #
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index 4afa1b3501d8..92c10d2eb183 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
 SIM_AC_OUTPUT
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index 06c655696420..32bbd1b4ac1c 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(lm32)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 SIM_AC_OPTION_HARDWARE(lm32cpu lm32timer lm32uart)
 
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index 9377081e938a..3146feee6408 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(m32r/d)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
   case "${target_alias}" in
diff --git a/sim/m4/sim_ac_option_warnings.m4 b/sim/m4/sim_ac_option_warnings.m4
index c831fa82596d..5a0fe304e9ce 100644
--- a/sim/m4/sim_ac_option_warnings.m4
+++ b/sim/m4/sim_ac_option_warnings.m4
@@ -15,7 +15,6 @@ dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
 dnl --enable-build-warnings is for developers of the simulator.
 dnl it enables extra GCC specific warnings.
-dnl arg[1] Enable -Werror by default? ("yes" or "no")
 AC_DEFUN([SIM_AC_OPTION_WARNINGS],
 [
 AC_ARG_ENABLE(werror,
@@ -26,17 +25,15 @@ AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-# Enable -Werror by default when using gcc
+dnl Enable -Werror by default when using gcc
 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
-    ERROR_ON_WARNING=yes
+  ERROR_ON_WARNING=yes
 fi
 
 WERROR_CFLAGS=""
-m4_if(m4_default([$1], [yes]), [yes], [dnl
-  if test "${ERROR_ON_WARNING}" = yes ; then
-    WERROR_CFLAGS="-Werror"
-  fi
-])dnl
+if test "${ERROR_ON_WARNING}" = yes ; then
+  WERROR_CFLAGS="-Werror"
+fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wpointer-sign \
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index 03d8f5169e76..88f06ee13c91 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 dnl Options available in this module
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS(1)
 
 # DEPRECATED
diff --git a/sim/or1k/configure.ac b/sim/or1k/configure.ac
index ed8538eb1089..576574c2ded2 100644
--- a/sim/or1k/configure.ac
+++ b/sim/or1k/configure.ac
@@ -7,7 +7,6 @@ SIM_AC_COMMON
 SIM_AC_OPTION_BITSIZE([32], [31], [32])
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([or1200])
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_CGEN_MAINT
 
 SIM_AC_OUTPUT
diff --git a/sim/sh/configure.ac b/sim/sh/configure.ac
index 9bf4a4099ee5..08bf6ff8acbc 100644
--- a/sim/sh/configure.ac
+++ b/sim/sh/configure.ac
@@ -4,6 +4,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
 SIM_AC_COMMON
 
-SIM_AC_OPTION_WARNINGS(no)
-
 SIM_AC_OUTPUT
-- 
2.31.1


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

* Re: [PATCH 2/2] sim: unify werror build settings
  2021-06-18  5:21 ` [PATCH 2/2] sim: unify werror build settings Mike Frysinger
@ 2021-06-19 14:39   ` Simon Marchi
  2021-06-19 19:57     ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Marchi @ 2021-06-19 14:39 UTC (permalink / raw)
  To: Mike Frysinger, gdb-patches

On 2021-06-18 1:21 a.m., Mike Frysinger via Gdb-patches wrote:
> Move these options up to the common dir so we only test & export
> them once across all ports.  It also enables -Werror usage on the
> common files we've been pulling out of arch subdirs.

I get:


  CC       common/common_libcommon_a-sim-load.o
In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27,
                 from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259,
                 from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599,
                 from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122,
                 from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30:
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: ‘offset_16’ defined but not used [-Werror=unused-function]
   39 | #define offset_N XCONCAT2(offset_,N)
      |                           ^~~~~~~
/home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro ‘CONCAT2’
   23 | #define CONCAT2(a,b)     a##b
      |                          ^
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro ‘XCONCAT2’
   39 | #define offset_N XCONCAT2(offset_,N)
      |                  ^~~~~~~~
/home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro ‘offset_N’
  138 | offset_N (unsigned_N *x,
      | ^~~~~~~~

This works:


diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
index 2750fa93cbc7..cad36e796cbc 100644
--- a/sim/common/sim-inline.h
+++ b/sim/common/sim-inline.h
@@ -445,7 +445,7 @@
      && !defined (SIM_ENDIAN_C) \
      && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE)))
 # if (SIM_ENDIAN_INLINE & INLINE_GLOBALS)
-#  define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
+#  define INLINE_SIM_ENDIAN(TYPE) static INLINE2 TYPE UNUSED
 #  define EXTERN_SIM_ENDIAN_P 0
 # else
 #  define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED

Simon

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

* Re: [PATCH 2/2] sim: unify werror build settings
  2021-06-19 14:39   ` Simon Marchi
@ 2021-06-19 19:57     ` Mike Frysinger
  2021-06-20  1:33       ` Simon Marchi
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2021-06-19 19:57 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

On 19 Jun 2021 10:39, Simon Marchi wrote:
> On 2021-06-18 1:21 a.m., Mike Frysinger via Gdb-patches wrote:
> > Move these options up to the common dir so we only test & export
> > them once across all ports.  It also enables -Werror usage on the
> > common files we've been pulling out of arch subdirs.
> 
> I get:
> 
> 
>   CC       common/common_libcommon_a-sim-load.o
> In file included from /home/simark/src/binutils-gdb/sim/common/sim-n-bits.h:27,
>                  from /home/simark/src/binutils-gdb/sim/common/sim-bits.c:259,
>                  from /home/simark/src/binutils-gdb/sim/common/sim-bits.h:599,
>                  from /home/simark/src/binutils-gdb/sim/common/sim-basics.h:122,
>                  from /home/simark/src/binutils-gdb/sim/common/sim-load.c:30:
> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:27: error: ‘offset_16’ defined but not used [-Werror=unused-function]
>    39 | #define offset_N XCONCAT2(offset_,N)
>       |                           ^~~~~~~
> /home/simark/src/binutils-gdb/sim/../include/symcat.h:23:26: note: in definition of macro ‘CONCAT2’
>    23 | #define CONCAT2(a,b)     a##b
>       |                          ^
> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:39:18: note: in expansion of macro ‘XCONCAT2’
>    39 | #define offset_N XCONCAT2(offset_,N)
>       |                  ^~~~~~~~
> /home/simark/src/binutils-gdb/sim/common/sim-n-endian.h:138:1: note: in expansion of macro ‘offset_N’
>   138 | offset_N (unsigned_N *x,
>       | ^~~~~~~~
> 
> This works:
> 
> 
> diff --git a/sim/common/sim-inline.h b/sim/common/sim-inline.h
> index 2750fa93cbc7..cad36e796cbc 100644
> --- a/sim/common/sim-inline.h
> +++ b/sim/common/sim-inline.h
> @@ -445,7 +445,7 @@
>       && !defined (SIM_ENDIAN_C) \
>       && (REVEAL_MODULE_P (SIM_ENDIAN_INLINE)))
>  # if (SIM_ENDIAN_INLINE & INLINE_GLOBALS)
> -#  define INLINE_SIM_ENDIAN(TYPE) static INLINE TYPE UNUSED
> +#  define INLINE_SIM_ENDIAN(TYPE) static INLINE2 TYPE UNUSED
>  #  define EXTERN_SIM_ENDIAN_P 0
>  # else
>  #  define INLINE_SIM_ENDIAN(TYPE) static TYPE UNUSED

the type is already marked UNUSED.  why isn't that working here ?

i tried to reproduce with -O0 but it's passing for me.
-mike

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

* Re: [PATCH 2/2] sim: unify werror build settings
  2021-06-19 19:57     ` Mike Frysinger
@ 2021-06-20  1:33       ` Simon Marchi
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2021-06-20  1:33 UTC (permalink / raw)
  To: gdb-patches

> the type is already marked UNUSED.  why isn't that working here ?

Maybe because the UNUSED is after the TYPE, so it applies to the return
type, instead of to the function?  If I move UNUSED before TYPE, it
works.  I'll send a patch for that.

> i tried to reproduce with -O0 but it's passing for me.

It's gcc 11.1.0, if that matters.

Simon

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

end of thread, other threads:[~2021-06-20  1:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  5:21 [PATCH 1/2] sim: create a makefile fragment to pass common settings Mike Frysinger
2021-06-18  5:21 ` [PATCH 2/2] sim: unify werror build settings Mike Frysinger
2021-06-19 14:39   ` Simon Marchi
2021-06-19 19:57     ` Mike Frysinger
2021-06-20  1:33       ` Simon Marchi
2021-06-18  6:25 ` [PATCH 1.5/2] sim: move -Werror disabling to Makefile 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).