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

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

Issue 99315: Merge latest changes from http://www.netlib.org/fp/dtoa.c into dtoa.cc (Closed)
Patch Set: define NO_HEX_FP 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 @@ -3431,7 +3430,7 @@
77
78 -» while(d = *t++) {
79 +» while((d = *t++)) {
80 » » if ((c = *++s) >= 'A' && c <= 'Z')
81 » » » c += 'a' - 'A';
82 » » if (c != d)
83 @@ -1490,7 +1494,7 @@ hexnan
84 » » ++s;
85 » if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
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 49
121 j = sizeof(ULong); 50 j = sizeof(ULong);
122 for(k = 0; 51 for(k = 0;
123 - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i; 52 - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
124 + sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i; 53 + sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
125 j <<= 1) 54 j <<= 1)
126 k++; 55 k++;
127 r = (int*)Balloc(k); 56 r = (int*)Balloc(k);
128 @@ -2596,13 +2600,13 @@ rv_alloc(int i) 57 @@ -3447,7 +3446,7 @@
129 #ifdef KR_headers 58 #ifdef KR_headers
130 nrv_alloc(s, rve, n) char *s, **rve; int n; 59 nrv_alloc(s, rve, n) char *s, **rve; int n;
131 #else 60 #else
132 -nrv_alloc(char *s, char **rve, int n) 61 -nrv_alloc(char *s, char **rve, int n)
133 +nrv_alloc(CONST char *s, char **rve, int n) 62 +nrv_alloc(CONST char *s, char **rve, int n)
134 #endif 63 #endif
135 { 64 {
136 char *rv, *t; 65 char *rv, *t;
137 66 @@ -4202,6 +4201,5 @@
138 » t = rv = rv_alloc(n); 67 » » *rve = s;
139 -» while(*t = *s++) t++; 68 » return s0;
140 +» while((*t = *s++)) t++; 69 » }
141 » if (rve) 70 -#ifdef __cplusplus
142 » » *rve = t; 71 -}
143 » return rv; 72 -#endif
144 @@ -2707,7 +2711,7 @@ dtoa 73 +
145 » » to hold the suppressed trailing zeros. 74 +} // 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 75 Index: g_fmt.cc
200 --- g_fmt.cc (old copy) 76 --- g_fmt.cc (old copy)
201 +++ g_fmt.cc (new copy) 77 +++ g_fmt.cc (new copy)
202 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x) 78 @@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
203 if (sign) 79 if (sign)
204 *b++ = '-'; 80 *b++ = '-';
205 if (decpt == 9999) /* Infinity or Nan */ { 81 if (decpt == 9999) /* Infinity or Nan */ {
206 - while(*b++ = *s++); 82 - while(*b++ = *s++);
207 + while((*b++ = *s++)); 83 + while((*b++ = *s++));
208 goto done0; 84 goto done0;
(...skipping 23 matching lines...) Expand all
232 @@ -93,7 +93,9 @@ g_fmt(register char *b, double x) 108 @@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
233 } 109 }
234 done0: 110 done0:
235 freedtoa(s0); 111 freedtoa(s0);
236 +#ifdef IGNORE_ZERO_SIGN 112 +#ifdef IGNORE_ZERO_SIGN
237 done: 113 done:
238 +#endif 114 +#endif
239 return b0; 115 return b0;
240 } 116 }
241 117
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