Message ID | 95f51965-abd5-20f7-f118-981f7f834f49@acm.org |
---|---|
State | New |
Headers | show |
Series | libcody: fix --enable-checking=... [PR 98311] | expand |
On Wed, Dec 16, 2020 at 09:22:49AM -0500, Nathan Sidwell wrote: > Thanks Jakub for pointing at libcpp. > > The -enable-checking configure code in libcody didn't play well with > us. This just uses libcpp's configurey for that piece. > > libcody/ > * configure.ac: Use libcpp's enable-checking code. > * configure: Rebuilt. > > pushing to trunk This doesn't set is_release anywhere, which means when --enable-checking* or --disable-checking isn't specified, it always treats it as --enable-checking=yes, while the normal gcc behavior is treat only trunk as --enable-checking=yes and treat release branches as --enable-checking=release by default. On the other side, nothing uses those ac_assert_checking and ac_valgrind_checking variables, so it is a waste to compute those. Is this ok if it passes testing? 2020-12-16 Jakub Jelinek <jakub@redhat.com> * configure.ac: Compute is_release. (NMS_ENABLE_CHECKING): Simplify but not computing ac_assert_checking and ac_valgrind_checking the code doesn't use. * configure: Regenerated. --- libcody/configure.ac.jj 2020-12-16 16:14:49.468351790 +0100 +++ libcody/configure.ac 2020-12-16 16:23:57.630214135 +0100 @@ -23,6 +23,14 @@ NMS_TOOL_DIRS NMS_LINK_OPT([-Wl,--no-undefined]) NMS_CONFIG_FILES([gdbinit dox.cfg]) +# Enable expensive internal checks +is_release= +if test -d $srcdir/../gcc \ + && test -f $srcdir/../gcc/DEV-PHASE \ + && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then + is_release=yes +fi + NMS_BUGURL dnl NMS_ENABLE_CHECKING dnl cloned from ../libcpp/configure.ac @@ -44,13 +52,8 @@ for check in release $ac_checking_flags do case $check in # these set all the flags to specific states - yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; - no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; - release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; - # these enable particular checks - assert) ac_assert_checking=1 ;; - misc) ac_checking=1 ;; - valgrind) ac_valgrind_checking=1 ;; + yes|all|misc) ac_checking=1 ;; + no|none|release) ac_checking= ;; # accept *) ;; esac --- libcody/configure.jj 2020-12-16 16:14:49.459351891 +0100 +++ libcody/configure 2020-12-16 16:29:28.204514512 +0100 @@ -2686,6 +2686,14 @@ configure_args=$ac_configure_args +# Enable expensive internal checks +is_release= +if test -d $srcdir/../gcc \ + && test -f $srcdir/../gcc/DEV-PHASE \ + && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then + is_release=yes +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking bugurl" >&5 $as_echo_n "checking bugurl... " >&6; } @@ -2728,13 +2736,8 @@ for check in release $ac_checking_flags do case $check in # these set all the flags to specific states - yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; - no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; - release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; - # these enable particular checks - assert) ac_assert_checking=1 ;; - misc) ac_checking=1 ;; - valgrind) ac_valgrind_checking=1 ;; + yes|all|misc) ac_checking=1 ;; + no|none|release) ac_checking= ;; # accept *) ;; esac Jakub
On 12/16/20 10:40 AM, Jakub Jelinek wrote: > On Wed, Dec 16, 2020 at 09:22:49AM -0500, Nathan Sidwell wrote: >> Thanks Jakub for pointing at libcpp. >> >> The -enable-checking configure code in libcody didn't play well with >> us. This just uses libcpp's configurey for that piece. >> >> libcody/ >> * configure.ac: Use libcpp's enable-checking code. >> * configure: Rebuilt. >> >> pushing to trunk > > This doesn't set is_release anywhere, which means when --enable-checking* > or --disable-checking isn't specified, it always treats it as > --enable-checking=yes, while the normal gcc behavior is treat only trunk > as --enable-checking=yes and treat release branches as > --enable-checking=release by default. > > On the other side, nothing uses those ac_assert_checking and > ac_valgrind_checking variables, so it is a waste to compute those. > > Is this ok if it passes testing? yes. hehe, I checked that -enable-checking=set,of,options worked :) > 2020-12-16 Jakub Jelinek <jakub@redhat.com> > > * configure.ac: Compute is_release. > (NMS_ENABLE_CHECKING): Simplify but not computing ac_assert_checking > and ac_valgrind_checking the code doesn't use. > * configure: Regenerated. > > --- libcody/configure.ac.jj 2020-12-16 16:14:49.468351790 +0100 > +++ libcody/configure.ac 2020-12-16 16:23:57.630214135 +0100 > @@ -23,6 +23,14 @@ NMS_TOOL_DIRS > NMS_LINK_OPT([-Wl,--no-undefined]) > NMS_CONFIG_FILES([gdbinit dox.cfg]) > > +# Enable expensive internal checks > +is_release= > +if test -d $srcdir/../gcc \ > + && test -f $srcdir/../gcc/DEV-PHASE \ > + && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then > + is_release=yes > +fi > + > NMS_BUGURL > dnl NMS_ENABLE_CHECKING > dnl cloned from ../libcpp/configure.ac > @@ -44,13 +52,8 @@ for check in release $ac_checking_flags > do > case $check in > # these set all the flags to specific states > - yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; > - no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; > - release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; > - # these enable particular checks > - assert) ac_assert_checking=1 ;; > - misc) ac_checking=1 ;; > - valgrind) ac_valgrind_checking=1 ;; > + yes|all|misc) ac_checking=1 ;; > + no|none|release) ac_checking= ;; > # accept > *) ;; > esac > --- libcody/configure.jj 2020-12-16 16:14:49.459351891 +0100 > +++ libcody/configure 2020-12-16 16:29:28.204514512 +0100 > @@ -2686,6 +2686,14 @@ configure_args=$ac_configure_args > > > > +# Enable expensive internal checks > +is_release= > +if test -d $srcdir/../gcc \ > + && test -f $srcdir/../gcc/DEV-PHASE \ > + && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then > + is_release=yes > +fi > + > { $as_echo "$as_me:${as_lineno-$LINENO}: checking bugurl" >&5 > $as_echo_n "checking bugurl... " >&6; } > > @@ -2728,13 +2736,8 @@ for check in release $ac_checking_flags > do > case $check in > # these set all the flags to specific states > - yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; > - no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; > - release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; > - # these enable particular checks > - assert) ac_assert_checking=1 ;; > - misc) ac_checking=1 ;; > - valgrind) ac_valgrind_checking=1 ;; > + yes|all|misc) ac_checking=1 ;; > + no|none|release) ac_checking= ;; > # accept > *) ;; > esac > > > Jakub >
diff --git i/libcody/configure w/libcody/configure index 4cc03dcaa3a..76ff932d61b 100755 --- i/libcody/configure +++ w/libcody/configure @@ -1285,7 +1285,11 @@ Optional Features: --enable-maintainer-mode enable maintainer mode. Add rules to rebuild configurey bits - --enable-checking enable run-time checking + --enable-checking[=LIST] + enable expensive run-time checks. With LIST, enable + only specific categories of checks. Categories are: + yes,no,all,none,release. Flags are: misc,valgrind or + other strings --enable-exceptions enable exceptions & rtti Optional Packages: @@ -2708,30 +2712,45 @@ _ACEOF # Check whether --enable-checking was given. if test "${enable_checking+set}" = set; then : - enableval=$enable_checking; + enableval=$enable_checking; ac_checking_flags="${enableval}" else - enable_checking="yes" + +# Determine the default checks. +if test x$is_release = x ; then + ac_checking_flags=yes +else + ac_checking_flags=release +fi fi -case $enable_checking in #( - yes|all|yes,*) : - nms_checking=yes ;; #( - no|none|release) : - nms_checking= ;; #( - *) : - as_fn_error $? "unknown check \"$enable_checking\"" "$LINENO" 5 ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking checking" >&5 -$as_echo_n "checking checking... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nms_checking:-no}" >&5 -$as_echo "${nms_checking:-no}" >&6; } -if test "$nms_checking" = yes ; then +IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," +for check in release $ac_checking_flags +do + case $check in + # these set all the flags to specific states + yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; + no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; + release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; + # these enable particular checks + assert) ac_assert_checking=1 ;; + misc) ac_checking=1 ;; + valgrind) ac_valgrind_checking=1 ;; + # accept + *) ;; + esac +done +IFS="$ac_save_IFS" -cat >>confdefs.h <<_ACEOF -#define NMS_CHECKING 0${nms_checking:+1} -_ACEOF +if test x$ac_checking != x ; then + +$as_echo "#define NMS_CHECKING 1" >>confdefs.h + +else + $as_echo "#define NMS_CHECKING 0" >>confdefs.h fi + + # Check whether --enable-exceptions was given. if test "${enable_exceptions+set}" = set; then : enableval=$enable_exceptions; diff --git i/libcody/configure.ac w/libcody/configure.ac index 31f041e6679..c3db5534f1f 100644 --- i/libcody/configure.ac +++ w/libcody/configure.ac @@ -24,7 +24,47 @@ NMS_LINK_OPT([-Wl,--no-undefined]) NMS_CONFIG_FILES([gdbinit dox.cfg]) NMS_BUGURL -NMS_ENABLE_CHECKING +dnl NMS_ENABLE_CHECKING +dnl cloned from ../libcpp/configure.ac +AC_ARG_ENABLE(checking, +[AS_HELP_STRING([[--enable-checking[=LIST]]], + [enable expensive run-time checks. With LIST, + enable only specific categories of checks. + Categories are: yes,no,all,none,release. + Flags are: misc,valgrind or other strings])], +[ac_checking_flags="${enableval}"],[ +# Determine the default checks. +if test x$is_release = x ; then + ac_checking_flags=yes +else + ac_checking_flags=release +fi]) +IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," +for check in release $ac_checking_flags +do + case $check in + # these set all the flags to specific states + yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; + no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; + release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; + # these enable particular checks + assert) ac_assert_checking=1 ;; + misc) ac_checking=1 ;; + valgrind) ac_valgrind_checking=1 ;; + # accept + *) ;; + esac +done +IFS="$ac_save_IFS" + +if test x$ac_checking != x ; then + AC_DEFINE(NMS_CHECKING, 1, +[Define to 1 if you want more run-time sanity checks.]) +else + AC_DEFINE(NMS_CHECKING, 0) +fi + + NMS_ENABLE_EXCEPTIONS AC_CONFIG_HEADERS([config.h])