Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Side by Side Diff: base/third_party/dmg_fp/gcc_warnings.patch

Issue 99367: Re-land r15232 with a warnings fix: (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/third_party/dmg_fp/dtoa.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Index: dtoa.cc 1 Index: dtoa.cc
2 --- dtoa.cc (old copy) 2 --- dtoa.cc (old copy)
3 +++ dtoa.cc (working copy) 3 +++ dtoa.cc (working copy)
4 @@ -172,6 +172,10 @@ 4 @@ -179,6 +179,9 @@
5 *» used for input more than STRTOD_DIGLIM digits long (default 40).
5 */ 6 */
6 7
7 #define IEEE_8087 8 +#define IEEE_8087
8 +#if defined(__GNUC__) 9 +#define NO_HEX_FP
9 +// Make gcc 4.3+ warnings about parentheses non-fatal warnings. 10 +
10 +#pragma GCC diagnostic warning "-Wparentheses"
11 +#endif
12
13 #ifndef Long 11 #ifndef Long
14 #define Long long 12 #define Long long
15 @@ -515,7 +519,7 @@ Balloc 13 #endif
14 @@ -280,9 +283,7 @@
15 #include "math.h"
16 #endif 16 #endif
17 17
18 » ACQUIRE_DTOA_LOCK(0); 18 -#ifdef __cplusplus
19 -» if (rv = freelist[k]) { 19 -extern "C" {
20 +» if ((rv = freelist[k])) { 20 -#endif
21 » » freelist[k] = rv->next; 21 +namespace dmg_fp {
22 » » }
23 » else {
24 @@ -794,7 +798,7 @@ mult
25 » xc0 = c->x;
26 #ifdef ULLong
27 » for(; xb < xbe; xc0++) {
28 -» » if (y = *xb++) {
29 +» » if ((y = *xb++)) {
30 » » » x = xa;
31 » » » xc = xc0;
32 » » » carry = 0;
33 @@ -876,7 +880,7 @@ pow5mult
34 » int i;
35 » static int p05[3] = { 5, 25, 125 };
36 22
37 -» if (i = k & 3) 23 #ifndef CONST
38 +» if ((i = k & 3)) 24 #ifdef KR_headers
39 » » b = multadd(b, p05[i-1], 0); 25 @@ -511,11 +512,9 @@
40 26
41 » if (!(k >>= 2)) 27 #define Kmax 7
42 @@ -957,7 +961,7 @@ lshift 28
43 » » » z = *x++ >> k1; 29 -#ifdef __cplusplus
44 » » » } 30 -extern "C" double strtod(const char *s00, char **se);
45 » » » while(x < xe); 31 -extern "C" char *dtoa(double d, int mode, int ndigits,
46 -» » if (*x1 = z) 32 +double strtod(const char *s00, char **se);
47 +» » if ((*x1 = z)) 33 +char *dtoa(double d, int mode, int ndigits,
48 » » » ++n1; 34 » » » int *decpt, int *sign, char **rve);
49 » » } 35 -#endif
50 #else 36
51 @@ -1259,12 +1263,12 @@ d2b 37 struct
52 » z |= Exp_msk11; 38 Bigint {
53 #endif 39 @@ -1527,7 +1526,7 @@
54 #else
55 -» if (de = (int)(d0 >> Exp_shift))
56 +» if ((de = (int)(d0 >> Exp_shift)))
57 » » z |= Exp_msk1;
58 #endif
59 #ifdef Pack_32
60 -» if (y = d1) {
61 -» » if (k = lo0bits(&y)) {
62 +» if ((y = d1)) {
63 +» » if ((k = lo0bits(&y))) {
64 » » » x[0] = y | z << 32 - k;
65 » » » z >>= k;
66 » » » }
67 @@ -1452,13 +1456,13 @@ match
68 #ifdef KR_headers 40 #ifdef KR_headers
69 (sp, t) char **sp, *t; 41 (sp, t) char **sp, *t;
70 #else 42 #else
71 - (CONST char **sp, char *t) 43 - (CONST char **sp, char *t)
72 + (CONST char **sp, CONST char *t) 44 + (CONST char **sp, CONST char *t)
73 #endif 45 #endif
74 { 46 {
75 int c, d; 47 int c, d;
76 » CONST char *s = *sp; 48 @@ -2234,7 +2234,7 @@ bigcomp
77 49 » nd = bc->nd;
78 -» while(d = *t++) { 50 » nd0 = bc->nd0;
79 +» while((d = *t++)) { 51 » p5 = nd + bc->e0 - 1;
80 » » if ((c = *++s) >= 'A' && c <= 'Z') 52 -» speccase = 0;
81 » » » c += 'a' - 'A'; 53 +» dd = speccase = 0;
82 » » if (c != d) 54 #ifndef Sudden_Underflow
83 @@ -1490,7 +1494,7 @@ hexnan 55 » if (rv->d == 0.) {» /* special case: value near underflow-to-zero */
84 » » ++s; 56 » » » » /* threshold was rounded to zero */
85 » if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X')) 57 @@ -3431,7 +3430,7 @@
86 » » s += 2;
87 -» while(c = *(CONST unsigned char*)++s) {
88 +» while((c = *(CONST unsigned char*)++s)) {
89 » » if (c >= '0' && c <= '9')
90 » » » c -= '0';
91 » » else if (c >= 'a' && c <= 'f')
92 @@ -1518,7 +1522,7 @@ hexnan
93 » » » » » *sp = s + 1;
94 » » » » » break;
95 » » » » » }
96 -» » » » } while(c = *++s);
97 +» » » » } while((c = *++s));
98 » » » break;
99 » » » }
100 #endif
101 @@ -1852,7 +1856,7 @@ strtod
102 » /* Get starting approximation = rv * 10**e1 */
103
104 » if (e1 > 0) {
105 -» » if (i = e1 & 15)
106 +» » if ((i = e1 & 15))
107 » » » dval(rv) *= tens[i];
108 » » if (e1 &= ~15) {
109 » » » if (e1 > DBL_MAX_10_EXP) {
110 @@ -1912,7 +1916,7 @@ strtod
111 » » }
112 » else if (e1 < 0) {
113 » » e1 = -e1;
114 -» » if (i = e1 & 15)
115 +» » if ((i = e1 & 15))
116 » » » dval(rv) /= tens[i];
117 » » if (e1 >>= 4) {
118 » » » if (e1 >= 1 << n_bigtens)
119 @@ -2580,7 +2584,7 @@ rv_alloc(int i)
120 58
121 j = sizeof(ULong); 59 j = sizeof(ULong);
122 for(k = 0; 60 for(k = 0;
123 - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; 61 - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
124 + sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i; 62 + sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
125 j <<= 1) 63 j <<= 1)
126 k++; 64 k++;
127 r = (int*)Balloc(k); 65 r = (int*)Balloc(k);
128 @@ -2596,13 +2600,13 @@ rv_alloc(int i) 66 @@ -3447,7 +3446,7 @@
129 #ifdef KR_headers 67 #ifdef KR_headers
130 nrv_alloc(s, rve, n) char *s, **rve; int n; 68 nrv_alloc(s, rve, n) char *s, **rve; int n;
131 #else 69 #else
132 -nrv_alloc(char *s, char **rve, int n) 70 -nrv_alloc(char *s, char **rve, int n)
133 +nrv_alloc(CONST char *s, char **rve, int n) 71 +nrv_alloc(CONST char *s, char **rve, int n)
134 #endif 72 #endif
135 { 73 {
136 char *rv, *t; 74 char *rv, *t;
137 75 @@ -4202,6 +4201,5 @@
138 » t = rv = rv_alloc(n); 76 » » *rve = s;
139 -» while(*t = *s++) t++; 77 » return s0;
140 +» while((*t = *s++)) t++; 78 » }
141 » if (rve) 79 -#ifdef __cplusplus
142 » » *rve = t; 80 -}
143 » return rv; 81 -#endif
144 @@ -2707,7 +2711,7 @@ dtoa 82 +
145 » » to hold the suppressed trailing zeros. 83 +} // namespace dmg_fp
146 » */
147
148 -» int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
149 +» int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
150 » » j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
151 » » spec_case, try_quick;
152 » Long L;
153 @@ -2792,7 +2796,7 @@ dtoa
154 #ifdef Sudden_Underflow
155 » i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
156 #else
157 -» if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) {
158 +» if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
159 #endif
160 » » dval(d2) = dval(d);
161 » » word0(d2) &= Frac_mask1;
162 @@ -2946,7 +2950,7 @@ dtoa
163 » » » » » }
164 » » » dval(d) /= ds;
165 » » » }
166 -» » else if (j1 = -k) {
167 +» » else if ((j1 = -k)) {
168 » » » dval(d) *= tens[j1 & 0xf];
169 » » » for(j = j1 >> 4; j; j >>= 1, i++)
170 » » » » if (j & 1) {
171 @@ -3107,7 +3111,7 @@ dtoa
172 » » » » Bfree(b);
173 » » » » b = b1;
174 » » » » }
175 -» » » if (j = b5 - m5)
176 +» » » if ((j = b5 - m5))
177 » » » » b = pow5mult(b, j);
178 » » » }
179 » » else
180 @@ -3145,7 +3149,7 @@ dtoa
181 » * can do shifts and ors to compute the numerator for q.
182 » */
183 #ifdef Pack_32
184 -» if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)
185 +» if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
186 » » i = 32 - i;
187 #else
188 » if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
189 @@ -3322,7 +3326,9 @@ dtoa
190 » » ++*s++;
191 » » }
192 » else {
193 +#ifdef Honor_FLT_ROUNDS
194 trimzeros:
195 +#endif
196 » » while(*--s == '0');
197 » » s++;
198 » » }
199 Index: g_fmt.cc 84 Index: g_fmt.cc
200 --- g_fmt.cc (old copy) 85 --- g_fmt.cc (old copy)
201 +++ g_fmt.cc (new copy) 86 +++ g_fmt.cc (new copy)
202 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x) 87 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
203 if (sign) 88 if (sign)
204 *b++ = '-'; 89 *b++ = '-';
205 if (decpt == 9999) /* Infinity or Nan */ { 90 if (decpt == 9999) /* Infinity or Nan */ {
206 - while(*b++ = *s++); 91 - while(*b++ = *s++);
207 + while((*b++ = *s++)); 92 + while((*b++ = *s++));
208 goto done0; 93 goto done0;
(...skipping 23 matching lines...) Expand all
232 @@ -93,7 +93,9 @@ g_fmt(register char *b, double x) 117 @@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
233 } 118 }
234 done0: 119 done0:
235 freedtoa(s0); 120 freedtoa(s0);
236 +#ifdef IGNORE_ZERO_SIGN 121 +#ifdef IGNORE_ZERO_SIGN
237 done: 122 done:
238 +#endif 123 +#endif
239 return b0; 124 return b0;
240 } 125 }
241 126
OLDNEW
« no previous file with comments | « base/third_party/dmg_fp/dtoa.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698