[Sending this to gcc-patches to double-check that the idea is sound
before continuing to work on this large patch. [1] ]

I want to eliminate hidden use of the preprocessor in our code, in favor
of using block caps to signal to people reading the code that macro
magic is happening.

As a specific example, consider this supposedly-simple code:

  static bool
  gate_vrp (void)
  {
    return flag_tree_vrp != 0;
  }

where "flag_tree_vrp" is actually an autogenerated macro to
"global_options.x_flag_tree_vrp"

This is deeply confusing to a newbie - and indeed still to me after two
years of working with GCC's internals, for example, when stepping
through code and trying to query values in gdb.

My idea is to introduce a GCC_OPTION macro, and replace the above with:

  static bool
  gate_vrp (void)
  {
    return GCC_OPTION (flag_tree_vrp) != 0;
  }

thus signaling to humans that macros are present.

Is such a patch likely to be accepted?   Should I try to break the
options up into logical groups e.g. with separate macros for warnings vs
optimizations, or some other scheme?

Thanks
Dave
[1] fwiw, not-yet-working version of script to create patch can be seen
at:
https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/refactor_options.py
https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/test_refactor_options.py


Reply via email to