This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Fix typo (and bootstrap failure) in jump.c


>>>>> "Gerald" == Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> writes:

    Gerald> I'm afraid that the following patch did not receive
    Gerald> suitable testing:

    Gerald> In my opinion, we should try to exercise #ifdef-ed code
    Gerald> before committing to avoid this kind of problem.

Note that (as mentioned before) the best way to avoid this kind of
thing is often to do:

  if (HAS_FOO) 
    ...
  else
    ...

rather than:

  #ifdef HAS_FOO
    ...
  #else 
    ...
  #endif
  
Letting the compiler do the syntax checking is no substitute for full
testing -- but it does catch these kinds of typos.

IMO, we should always endeavor to use the former style, unless it
really doesn't work for one reason or another, or unless it entails
including large amounts of code that will never be executed, and that
the compiler will be unable to optimize away.  (Even in that case, I'm
suspicious as to whether such things would really make a noticable
difference in the size of the result executable...)

In the case of REVERSIBLE_CC_MODE this would require a little effort,
in that it's a function-like macro.  But, that's easily fixed: in
defaults.h add:

  #ifdef REVERSIBLE_CC_MODE
  #define HAS_REVERSIBLE_CC_MODE 1
  #else
  #define HAS_REVERSIBLE_CC_MODE 0
  #endif

Does anyone object to making an effort to follow this style in the
future?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]