* [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