potential patch for gdb bug c++/20020

Tom Tromey tom@tromey.com
Thu Dec 6 21:07:00 GMT 2018


>>>>> "Bob" == Bob Steagall <bob.steagall.cpp@gmail.com> writes:

>> You should drop the '{' and '}' here for a single statement block.

Bob> Disagree.  The gdb coding standard document specifically calls out
Bob> lines of code,
Bob> not statements:

Bob>     "Any two or more lines in code should be wrapped in braces, even if they
Bob>      are comments, as they look like separate statements"

I think this is just slightly mis-worded -- Andrew's interpretation is
the prevailing one.  That is, no brace for:

  if (blah)
     function_call (spanning,
                    multiple,
                    lines);

... but do have braces for:

  if (blah)
    {
      /* Just a comment.  */
      anything ();
    }

I agree the patch is good.  I think a test case would be good to have,
unless for some reason it's difficult to write one.

Tom



More information about the Gdb-patches mailing list