Home | History | Annotate | Line # | Download | only in indent
opt_fc1.c revision 1.2
      1 /* $NetBSD: opt_fc1.c,v 1.2 2021/10/16 05:40:17 rillig Exp $ */
      2 /* $FreeBSD$ */
      3 
      4 #indent input
      5 /*
      6  * A comment
      7  * in column 1.
      8  *
      9  *
     10  *
     11  */
     12 
     13 /* $ Neither indentation nor surrounding spaces. */
     14 /*narrow*/
     15 
     16 /* $ Indented by a single space, single spaces around the text. */
     17  /* space */
     18 
     19 /* $ Indented by a single tab, single tabs around the text. */
     20 	/*	tab	*/
     21 
     22 /* $ The space between these comments gets removed. */
     23 /* block1 */ /* block2 */
     24 
     25 /* $ Both comment texts get surrounded by spaces. */
     26 /*block1*//*block2*/
     27 
     28 /*
     29  * A multi-line comment that starts
     30  * in column 1.
     31  *//* followed by another multi-line comment
     32  * that starts in column 4.
     33  */
     34 
     35 /* comment */ int decl2; /* comment */
     36 /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
     37 /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
     38 #indent end
     39 
     40 #indent run -fc1
     41 /*
     42  * A comment in column 1.
     43  *
     44  *
     45  *
     46  */
     47 
     48 /* $ The comment text got surrounded by spaces. */
     49 /* narrow */
     50 
     51 /* $ The indentation got removed. */
     52 /* space */
     53 
     54 /* $ The indentation got removed, only the leading tab got replaced by a space. */
     55 /* tab	*/
     56 
     57 /* $ The space between these comments got removed. */
     58 /* block1 *//* block2 */
     59 
     60 /* $ Both comment texts got surrounded by spaces. */
     61 /* block1 *//* block2 */
     62 
     63 /*
     64  * A multi-line comment that starts in column 1.
     65  *
     66  * followed by another multi-line comment that starts in column 4.
     67  */
     68 /* $ XXX: The two comments have been merged into a single comment. */
     69 
     70  /* comment */ int decl2;	/* comment */
     71  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
     72  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
     73 				 * second comment */
     74 #indent end
     75 
     76 #indent run -nfc1
     77 /*
     78  * A comment
     79  * in column 1.
     80  *
     81  *
     82  *
     83  */
     84 
     85 /* $ No spaces got added around the comment text. */
     86 /*narrow*/
     87 
     88 /* $ The indentation of a single space was preserved. */
     89 /* $ If the comment were moved to column 1, it would change from the area */
     90 /* $ of 'comments that may be formatted' to the area of 'comments that must */
     91 /* $ not be formatted. The indentation of a single space prevents this. */
     92  /* space */
     93 
     94 /* $ The indentation was changed from a single tab to a single space. */
     95  /* tab	*/
     96 
     97 /* $ The space between these two comments got removed. */
     98 /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
     99 /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    100 /* $ This is probably because there is a second comment in the same line. */
    101  /* block1 *//* block2 */
    102 
    103 /* $ It may seem strange at first that the left comment is not touched */
    104 /* $ but the right comment gets spaces added. This difference is the */
    105 /* $ exact purpose of the option '-nfc1', which says "do not touch comments */
    106 /* $ that start in column 1. The first comment starts in column 1, the */
    107 /* $ second comment doesn't. */
    108 /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    109 /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    110 /* $ This is probably because there is a second comment in the same line. */
    111  /*block1*//* block2 */
    112 
    113 /*
    114  * A multi-line comment that starts
    115  * in column 1.
    116   *
    117   * followed by another multi-line comment that starts in column 4.
    118   */
    119 /* $ XXX: The two comments have been merged into a single comment. */
    120 
    121  /* comment */ int decl2;	/* comment */
    122  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
    123  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
    124 				 * second comment */
    125 #indent end
    126