blob: 6c5e4a5b0ec4ab2441415a1d0398440e48da91bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/* $NetBSD: opt_psl.c,v 1.8 2022/04/24 09:04:12 rillig Exp $ */
/*
* Tests for the options '-psl' and '-npsl' ("procedure definition in separate
* line").
*
* The option '-psl' starts a new line for the function name in a function
* definition.
*
* The option '-npsl' puts the function name in the same line as its return
* type.
*/
/* Single-line function declarations are not affected by these options. */
//indent input
void function_declaration(void);
//indent end
//indent run -psl
void function_declaration(void);
//indent end
//indent run-equals-prev-output -npsl
/*
* Multi-line function declarations are affected by these options since indent
* wrongly assumes they were function definitions, not declarations.
*
* Before 1990, when C90 added function prototypes, this case was rare since
* function definitions consisted only of the return type (defaulting to
* 'int'), the function name and the list of parameter names, without
* parameter types or type qualifiers like 'const'.
*/
//indent input
void function_declaration(
void);
//indent end
//indent run -psl
void
function_declaration(
void);
//indent end
/*
* In a function definition (which indent wrongly assumes here), in contrast
* to a declaration, the function name is not indented to column 17.
*/
//indent run -npsl
void function_declaration(
void);
//indent end
/*
* In a function definition, in contrast to a declaration, the function name
* is not indented to column 17 since the other function definitions are too
* far away.
*/
//indent input
void function_definition(void) {}
//indent end
//indent run -psl
void
function_definition(void)
{
}
//indent end
//indent run -npsl
void function_definition(void)
{
}
//indent end
|