Author: pfg
Date: Fri Jul 29 16:17:54 2016
New Revision: 303484
URL: https://svnweb.freebsd.org/changeset/base/303484

Log:
  indent(1): Fix breakage caused by single comment following "else".
  
  indent(1) simply wasn't taught that "else" may be followed by a comment
  without any opening brace anywhere on the line, so it was very confused
  in such cases.
  
  Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
  Obtained from:        Piotr Stefaniak

Modified:
  head/usr.bin/indent/indent.c

Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c        Fri Jul 29 16:14:03 2016        
(r303483)
+++ head/usr.bin/indent/indent.c        Fri Jul 29 16:17:54 2016        
(r303484)
@@ -319,6 +319,8 @@ main(int argc, char **argv)
            switch (type_code) {
            case newline:
                ++line_no;
+               if (sc_end != NULL)
+                   goto sw_buffer;     /* dump comment, if any */
                flushed_nl = true;
            case form_feed:
                break;          /* form feeds and newlines found here will be
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to