Home | History | Annotate | Line # | Download | only in indent
opt_fc1.c revision 1.1
      1 /* $NetBSD: opt_fc1.c,v 1.1 2021/10/16 03:20:13 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 input
     77 /*
     78  * A comment
     79  * in column 1.
     80  *
     81  *
     82  *
     83  */
     84 
     85 /* $ Neither indentation nor surrounding spaces. */
     86 /*narrow*/
     87 
     88 /* $ Indented by a single space, single spaces around the text. */
     89  /* space */
     90 
     91 /* $ Indented by a single tab, single tabs around the text. */
     92 	/*	tab	*/
     93 
     94 /* $ The space between these comments gets removed. */
     95 /* block1 */ /* block2 */
     96 
     97 /* $ Both comment texts get surrounded by spaces. */
     98 /*block1*//*block2*/
     99 
    100 /*
    101  * A multi-line comment that starts
    102  * in column 1.
    103  *//* followed by another multi-line comment
    104  * that starts in column 4.
    105  */
    106 
    107 /* comment */ int decl2; /* comment */
    108 /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
    109 /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
    110 #indent end
    111 
    112 #indent run -nfc1
    113 /*
    114  * A comment
    115  * in column 1.
    116  *
    117  *
    118  *
    119  */
    120 
    121 /* $ No spaces got added around the comment text. */
    122 /*narrow*/
    123 
    124 /* $ The indentation of a single space was preserved. */
    125 /* $ If the comment were moved to column 1, it would change from the area */
    126 /* $ of 'comments that may be formatted' to the area of 'comments that must */
    127 /* $ not be formatted. The indentation of a single space prevents this. */
    128  /* space */
    129 
    130 /* $ The indentation was changed from a single tab to a single space. */
    131  /* tab	*/
    132 
    133 /* $ The space between these two comments got removed. */
    134 /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    135 /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    136 /* $ This is probably because there is a second comment in the same line. */
    137  /* block1 *//* block2 */
    138 
    139 /* $ It may seem strange at first that the left comment is not touched */
    140 /* $ but the right comment gets spaces added. This difference is the */
    141 /* $ exact purpose of the option '-nfc1', which says "do not touch comments */
    142 /* $ that start in column 1. The first comment starts in column 1, the */
    143 /* $ second comment doesn't. */
    144 /* $ XXX: The option '-nfc1' says that comments in column 1 do not get */
    145 /* $ formatted, but the comment 'block1' was moved from column 1 to 2. */
    146 /* $ This is probably because there is a second comment in the same line. */
    147  /*block1*//* block2 */
    148 
    149 /*
    150  * A multi-line comment that starts
    151  * in column 1.
    152   *
    153   * followed by another multi-line comment that starts in column 4.
    154   */
    155 /* $ XXX: The two comments have been merged into a single comment. */
    156 
    157  /* comment */ int decl2;	/* comment */
    158  /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2;	/* second comment */
    159  /* first comment */ int decl2;	/* looooooooooooooooooooooooooooooooooooooooong
    160 				 * second comment */
    161 #indent end
    162