1 1.11 rillig /* $NetBSD: opt_fc1.c,v 1.11 2023/05/14 17:53:38 rillig Exp $ */ 2 1.1 rillig 3 1.3 rillig /* 4 1.3 rillig * Tests for the options '-fc1' and '-nfc1'. 5 1.3 rillig * 6 1.3 rillig * The option '-fc1' formats comments in column 1. 7 1.3 rillig * 8 1.5 rillig * The option '-nfc1' preserves the original formatting of comments that start 9 1.5 rillig * in column 1. 10 1.3 rillig */ 11 1.3 rillig 12 1.8 rillig //indent input 13 1.1 rillig /* 14 1.1 rillig * A comment 15 1.1 rillig * in column 1. 16 1.1 rillig * 17 1.1 rillig * 18 1.1 rillig * 19 1.1 rillig */ 20 1.8 rillig //indent end 21 1.3 rillig 22 1.8 rillig //indent run -fc1 23 1.3 rillig /* 24 1.3 rillig * A comment in column 1. 25 1.3 rillig * 26 1.3 rillig * 27 1.3 rillig * 28 1.3 rillig */ 29 1.8 rillig //indent end 30 1.3 rillig 31 1.8 rillig //indent run-equals-input -nfc1 32 1.3 rillig 33 1.1 rillig 34 1.8 rillig //indent input 35 1.1 rillig /* $ Neither indentation nor surrounding spaces. */ 36 1.1 rillig /*narrow*/ 37 1.1 rillig 38 1.1 rillig /* $ Indented by a single space, single spaces around the text. */ 39 1.1 rillig /* space */ 40 1.1 rillig 41 1.1 rillig /* $ Indented by a single tab, single tabs around the text. */ 42 1.5 rillig /* indented tab */ 43 1.1 rillig 44 1.11 rillig /* $ The second comment is moved to a separate line. */ 45 1.11 rillig /* col1 space-padded */ /* space-padded */ 46 1.1 rillig 47 1.1 rillig /* $ Both comment texts get surrounded by spaces. */ 48 1.11 rillig /*col1 no-padding*//*no-padding*/ 49 1.8 rillig //indent end 50 1.1 rillig 51 1.8 rillig //indent run -fc1 52 1.1 rillig /* $ The comment text got surrounded by spaces. */ 53 1.1 rillig /* narrow */ 54 1.1 rillig 55 1.1 rillig /* $ The indentation got removed. */ 56 1.1 rillig /* space */ 57 1.1 rillig 58 1.10 rillig /* $ The indentation got removed. */ 59 1.10 rillig /* indented tab */ 60 1.1 rillig 61 1.11 rillig /* $ Each comment got its separate line. */ 62 1.11 rillig /* col1 space-padded */ 63 1.11 rillig /* space-padded */ 64 1.1 rillig 65 1.1 rillig /* $ Both comment texts got surrounded by spaces. */ 66 1.11 rillig /* col1 no-padding */ 67 1.11 rillig /* no-padding */ 68 1.8 rillig //indent end 69 1.1 rillig 70 1.8 rillig //indent run -nfc1 71 1.1 rillig /* $ No spaces got added around the comment text. */ 72 1.1 rillig /*narrow*/ 73 1.1 rillig 74 1.1 rillig /* $ The indentation of a single space was preserved. */ 75 1.1 rillig /* $ If the comment were moved to column 1, it would change from the area */ 76 1.1 rillig /* $ of 'comments that may be formatted' to the area of 'comments that must */ 77 1.1 rillig /* $ not be formatted. The indentation of a single space prevents this. */ 78 1.1 rillig /* space */ 79 1.1 rillig 80 1.1 rillig /* $ The indentation was changed from a single tab to a single space. */ 81 1.10 rillig /* indented tab */ 82 1.1 rillig 83 1.11 rillig /* $ The second comment moved to a separate line. */ 84 1.11 rillig /* col1 space-padded */ 85 1.11 rillig /* space-padded */ 86 1.11 rillig 87 1.11 rillig /* $ The 'col1' comment starts in column 1 and is thus not modified. */ 88 1.11 rillig /* $ The second comment started further to the right and thus was modified */ 89 1.11 rillig /* $ by moving it to a separate line, but not to column 1. */ 90 1.11 rillig /*col1 no-padding*/ 91 1.11 rillig /* no-padding */ 92 1.8 rillig //indent end 93 1.1 rillig 94 1.3 rillig 95 1.6 rillig /* 96 1.6 rillig * Since 2019-04-04 and before pr_comment.c 1.123 from 2021-11-25, the 97 1.6 rillig * function analyze_comment wrongly joined the two comments. 98 1.6 rillig */ 99 1.8 rillig //indent input 100 1.3 rillig /* 101 1.3 rillig * A multi-line comment that starts 102 1.3 rillig * in column 1. 103 1.3 rillig *//* followed by another multi-line comment 104 1.3 rillig * that starts in column 4. 105 1.3 rillig */ 106 1.8 rillig //indent end 107 1.3 rillig 108 1.8 rillig //indent run -fc1 109 1.3 rillig /* 110 1.3 rillig * A multi-line comment that starts in column 1. 111 1.11 rillig */ 112 1.11 rillig /* 113 1.3 rillig * followed by another multi-line comment that starts in column 4. 114 1.3 rillig */ 115 1.8 rillig //indent end 116 1.3 rillig 117 1.8 rillig //indent run -nfc1 118 1.1 rillig /* 119 1.1 rillig * A multi-line comment that starts 120 1.1 rillig * in column 1. 121 1.11 rillig */ 122 1.11 rillig /* 123 1.1 rillig * followed by another multi-line comment that starts in column 4. 124 1.1 rillig */ 125 1.8 rillig //indent end 126 1.1 rillig 127 1.3 rillig 128 1.8 rillig //indent input 129 1.3 rillig /* comment */ int decl2; /* comment */ 130 1.3 rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */ 131 1.3 rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */ 132 1.8 rillig //indent end 133 1.3 rillig 134 1.8 rillig //indent run -fc1 135 1.9 rillig /* comment */ int decl2; /* comment */ 136 1.9 rillig /* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */ 137 1.9 rillig /* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong 138 1.3 rillig * second comment */ 139 1.8 rillig //indent end 140 1.3 rillig 141 1.8 rillig //indent run-equals-prev-output -nfc1 142