[PATCH/committed] sim: warnings: enable only for development builds

Message ID 20231205044748.2009-1-vapier@gentoo.org
State New
Headers
Series [PATCH/committed] sim: warnings: enable only for development builds |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged

Commit Message

Mike Frysinger Dec. 5, 2023, 4:47 a.m. UTC
  Reuse the bfd/development.sh script like most other project to
determine whether the current source tree is a dev build (e.g.
git) or a release build, and disable the warnings for releases.
---
 sim/Makefile.am                  | 2 ++
 sim/Makefile.in                  | 1 +
 sim/configure                    | 8 +++++---
 sim/configure.ac                 | 3 +++
 sim/m4/sim_ac_option_warnings.m4 | 4 ++--
 5 files changed, 13 insertions(+), 5 deletions(-)
  

Patch

diff --git a/sim/Makefile.am b/sim/Makefile.am
index 3693eb18d496..b42926070dbd 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -45,6 +45,8 @@  MOSTLYCLEANFILES = core
 ## make sure all objects in subdirs get cleaned up.
 MOSTLYCLEANFILES += $(SIM_ENABLED_ARCHES:%=%/*.o)
 
+CONFIG_STATUS_DEPENDENCIES = $(srcroot)/bfd/development.sh
+
 AM_CFLAGS = \
 	$(WERROR_CFLAGS) \
 	$(WARN_CFLAGS) \
diff --git a/sim/Makefile.in b/sim/Makefile.in
index 3dd14543450e..ec24aa196acf 100644
--- a/sim/Makefile.in
+++ b/sim/Makefile.in
@@ -1798,6 +1798,7 @@  MOSTLYCLEANFILES = core $(SIM_ENABLED_ARCHES:%=%/*.o) \
 	$(am__append_57) $(am__append_61) $(am__append_75) \
 	$(am__append_80) $(am__append_88) $(am__append_103) \
 	$(am__append_107)
+CONFIG_STATUS_DEPENDENCIES = $(srcroot)/bfd/development.sh
 AM_CFLAGS = \
 	$(WERROR_CFLAGS) \
 	$(WARN_CFLAGS) \
diff --git a/sim/configure b/sim/configure
index de67d95d4abf..32cd8fb051fc 100755
--- a/sim/configure
+++ b/sim/configure
@@ -3009,6 +3009,8 @@  _ACEOF
 ac_config_headers="$ac_config_headers config.h"
 
 
+. $srcdir/../bfd/development.sh
+
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   if test -f "$ac_dir/install-sh"; then
@@ -12288,7 +12290,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12291 "configure"
+#line 12293 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12394,7 +12396,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12397 "configure"
+#line 12399 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15811,7 +15813,7 @@  if test "${enable_werror+set}" = set; then :
 fi
 
 
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
   ERROR_ON_WARNING=yes
 fi
 
diff --git a/sim/configure.ac b/sim/configure.ac
index ecda34a6b3fc..84a7e0a249e7 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -14,6 +14,9 @@  AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address
 
 AC_CONFIG_HEADERS([config.h])
 
+dnl Set the 'development' global before loading the SIM macros.
+. $srcdir/../bfd/development.sh
+
 SIM_AC_TOOLCHAIN
 SIM_AC_PLATFORM
 
diff --git a/sim/m4/sim_ac_option_warnings.m4 b/sim/m4/sim_ac_option_warnings.m4
index 8ff94df03209..16d358b0bbaa 100644
--- a/sim/m4/sim_ac_option_warnings.m4
+++ b/sim/m4/sim_ac_option_warnings.m4
@@ -25,8 +25,8 @@  AC_ARG_ENABLE(werror,
      *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
    esac])
 
-dnl Enable -Werror by default when using gcc
-if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
+dnl Enable -Werror by default when using gcc.  Turn it off for releases.
+if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" && $development; then
   ERROR_ON_WARNING=yes
 fi