Home | History | Annotate | Line # | Download | only in indent
fmt_decl.c revision 1.52
      1 /*	$NetBSD: fmt_decl.c,v 1.52 2023/06/09 09:49:07 rillig Exp $	*/
      2 
      3 /*
      4  * Tests for declarations of global variables, external functions, and local
      5  * variables.
      6  *
      7  * See also:
      8  *	opt_di.c
      9  */
     10 
     11 /* See FreeBSD r303570 */
     12 
     13 /*
     14  * A type definition usually declares a single type, so there is no need to
     15  * align the newly declared type name with the other variables.
     16  */
     17 //indent input
     18 typedef   void   (   *   function_ptr   )   (   int   *   )   ;
     19 //indent end
     20 
     21 //indent run
     22 typedef void (*function_ptr)(int *);
     23 //indent end
     24 
     25 
     26 /*
     27  * In variable declarations, the names of the first declarators are indented
     28  * by the amount given in '-di', which defaults to 16.
     29  */
     30 //indent input
     31 extern   void   (   *   function_pointer   )   (   int   *   )   ;
     32 extern   void   *   pointer;
     33 //indent end
     34 
     35 //indent run
     36 /* $ XXX: Why is the token 'function_pointer' not aligned with 'pointer'? */
     37 extern void	(*function_pointer)(int *);
     38 extern void    *pointer;
     39 //indent end
     40 
     41 
     42 //indent input
     43 static const struct
     44 {
     45 	double		x;
     46 	double		y, z;
     47 } n[m + 1] =
     48 {
     49 	{
     50 		.0,
     51 		.9,
     52 		5
     53 	}
     54 };
     55 //indent end
     56 
     57 //indent run
     58 static const struct
     59 {
     60 	double		x;
     61 	double		y, z;
     62 }		n[m + 1] =
     63 {
     64 	{
     65 		.0,
     66 		.9,
     67 		5
     68 	}
     69 };
     70 //indent end
     71 
     72 
     73 //indent input
     74 typedef struct Complex
     75 {
     76 	double		x;
     77 	double		y;
     78 }	Complex;
     79 //indent end
     80 
     81 //indent run
     82 typedef struct Complex
     83 {
     84 	double		x;
     85 	double		y;
     86 }		Complex;
     87 //indent end
     88 
     89 
     90 /*
     91  * Ensure that function definitions are reasonably indented.  Before
     92  * 2023-05-11, tokens were repeatedly read, and the line numbers were wrong.
     93  */
     94 //indent input
     95 void
     96 t1 (char *a, int b,
     97 	void (*fn)(void))
     98 {}
     99 //indent end
    100 
    101 //indent run
    102 void
    103 t1(char *a, int b,
    104    void (*fn)(void))
    105 {
    106 }
    107 //indent end
    108 
    109 
    110 /* See opt_bc.c. */
    111 //indent input
    112 void t2 (char *x, int y)
    113 {
    114 	int a,
    115 	b,
    116 	c;
    117 	int
    118 	*d,
    119 	*e,
    120 	*f;
    121 	int (*g)(),
    122 	(*h)(),
    123 	(*i)();
    124 	int j,
    125 	k,
    126 	l;
    127 	int m
    128 	,n
    129 	,o
    130 	;
    131 	int		chars[ /* push the comma beyond column 74 ...... */ ], x;
    132 }
    133 //indent end
    134 
    135 //indent run
    136 void
    137 t2(char *x, int y)
    138 {
    139 	int		a, b, c;
    140 	int
    141 		       *d, *e, *f;
    142 	int		(*g)(), (*h)(), (*i)();
    143 	int		j, k, l;
    144 	int		m
    145 		       ,n
    146 		       ,o
    147 		       ;
    148 	int		chars[/* push the comma beyond column 74 ...... */],
    149 			x;
    150 }
    151 //indent end
    152 
    153 
    154 //indent input
    155 const int	int_minimum_size =
    156 // $ FIXME: Missing indentation.
    157 MAXALIGN(offsetof(int, test)) + MAXIMUM_ALIGNOF;
    158 //indent end
    159 
    160 //indent run-equals-input
    161 
    162 
    163 /*
    164  * Ensure that the usual GCC-style function attributes are formatted in a
    165  * sensible way.
    166  */
    167 //indent input
    168 void single_param(int) __attribute__((__noreturn__)) ;
    169 void function(const char *, ...) __attribute__((format(printf, 1, 2))) ;
    170 //indent end
    171 
    172 //indent run -di0
    173 void single_param(int) __attribute__((__noreturn__));
    174 void function(const char *, ...) __attribute__((format(printf, 1, 2)));
    175 //indent end
    176 
    177 //indent run
    178 void		single_param(int) __attribute__((__noreturn__));
    179 void		function(const char *, ...) __attribute__((format(printf, 1, 2)));
    180 //indent end
    181 
    182 
    183 //indent input
    184 static
    185 _attribute_printf(1, 2)
    186 void
    187 print_error(const char *fmt,...)
    188 {
    189 }
    190 //indent end
    191 
    192 //indent run
    193 static
    194 _attribute_printf(1, 2)
    195 void
    196 print_error(const char *fmt, ...)
    197 {
    198 }
    199 //indent end
    200 
    201 
    202 //indent input
    203 static _attribute_printf(1, 2)
    204 void
    205 print_error(const char *fmt,...)
    206 {
    207 }
    208 //indent end
    209 
    210 //indent run
    211 static _attribute_printf(1, 2)
    212 void
    213 print_error(const char *fmt, ...)
    214 {
    215 }
    216 //indent end
    217 
    218 
    219 //indent input
    220 static void _attribute_printf(1, 2)
    221 print_error(const char *fmt,...)
    222 {
    223 }
    224 //indent end
    225 
    226 //indent run
    227 static void
    228 _attribute_printf(1, 2)
    229 print_error(const char *fmt, ...)
    230 {
    231 }
    232 //indent end
    233 
    234 
    235 /* See FreeBSD r309380 */
    236 //indent input
    237 static LIST_HEAD(, alq) ald_active;
    238 static int ald_shutting_down = 0;
    239 struct thread *ald_thread;
    240 //indent end
    241 
    242 //indent run
    243 static LIST_HEAD(, alq) ald_active;
    244 static int	ald_shutting_down = 0;
    245 struct thread  *ald_thread;
    246 //indent end
    247 
    248 
    249 //indent input
    250 static int
    251 old_style_definition(a, b, c)
    252 	struct thread *a;
    253 	int b;
    254 	double ***c;
    255 {
    256 
    257 }
    258 //indent end
    259 
    260 //indent run
    261 static int
    262 old_style_definition(a, b, c)
    263 	struct thread  *a;
    264 	int		b;
    265 	double	     ***c;
    266 {
    267 
    268 }
    269 //indent end
    270 
    271 
    272 /*
    273  * Demonstrate how variable declarations are broken into several lines when
    274  * the line length limit is set quite low.
    275  */
    276 //indent input
    277 struct s a,b;
    278 struct s0 a,b;
    279 struct s01 a,b;
    280 struct s012 a,b;
    281 struct s0123 a,b;
    282 struct s01234 a,b;
    283 struct s012345 a,b;
    284 struct s0123456 a,b;
    285 struct s01234567 a,b;
    286 struct s012345678 a,b;
    287 struct s0123456789 a,b;
    288 struct s01234567890 a,b;
    289 struct s012345678901 a,b;
    290 struct s0123456789012 a,b;
    291 struct s01234567890123 a,b;
    292 //indent end
    293 
    294 //indent run -l20 -di0
    295 struct s a, b;
    296 /* $ XXX: See process_comma, varname_len for why this line is broken. */
    297 struct s0 a,
    298    b;
    299 /* $ XXX: The indentation of the second line is wrong. The variable names */
    300 /* $ XXX: 'a' and 'b' should be in the same column; the word 'struct' is */
    301 /* $ XXX: missing in the calculation for the indentation. */
    302 struct s01 a,
    303     b;
    304 struct s012 a,
    305      b;
    306 struct s0123 a,
    307       b;
    308 struct s01234 a,
    309        b;
    310 struct s012345 a,
    311         b;
    312 struct s0123456 a,
    313          b;
    314 struct s01234567 a,
    315           b;
    316 struct s012345678 a,
    317            b;
    318 struct s0123456789 a,
    319             b;
    320 struct s01234567890 a,
    321              b;
    322 struct s012345678901 a,
    323               b;
    324 struct s0123456789012 a,
    325                b;
    326 struct s01234567890123 a,
    327                 b;
    328 //indent end
    329 
    330 
    331 //indent input
    332 char * x(void)
    333 {
    334     type identifier;
    335     type *pointer;
    336     unused * value;
    337     (void)unused * value;
    338 
    339     dmax = (double)3 * 10.0;
    340     dmin = (double)dmax * 10.0;
    341     davg = (double)dmax * dmin;
    342 
    343     return NULL;
    344 }
    345 //indent end
    346 
    347 //indent run
    348 char *
    349 x(void)
    350 {
    351 	type		identifier;
    352 	type	       *pointer;
    353 	unused	       *value;
    354 	(void)unused * value;
    355 
    356 	dmax = (double)3 * 10.0;
    357 	dmin = (double)dmax * 10.0;
    358 	davg = (double)dmax * dmin;
    359 
    360 	return NULL;
    361 }
    362 //indent end
    363 
    364 
    365 //indent input
    366 int *
    367 y(void) {
    368 
    369 }
    370 
    371 int
    372 z(void) {
    373 
    374 }
    375 //indent end
    376 
    377 //indent run
    378 int *
    379 y(void)
    380 {
    381 
    382 }
    383 
    384 int
    385 z(void)
    386 {
    387 
    388 }
    389 //indent end
    390 
    391 
    392 //indent input
    393 int x;
    394 int *y;
    395 int * * * * z;
    396 //indent end
    397 
    398 //indent run
    399 int		x;
    400 int	       *y;
    401 int	    ****z;
    402 //indent end
    403 
    404 
    405 //indent input
    406 int main(void) {
    407     char (*f1)() = NULL;
    408     char *(*f1)() = NULL;
    409     char *(*f2)();
    410 }
    411 //indent end
    412 
    413 /*
    414  * Before NetBSD io.c 1.103 from 2021-10-27, indent wrongly placed the second
    415  * and third variable declaration in column 1. This bug has been introduced
    416  * to NetBSD when FreeBSD indent was imported in 2019.
    417  */
    418 //indent run -ldi0
    419 int
    420 main(void)
    421 {
    422 	char (*f1)() = NULL;
    423 	char *(*f1)() = NULL;
    424 	char *(*f2)();
    425 }
    426 //indent end
    427 
    428 //indent run
    429 int
    430 main(void)
    431 {
    432 /* $ XXX: Not really pretty, the name 'f1' should be aligned, if at all. */
    433 	char		(*f1)() = NULL;
    434 /* $ XXX: Not really pretty, the name 'f1' should be aligned, if at all. */
    435 	char *(*	f1)() = NULL;
    436 /* $ XXX: Not really pretty, the name 'f2' should be aligned, if at all. */
    437 	char *(*	f2)();
    438 }
    439 //indent end
    440 
    441 
    442 /*
    443  * In some ancient time long before ISO C90, variable declarations with
    444  * initializer could be written without '='. The C Programming Language from
    445  * 1978 doesn't mention this form anymore.
    446  *
    447  * Before NetBSD lexi.c 1.123 from 2021-10-31, indent treated the '-' as a
    448  * unary operator.
    449  */
    450 //indent input
    451 int a - 1;
    452 {
    453 int a - 1;
    454 }
    455 //indent end
    456 
    457 //indent run -di0
    458 int a - 1;
    459 {
    460 	int a - 1;
    461 }
    462 //indent end
    463 
    464 
    465 /*
    466  * Between 2019-04-04 and before lexi.c 1.146 from 2021-11-19, the indentation
    467  * of the '*' depended on the function name, which did not make sense.  For
    468  * function names that matched [A-Za-z]+, the '*' was placed correctly, for
    469  * all other function names (containing [$0-9_]) the '*' was right-aligned on
    470  * the declaration indentation, which defaults to 16.
    471  */
    472 //indent input
    473 int *
    474 f2(void)
    475 {
    476 }
    477 
    478 int *
    479 yy(void)
    480 {
    481 }
    482 
    483 int *
    484 int_create(void)
    485 {
    486 }
    487 //indent end
    488 
    489 //indent run-equals-input
    490 
    491 
    492 /*
    493  * Since 2019-04-04, the space between the '){' is missing.
    494  */
    495 //indent input
    496 int *
    497 function_name_____20________30________40________50
    498 (void)
    499 {}
    500 //indent end
    501 
    502 /*
    503  * Before 2023-05-11, indent moved the '{' right after the '(void)', without
    504  * any space in between.
    505  */
    506 //indent run
    507 int	       *function_name_____20________30________40________50
    508 		(void)
    509 {
    510 }
    511 //indent end
    512 
    513 
    514 /*
    515  * Since 2019-04-04 and before lexi.c 1.144 from 2021-11-19, some function
    516  * names were preserved while others were silently discarded.
    517  */
    518 //indent input
    519 int *
    520 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    521 (void)
    522 {}
    523 //indent end
    524 
    525 /*
    526  * Before 2023-05-11, indent moved the '{' right after the '(void)', without
    527  * any space in between.
    528  */
    529 //indent run
    530 int	       *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    531 		(void)
    532 {
    533 }
    534 //indent end
    535 
    536 
    537 /*
    538  * Before 1990, when C90 standardized function prototypes, a function
    539  * declaration or definition did not contain a '*' that may have looked
    540  * similar to the binary operator '*' because it was surrounded by two
    541  * identifiers.
    542  *
    543  * As of 2021-11-21, indent interpreted the '*' in the function declaration in
    544  * line 1 as a binary operator, even though the '*' was followed by a ','
    545  * directly. This was not visible in the output though since indent never
    546  * outputs a space before a comma.
    547  *
    548  * In the function declaration in line 2 and the function definition in line
    549  * 5, indent interpreted the '*' as a binary operator as well and accordingly
    550  * placed spaces around the '*'. On a very low syntactical analysis level,
    551  * this may have made sense since the '*' was surrounded by words, but still
    552  * the '*' is part of a declaration, where a binary operator does not make
    553  * sense.
    554  *
    555  * Essentially, as of 2021, indent had missed the last 31 years of advances in
    556  * the C programming language, in particular the invention of function
    557  * prototypes. Instead, the workaround had been to require all type names to
    558  * be specified via the options '-ta' and '-T'. This put the burden on the
    559  * user instead of the implementer.
    560  *
    561  * Fixed in lexi.c 1.156 from 2021-11-25.
    562  */
    563 //indent input
    564 void		buffer_add(buffer *, char);
    565 void		buffer_add(buffer *buf, char ch);
    566 
    567 void
    568 buffer_add(buffer *buf, char ch)
    569 {
    570 	*buf->e++ = ch;
    571 }
    572 //indent end
    573 
    574 //indent run
    575 void		buffer_add(buffer *, char);
    576 // $ FIXME: There should be no space after the '*'.
    577 void		buffer_add(buffer * buf, char ch);
    578 
    579 void
    580 buffer_add(buffer *buf, char ch)
    581 {
    582 	*buf->e++ = ch;
    583 }
    584 //indent end
    585 
    586 
    587 /*
    588  * Before lexi.c 1.153 from 2021-11-25, indent did not recognize 'Token' as a
    589  * type name and then messed up the positioning of the '{'.
    590  */
    591 //indent input
    592 static Token
    593 ToToken(bool cond)
    594 {
    595 }
    596 //indent end
    597 
    598 //indent run-equals-input -TToken
    599 
    600 /* Since lexi.c 1.153 from 2021-11-25. */
    601 //indent run-equals-input
    602 
    603 
    604 /*
    605  * Before indent.c 1.309 from 2023-05-23, indent easily got confused by unknown
    606  * type names in struct declarations, as a ';' did not finish a declaration.
    607  */
    608 //indent input
    609 typedef struct OpenDirs {
    610 	CachedDirList	list;
    611 	HashTable /* of CachedDirListNode */ table;
    612 }		OpenDirs;
    613 //indent end
    614 
    615 //indent run-equals-input -THashTable
    616 
    617 //indent run-equals-input
    618 
    619 
    620 /*
    621  * Before lexi.c 1.153 from 2021-11-25, indent easily got confused by unknown
    622  * type names, even in declarations that are syntactically unambiguous.
    623  */
    624 //indent input
    625 static CachedDir *dot = NULL;
    626 //indent end
    627 
    628 //indent run-equals-input -TCachedDir
    629 
    630 //indent run-equals-input
    631 
    632 
    633 /*
    634  * Before lexi.c 1.153 from 2021-11-25, indent easily got confused by unknown
    635  * type names in declarations.
    636  */
    637 //indent input
    638 static CachedDir *
    639 CachedDir_New(const char *name)
    640 {
    641 }
    642 //indent end
    643 
    644 //indent run-equals-input
    645 
    646 
    647 /*
    648  * Before lexi.c 1.156 from 2021-11-25, indent easily got confused by unknown
    649  * type names in declarations and generated 'CachedDir * dir' with an extra
    650  * space.
    651  */
    652 //indent input
    653 static CachedDir *
    654 CachedDir_Ref(CachedDir *dir)
    655 {
    656 }
    657 //indent end
    658 
    659 //indent run-equals-input
    660 
    661 
    662 /*
    663  * Before lexi.c 1.156 from 2021-11-25, indent easily got confused by unknown
    664  * type names in declarations and generated 'HashEntry * he' with an extra
    665  * space.
    666  *
    667  * Before lexi.c 1.153 from 2021-11-25, indent also placed the '{' at the end
    668  * of the line.
    669  */
    670 //indent input
    671 static bool
    672 HashEntry_KeyEquals(const HashEntry *he, Substring key)
    673 {
    674 }
    675 //indent end
    676 
    677 //indent run-equals-input
    678 
    679 
    680 /*
    681  * Before lexi.c 1.156 from 2021-11-25, indent didn't notice that the two '*'
    682  * are in a declaration, instead it interpreted the first '*' as a binary
    683  * operator, therefore generating 'CachedDir * *var' with an extra space.
    684  */
    685 //indent input
    686 static void
    687 CachedDir_Assign(CachedDir **var, CachedDir *dir)
    688 {
    689 }
    690 //indent end
    691 
    692 //indent run-equals-input -TCachedDir
    693 
    694 //indent run-equals-input
    695 
    696 
    697 /*
    698  * Before lexi.c 1.153 from 2021-11-25, all initializer expressions after the
    699  * first one were indented as if they were statement continuations. This was
    700  * caused by the token 'Shell' being identified as a word, not as a type name.
    701  */
    702 //indent input
    703 static Shell	shells[] = {
    704 	{
    705 		first,
    706 		second,
    707 	},
    708 };
    709 //indent end
    710 
    711 //indent run-equals-input
    712 
    713 
    714 /*
    715  * Before lexi.c 1.158 from 2021-11-25, indent easily got confused by function
    716  * attribute macros that followed the function declaration. Its primitive
    717  * heuristic between deciding between a function declaration and a function
    718  * definition only looked for ')' immediately followed by ',' or ';'. This was
    719  * sufficient for well-formatted code before 1990. With the addition of
    720  * function prototypes and GCC attributes, the situation became more
    721  * complicated, and it took indent 31 years to adapt to this new reality.
    722  */
    723 //indent input
    724 static void JobInterrupt(bool, int) MAKE_ATTR_DEAD;
    725 static void JobRestartJobs(void);
    726 //indent end
    727 
    728 //indent run
    729 static void	JobInterrupt(bool, int) MAKE_ATTR_DEAD;
    730 static void	JobRestartJobs(void);
    731 //indent end
    732 
    733 
    734 /*
    735  * Before lexi.c 1.158 from 2021-11-25, indent easily got confused by the
    736  * tokens ')' and ';' in the function body. It wrongly regarded them as
    737  * finishing a function declaration.
    738  */
    739 //indent input
    740 MAKE_INLINE const char *
    741 GNode_VarTarget(GNode *gn) { return GNode_ValueDirect(gn, TARGET); }
    742 //indent end
    743 
    744 /*
    745  * Before lexi.c 1.156 from 2021-11-25, indent generated 'GNode * gn' with an
    746  * extra space.
    747  *
    748  * Before lexi.c 1.158 from 2021-11-25, indent wrongly placed the function
    749  * name in line 1, together with the '{'.
    750  */
    751 //indent run
    752 MAKE_INLINE const char *
    753 GNode_VarTarget(GNode *gn)
    754 {
    755 	return GNode_ValueDirect(gn, TARGET);
    756 }
    757 //indent end
    758 
    759 //indent run-equals-prev-output -TGNode
    760 
    761 
    762 /*
    763  * Ensure that '*' in declarations is interpreted (or at least formatted) as
    764  * a 'pointer to' type derivation, not as a binary or unary operator.
    765  */
    766 //indent input
    767 number *var = a * b;
    768 
    769 void
    770 function(void)
    771 {
    772 	number *var = a * b;
    773 }
    774 //indent end
    775 
    776 //indent run-equals-input -di0
    777 
    778 
    779 /*
    780  * In declarations, most occurrences of '*' are pointer type derivations.
    781  * There are a few exceptions though. Some of these are hard to detect
    782  * without knowing which identifiers are type names.
    783  */
    784 //indent input
    785 char str[expr * expr];
    786 char str[expr**ptr];
    787 char str[*ptr**ptr];
    788 char str[sizeof(expr * expr)];
    789 char str[sizeof(int) * expr];
    790 char str[sizeof(*ptr)];
    791 char str[sizeof(type**)];
    792 char str[sizeof(**ptr)];
    793 //indent end
    794 
    795 //indent run -di0
    796 char str[expr * expr];
    797 char str[expr * *ptr];
    798 char str[*ptr * *ptr];
    799 char str[sizeof(expr * expr)];
    800 char str[sizeof(int) * expr];
    801 char str[sizeof(*ptr)];
    802 char str[sizeof(type **)];
    803 char str[sizeof(**ptr)];
    804 //indent end
    805 
    806 
    807 /*
    808  * Since lexi.c 1.158 from 2021-11-25, whether the function 'a' was considered
    809  * a declaration or a definition depended on the preceding struct, in
    810  * particular the length of the 'pn' line. This didn't make sense at all and
    811  * was due to an out-of-bounds memory access.
    812  *
    813  * Seen amongst others in args.c 1.72, function add_typedefs_from_file.
    814  * Fixed in lexi.c 1.165 from 2021-11-27.
    815  */
    816 //indent input
    817 struct {
    818 } v = {
    819     pn("ta"),
    820 };
    821 
    822 static void
    823 a(char *fe)
    824 {
    825 }
    826 
    827 struct {
    828 } v = {
    829     pn("t"),
    830 };
    831 
    832 static void
    833 a(char *fe)
    834 {
    835 }
    836 //indent end
    837 
    838 //indent run -di0
    839 struct {
    840 } v = {
    841 	pn("ta"),
    842 };
    843 
    844 static void
    845 a(char *fe)
    846 {
    847 }
    848 
    849 struct {
    850 } v = {
    851 	pn("t"),
    852 };
    853 
    854 static void
    855 a(char *fe)
    856 {
    857 }
    858 //indent end
    859 
    860 
    861 /*
    862  * Before NetBSD indent.c 1.178 from 2021-10-29, indent removed the blank
    863  * before the '=', in the second and third of these function pointer
    864  * declarations. This was because indent interpreted the prototype parameters
    865  * 'int' and 'int, int' as type casts, which doesn't make sense at all. Fixing
    866  * this properly requires large style changes since indent is based on simple
    867  * heuristics all over. This didn't change in indent.c 1.178; instead, the
    868  * rule for inserting a blank before a binary operator was changed to always
    869  * insert a blank, except at the beginning of a line.
    870  */
    871 //indent input
    872 char *(*fn)() = NULL;
    873 char *(*fn)(int) = NULL;
    874 char *(*fn)(int, int) = NULL;
    875 //indent end
    876 
    877 /* XXX: The parameter '(int)' is wrongly interpreted as a type cast. */
    878 /* XXX: The parameter '(int, int)' is wrongly interpreted as a type cast. */
    879 //indent run-equals-input -di0
    880 
    881 
    882 /*
    883  * Depending on whether there was a line break in the function header, the
    884  * spaces around the '||' operator were erroneously removed.
    885  */
    886 //indent input
    887 bool is_identifier_start(char ch)
    888 {
    889 	return ch_isalpha(ch) || ch == '_';
    890 }
    891 
    892 bool
    893 is_identifier_start(char ch)
    894 {
    895 	return ch_isalpha(ch) || ch == '_';
    896 }
    897 //indent end
    898 
    899 //indent run
    900 bool
    901 is_identifier_start(char ch)
    902 {
    903 	return ch_isalpha(ch) || ch == '_';
    904 }
    905 
    906 bool
    907 is_identifier_start(char ch)
    908 {
    909 	return ch_isalpha(ch) || ch == '_';
    910 }
    911 //indent end
    912 
    913 
    914 //indent input
    915 void buf_add_chars(struct buffer *, const char *, size_t);
    916 
    917 static inline bool
    918 ch_isalnum(char ch)
    919 {
    920     return isalnum((unsigned char)ch) != 0;
    921 }
    922 
    923 static inline bool
    924 ch_isalpha(char ch)
    925 {
    926     return isalpha((unsigned char)ch) != 0;
    927 }
    928 //indent end
    929 
    930 //indent run -i4 -di0
    931 // $ FIXME: 'buffer' is classified as 'word'.
    932 // $
    933 // $ XXX: 'char' is classified as 'type_in_parentheses'; check whether
    934 // $ XXX: lsym_type_in_parentheses should only be used for types in cast
    935 // $ XXX: expressions.
    936 // $
    937 // $ FIXME: 'size_t' is classified as 'word'.
    938 void buf_add_chars(struct buffer *, const char *, size_t);
    939 
    940 static inline bool
    941 ch_isalnum(char ch)
    942 {
    943     return isalnum((unsigned char)ch) != 0;
    944 }
    945 
    946 static inline bool
    947 ch_isalpha(char ch)
    948 {
    949     return isalpha((unsigned char)ch) != 0;
    950 }
    951 //indent end
    952 
    953 //indent run-equals-input -i4 -di0
    954 
    955 
    956 //indent input
    957 void __printflike(1, 2)
    958 debug_printf(const char *fmt, ...)
    959 {
    960 }
    961 //indent end
    962 
    963 //indent run
    964 void
    965 // $ FIXME: No line break here.
    966 __printflike(1, 2)
    967 debug_printf(const char *fmt, ...)
    968 {
    969 }
    970 //indent end
    971 
    972 
    973 //indent input
    974 void
    975 (error_at)(int msgid, const pos_t *pos, ...)
    976 {
    977 }
    978 //indent end
    979 
    980 //indent run -ci4 -di0 -ndj -nlp
    981 void
    982 // $ FIXME: Wrong indentation, should be 0 instead.
    983 // $ FIXME: There should be no space after the '*'.
    984      (error_at)(int msgid, const pos_t * pos, ...)
    985 {
    986 }
    987 //indent end
    988 
    989 
    990 //indent input
    991 struct a {
    992 	struct b {
    993 		struct c {
    994 			struct d1 {
    995 				int e;
    996 			} d1;
    997 			struct d2 {
    998 				int e;
    999 			} d2;
   1000 		} c;
   1001 	} b;
   1002 };
   1003 //indent end
   1004 
   1005 //indent run-equals-input -di0
   1006 
   1007 
   1008 //indent input
   1009 static FILE *ArchFindMember(const char *, const char *,
   1010 			    struct ar_hdr *, const char *);
   1011 
   1012 bool
   1013 Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
   1014 {
   1015 }
   1016 
   1017 static void MAKE_ATTR_PRINTFLIKE(5, 0)
   1018 ParseVErrorInternal(FILE *f, bool useVars, const GNode *gn,
   1019 		    ParseErrorLevel level, const char *fmt, va_list ap)
   1020 {
   1021 }
   1022 
   1023 typedef struct {
   1024 	const char *m_name;
   1025 } mod_t;
   1026 //indent end
   1027 
   1028 //indent run -fbs -di0 -psl
   1029 // $ Must be detected as a function declaration, not a definition.
   1030 static FILE *ArchFindMember(const char *, const char *,
   1031 			    struct ar_hdr *, const char *);
   1032 
   1033 bool
   1034 Job_CheckCommands(GNode *gn, void (*abortProc)(const char *, ...))
   1035 {
   1036 }
   1037 
   1038 static void
   1039 MAKE_ATTR_PRINTFLIKE(5, 0)
   1040 ParseVErrorInternal(FILE *f, bool useVars, const GNode *gn,
   1041 		    ParseErrorLevel level, const char *fmt, va_list ap)
   1042 {
   1043 }
   1044 
   1045 typedef struct {
   1046 	const char *m_name;
   1047 }
   1048 // $ FIXME: Remove this line break.
   1049 mod_t;
   1050 //indent end
   1051