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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
diff -Nru -x config.h uncrustify-0.51/src/detect.cpp uncrustify-0.51-beforeafter/src/detect.cpp
--- uncrustify-0.51/src/detect.cpp 2008-09-04 19:07:34.000000000 -0700
+++ uncrustify-0.51-beforeafter/src/detect.cpp 2008-12-06 17:30:32.000000000 -0800
@@ -95,8 +95,10 @@
static void detect_space_options()
{
SP_VOTE_VAR(sp_arith);
- SP_VOTE_VAR(sp_assign);
- SP_VOTE_VAR(sp_enum_assign);
+ SP_VOTE_VAR(sp_before_assign);
+ SP_VOTE_VAR(sp_after_assign);
+ SP_VOTE_VAR(sp_enum_before_assign);
+ SP_VOTE_VAR(sp_enum_after_assign);
SP_VOTE_VAR(sp_bool);
SP_VOTE_VAR(sp_compare);
SP_VOTE_VAR(sp_inside_paren);
@@ -164,13 +166,13 @@
{
if ((pc->flags & PCF_IN_ENUM) == 0)
{
- vote_sp_assign.vote(pc, next);
- vote_sp_assign.vote(prev, pc);
+ vote_sp_before_assign.vote(prev, pc);
+ vote_sp_after_assign.vote(pc, next);
}
else
{
- vote_sp_enum_assign.vote(pc, next);
- vote_sp_enum_assign.vote(prev, pc);
+ vote_sp_enum_before_assign.vote(prev, pc);
+ vote_sp_enum_after_assign.vote(pc, next);
}
}
if (pc->type == CT_SQUARE_OPEN)
diff -Nru -x config.h uncrustify-0.51/src/options.cpp uncrustify-0.51-beforeafter/src/options.cpp
--- uncrustify-0.51/src/options.cpp 2008-11-27 07:49:18.000000000 -0800
+++ uncrustify-0.51-beforeafter/src/options.cpp 2008-12-06 17:30:00.000000000 -0800
@@ -133,10 +133,14 @@
unc_begin_group(UG_space, "Spacing options");
unc_add_option("sp_arith", UO_sp_arith, AT_IARF,
"Add or remove space around arithmetic operator '+', '-', '/', '*', etc");
- unc_add_option("sp_assign", UO_sp_assign, AT_IARF,
- "Add or remove space around assignment operator '=', '+=', etc");
- unc_add_option("sp_enum_assign", UO_sp_enum_assign, AT_IARF,
- "Add or remove space around assignment '=' in enum");
+ unc_add_option("sp_before_assign", UO_sp_before_assign, AT_IARF,
+ "Add or remove space before assignment operator '=', '+=', etc");
+ unc_add_option("sp_after_assign", UO_sp_after_assign, AT_IARF,
+ "Add or remove space after assignment operator '=', '+=', etc");
+ unc_add_option("sp_enum_before_assign", UO_sp_enum_before_assign, AT_IARF,
+ "Add or remove space before assignment '=' in enum");
+ unc_add_option("sp_enum_after_assign", UO_sp_enum_after_assign, AT_IARF,
+ "Add or remove space after assignment '=' in enum");
unc_add_option("sp_bool", UO_sp_bool, AT_IARF,
"Add or remove space around boolean operators '&&' and '||'");
unc_add_option("sp_compare", UO_sp_compare, AT_IARF,
diff -Nru -x config.h uncrustify-0.51/src/options.h uncrustify-0.51-beforeafter/src/options.h
--- uncrustify-0.51/src/options.h 2008-11-27 07:49:18.000000000 -0800
+++ uncrustify-0.51-beforeafter/src/options.h 2008-12-06 17:28:30.000000000 -0800
@@ -207,9 +207,10 @@
UO_sp_arith, // space around + - / * etc
UO_sp_bool, // space around || &&
UO_sp_compare, // space around < > ==, etc
- UO_sp_assign, // space around =, +=, etc
- UO_sp_enum_assign, // space around = in enum
-
+ UO_sp_before_assign, // space before =, +=, etc
+ UO_sp_enum_before_assign, // space before = in enum
+ UO_sp_after_assign, // space after =, +=, etc
+ UO_sp_enum_after_assign, // space after = in enum
UO_sp_after_class_colon, // space after class ':'
UO_sp_before_class_colon, // space before class ':'
UO_sp_before_case_colon,
diff -Nru -x config.h uncrustify-0.51/src/space.cpp uncrustify-0.51-beforeafter/src/space.cpp
--- uncrustify-0.51/src/space.cpp 2008-11-26 11:35:54.000000000 -0800
+++ uncrustify-0.51-beforeafter/src/space.cpp 2008-12-06 17:24:12.000000000 -0800
@@ -333,15 +333,26 @@
return(cpd.settings[UO_sp_before_sparen].a);
}
- if ((first->type == CT_ASSIGN) || (second->type == CT_ASSIGN))
+ if (second->type == CT_ASSIGN)
+ {
+ if (second->flags & PCF_IN_ENUM)
+ {
+ log_rule("sp_enum_before_assign");
+ return(cpd.settings[UO_sp_enum_before_assign].a);
+ }
+ log_rule("sp_before_assign");
+ return(cpd.settings[UO_sp_before_assign].a);
+ }
+
+ if (first->type == CT_ASSIGN)
{
if (first->flags & PCF_IN_ENUM)
{
- log_rule("sp_enum_assign");
- return(cpd.settings[UO_sp_enum_assign].a);
+ log_rule("sp_enum_after_assign");
+ return(cpd.settings[UO_sp_enum_after_assign].a);
}
- log_rule("sp_assign");
- return(cpd.settings[UO_sp_assign].a);
+ log_rule("sp_after_assign");
+ return(cpd.settings[UO_sp_after_assign].a);
}
/* "a [x]" vs "a[x]" */
|