Recently, I ran into a couple of bugs/regessions that show up
only if checking is enabled.  This led me to the observation that
it might be useful if checking can be enabled at runtime via a
gcc command line switch.  If this capability can be enabled by
default, then regression tests could depend upon the checking
capability, or users could be asked to run with full checks
enabled when reporting bugs, etc.

There will be some overhead to test for the switch, though the
code that does the checking might remain under an #ifdef as it
does now, to ensure that it absolutely isn't compiled unless the
appropriate configuration option is enabled.  That said, I would
argue that if we go to the trouble to implement the capability,
then support for checking switches should be enabled by default.
If the code is never conditionalized, then --enable-checking=xxx
might be re-defined to assert the various checking flags by default.


Here is are some quick stats on the use/frequency of
various checking options in GCC:

ENABLE_CHECKING            251
ENABLE_RTL_CHECKING         21
ENABLE_IRA_CHECKING         11
ENABLE_FOLD_CHECKING        10
ENABLE_GC_CHECKING           9
ENABLE_DF_CHECKING           7
ENABLE_MALLOC_CHECKING       7
ENABLE_TYPES_CHECKING        5
ENABLE_TREE_CHECKING         4
ENABLE_ASSERT_CHECKING       3
ENABLE_GIMPLE_CHECKING       3
ENABLE_RTL_FLAG_CHECKING     1
ENABLE_SCOPE_CHECKING        1
ENABLE_VALGRIND_CHECKING     1
                           ---
Total                      334

Certainly, plenty of them to deal with, but perhaps with a bit of
scripting the bulk of the changes can be automated.

Reply via email to