~drizzle-trunk/drizzle/development

656.1.18 by Monty Taylor
Added uncrustify patch.
1
diff -Nru -x config.h uncrustify-0.51/src/detect.cpp uncrustify-0.51-beforeafter/src/detect.cpp
2
--- uncrustify-0.51/src/detect.cpp	2008-09-04 19:07:34.000000000 -0700
3
+++ uncrustify-0.51-beforeafter/src/detect.cpp	2008-12-06 17:30:32.000000000 -0800
4
@@ -95,8 +95,10 @@
5
 static void detect_space_options()
6
 {
7
    SP_VOTE_VAR(sp_arith);
8
-   SP_VOTE_VAR(sp_assign);
9
-   SP_VOTE_VAR(sp_enum_assign);
10
+   SP_VOTE_VAR(sp_before_assign);
11
+   SP_VOTE_VAR(sp_after_assign);
12
+   SP_VOTE_VAR(sp_enum_before_assign);
13
+   SP_VOTE_VAR(sp_enum_after_assign);
14
    SP_VOTE_VAR(sp_bool);
15
    SP_VOTE_VAR(sp_compare);
16
    SP_VOTE_VAR(sp_inside_paren);
17
@@ -164,13 +166,13 @@
18
       {
19
          if ((pc->flags & PCF_IN_ENUM) == 0)
20
          {
21
-            vote_sp_assign.vote(pc, next);
22
-            vote_sp_assign.vote(prev, pc);
23
+            vote_sp_before_assign.vote(prev, pc);
24
+            vote_sp_after_assign.vote(pc, next);
25
          }
26
          else
27
          {
28
-            vote_sp_enum_assign.vote(pc, next);
29
-            vote_sp_enum_assign.vote(prev, pc);
30
+            vote_sp_enum_before_assign.vote(prev, pc);
31
+            vote_sp_enum_after_assign.vote(pc, next);
32
          }
33
       }
34
       if (pc->type == CT_SQUARE_OPEN)
35
diff -Nru -x config.h uncrustify-0.51/src/options.cpp uncrustify-0.51-beforeafter/src/options.cpp
36
--- uncrustify-0.51/src/options.cpp	2008-11-27 07:49:18.000000000 -0800
37
+++ uncrustify-0.51-beforeafter/src/options.cpp	2008-12-06 17:30:00.000000000 -0800
38
@@ -133,10 +133,14 @@
39
    unc_begin_group(UG_space, "Spacing options");
40
    unc_add_option("sp_arith", UO_sp_arith, AT_IARF,
41
                   "Add or remove space around arithmetic operator '+', '-', '/', '*', etc");
42
-   unc_add_option("sp_assign", UO_sp_assign, AT_IARF,
43
-                  "Add or remove space around assignment operator '=', '+=', etc");
44
-   unc_add_option("sp_enum_assign", UO_sp_enum_assign, AT_IARF,
45
-                  "Add or remove space around assignment '=' in enum");
46
+   unc_add_option("sp_before_assign", UO_sp_before_assign, AT_IARF,
47
+                  "Add or remove space before assignment operator '=', '+=', etc");
48
+   unc_add_option("sp_after_assign", UO_sp_after_assign, AT_IARF,
49
+                  "Add or remove space after assignment operator '=', '+=', etc");
50
+   unc_add_option("sp_enum_before_assign", UO_sp_enum_before_assign, AT_IARF,
51
+                  "Add or remove space before assignment '=' in enum");
52
+   unc_add_option("sp_enum_after_assign", UO_sp_enum_after_assign, AT_IARF,
53
+                  "Add or remove space after assignment '=' in enum");
54
    unc_add_option("sp_bool", UO_sp_bool, AT_IARF,
55
                   "Add or remove space around boolean operators '&&' and '||'");
56
    unc_add_option("sp_compare", UO_sp_compare, AT_IARF,
57
diff -Nru -x config.h uncrustify-0.51/src/options.h uncrustify-0.51-beforeafter/src/options.h
58
--- uncrustify-0.51/src/options.h	2008-11-27 07:49:18.000000000 -0800
59
+++ uncrustify-0.51-beforeafter/src/options.h	2008-12-06 17:28:30.000000000 -0800
60
@@ -207,9 +207,10 @@
61
    UO_sp_arith,                 // space around + - / * etc
62
    UO_sp_bool,                  // space around || &&
63
    UO_sp_compare,               // space around < > ==, etc
64
-   UO_sp_assign,                // space around =, +=, etc
65
-   UO_sp_enum_assign,           // space around = in enum
66
-
67
+   UO_sp_before_assign,         // space before =, +=, etc
68
+   UO_sp_enum_before_assign,    // space before = in enum
69
+   UO_sp_after_assign,          // space after =, +=, etc
70
+   UO_sp_enum_after_assign,     // space after = in enum
71
    UO_sp_after_class_colon,     // space after class ':'
72
    UO_sp_before_class_colon,    // space before class ':'
73
    UO_sp_before_case_colon,
74
diff -Nru -x config.h uncrustify-0.51/src/space.cpp uncrustify-0.51-beforeafter/src/space.cpp
75
--- uncrustify-0.51/src/space.cpp	2008-11-26 11:35:54.000000000 -0800
76
+++ uncrustify-0.51-beforeafter/src/space.cpp	2008-12-06 17:24:12.000000000 -0800
77
@@ -333,15 +333,26 @@
78
       return(cpd.settings[UO_sp_before_sparen].a);
79
    }
80
 
81
-   if ((first->type == CT_ASSIGN) || (second->type == CT_ASSIGN))
82
+   if (second->type == CT_ASSIGN)
83
+   {
84
+      if (second->flags & PCF_IN_ENUM)
85
+      {
86
+         log_rule("sp_enum_before_assign");
87
+         return(cpd.settings[UO_sp_enum_before_assign].a);
88
+      }
89
+      log_rule("sp_before_assign");
90
+      return(cpd.settings[UO_sp_before_assign].a);
91
+   }
92
+
93
+   if (first->type == CT_ASSIGN)
94
    {
95
       if (first->flags & PCF_IN_ENUM)
96
       {
97
-         log_rule("sp_enum_assign");
98
-         return(cpd.settings[UO_sp_enum_assign].a);
99
+         log_rule("sp_enum_after_assign");
100
+         return(cpd.settings[UO_sp_enum_after_assign].a);
101
       }
102
-      log_rule("sp_assign");
103
-      return(cpd.settings[UO_sp_assign].a);
104
+      log_rule("sp_after_assign");
105
+      return(cpd.settings[UO_sp_after_assign].a);
106
    }
107
 
108
    /* "a [x]" vs "a[x]" */