diff mbox

Make CHECKING_P a boolean flag again

Message ID AM4PR0701MB2162A07026F686DBECFD7BE6E4CA0@AM4PR0701MB2162.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger Sept. 25, 2016, 9:13 a.m. UTC
Hi!


Currently CHECKING_P is not a boolean flag but a ternary option.
However the _P in the name implies it is a boolean.

That should be cleaned up again IMHO.


So this patch splits CHECKING_P into CHECKING_P and a new flag
ENABLE_EXTRA_CHECKING.  All uses of CHECKING_P are actually of
the form "if (CHECKING_P)" so there is no problem there, only the
flag_checking is tested at one place for > 1,  thus we have to
make sure that the default initial value of flag_checking is
0, 1 or 2, dependent on CHECKING_P and ENABLE_EXTRA_CHECKING.


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.
2016-09-25  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* configure.ac: Split CHECKING_P into CHECKING_P and
	ENABLE_EXTRA_CHECKING.
	* configure: Regenerated.
	* config.in: Adjust commment of CHECKING_P.  Add ENABLE_EXTRA_CHECKING.
	* common.opt (flag_checking): Use CHECKING_P and ENABLE_EXTRA_CHECKING.

Comments

Jeff Law Sept. 30, 2016, 5:14 p.m. UTC | #1
On 09/25/2016 03:13 AM, Bernd Edlinger wrote:
> Hi!
>
>
> Currently CHECKING_P is not a boolean flag but a ternary option.
> However the _P in the name implies it is a boolean.
>
> That should be cleaned up again IMHO.
>
>
> So this patch splits CHECKING_P into CHECKING_P and a new flag
> ENABLE_EXTRA_CHECKING.  All uses of CHECKING_P are actually of
> the form "if (CHECKING_P)" so there is no problem there, only the
> flag_checking is tested at one place for > 1,  thus we have to
> make sure that the default initial value of flag_checking is
> 0, 1 or 2, dependent on CHECKING_P and ENABLE_EXTRA_CHECKING.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>
>
> Thanks
> Bernd.
>
>
> changelog-checking-p.txt
>
>
> 2016-09-25  Bernd Edlinger  <bernd.edlinger@hotmail.de>
>
> 	* configure.ac: Split CHECKING_P into CHECKING_P and
> 	ENABLE_EXTRA_CHECKING.
> 	* configure: Regenerated.
> 	* config.in: Adjust commment of CHECKING_P.  Add ENABLE_EXTRA_CHECKING.
> 	* common.opt (flag_checking): Use CHECKING_P and ENABLE_EXTRA_CHECKING.
OK.

jeff
diff mbox

Patch

Index: gcc/common.opt
===================================================================
--- gcc/common.opt	(revision 240437)
+++ gcc/common.opt	(working copy)
@@ -1034,7 +1034,7 @@  Common Var(flag_check_new)
 Check the return value of new in C++.
 
 fchecking
-Common Var(flag_checking) Init(CHECKING_P)
+Common Var(flag_checking) Init(CHECKING_P ? ENABLE_EXTRA_CHECKING ? 2 : 1 : 0)
 Perform internal consistency checkings.
 
 fchecking=
Index: gcc/config.in
===================================================================
--- gcc/config.in	(revision 240437)
+++ gcc/config.in	(working copy)
@@ -30,14 +30,20 @@ 
 #endif
 
 
-/* Define to 1 if you want more run-time sanity checks. This one gets a grab
-   bag of miscellaneous but relatively cheap checks. Define to 2 if you want
-   also extra run-time checking that might affect code generation. */
+/* Define to 0/1 if you want more run-time sanity checks. This one gets a grab
+   bag of miscellaneous but relatively cheap checks. */
 #ifndef USED_FOR_TARGET
 #undef CHECKING_P
 #endif
 
 
+/* Define to 0/1 if you want also extra run-time checking that might affect
+   code generation. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_EXTRA_CHECKING
+#endif
+
+
 /* Define 0/1 to force the choice for exception handling model. */
 #ifndef USED_FOR_TARGET
 #undef CONFIG_SJLJ_EXCEPTIONS
Index: gcc/configure
===================================================================
--- gcc/configure	(revision 240437)
+++ gcc/configure	(working copy)
@@ -7135,13 +7135,8 @@  IFS="$ac_save_IFS"
 
 nocommon_flag=""
 if test x$ac_checking != x ; then
-  if test x$ac_extra_checking != x ; then
-    ac_checking=2
-  fi
 
-cat >>confdefs.h <<_ACEOF
-#define CHECKING_P $ac_checking
-_ACEOF
+$as_echo "#define CHECKING_P 1" >>confdefs.h
 
   nocommon_flag=-fno-common
 else
@@ -7149,6 +7144,14 @@  else
 
 fi
 
+if test x$ac_extra_checking != x ; then
+
+$as_echo "#define ENABLE_EXTRA_CHECKING 1" >>confdefs.h
+
+else
+  $as_echo "#define ENABLE_EXTRA_CHECKING 0" >>confdefs.h
+
+fi
 if test x$ac_df_checking != x ; then
 
 $as_echo "#define ENABLE_DF_CHECKING 1" >>confdefs.h
@@ -18476,7 +18479,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18479 "configure"
+#line 18482 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18582,7 +18585,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18585 "configure"
+#line 18588 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 240437)
+++ gcc/configure.ac	(working copy)
@@ -579,18 +579,21 @@  IFS="$ac_save_IFS"
 
 nocommon_flag=""
 if test x$ac_checking != x ; then
-  if test x$ac_extra_checking != x ; then
-    ac_checking=2
-  fi
-  AC_DEFINE_UNQUOTED(CHECKING_P, $ac_checking,
-[Define to 1 if you want more run-time sanity checks.  This one gets a grab
-   bag of miscellaneous but relatively cheap checks.  Define to 2 if you want
-   also extra run-time checking that might affect code generation.])
+  AC_DEFINE(CHECKING_P, 1,
+[Define to 0/1 if you want more run-time sanity checks.  This one gets a grab
+bag of miscellaneous but relatively cheap checks.])
   nocommon_flag=-fno-common
 else
   AC_DEFINE(CHECKING_P, 0)
 fi
 AC_SUBST(nocommon_flag)
+if test x$ac_extra_checking != x ; then
+  AC_DEFINE(ENABLE_EXTRA_CHECKING, 1,
+[Define to 0/1 if you want extra run-time checking that might affect code
+generation.])
+else
+  AC_DEFINE(ENABLE_EXTRA_CHECKING, 0)
+fi
 if test x$ac_df_checking != x ; then
   AC_DEFINE(ENABLE_DF_CHECKING, 1,
 [Define if you want more run-time sanity checks for dataflow.])