summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 21:08:58 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 21:08:58 +0000
commit78648ae56087d1cdb9da03216bc41ad90e57fecf (patch)
treef5ed069ccb64a0c2d14d0a2f8053a89a8689dcf8 /base
parent478c23229ae77048c90e0a6f74ad503ad240fe23 (diff)
downloadchromium_src-78648ae56087d1cdb9da03216bc41ad90e57fecf.zip
chromium_src-78648ae56087d1cdb9da03216bc41ad90e57fecf.tar.gz
chromium_src-78648ae56087d1cdb9da03216bc41ad90e57fecf.tar.bz2
Allow clean compilation of dmg_fp under g++ -Wall.
We build dmg_fp as part of libbase, which mostly contains our own code. As such, we want to build libbase with -Wall -Werror or equivalent. Since the gyp model does not allow per-file compilation settings, we can't do this without modifying dmg_fp or building it into its own library with its own settings. The former seems less invasive. The following gcc warnings are fixed by this patch: - suggest parentheses around assignment used as truth value - deprecated conversion from string constant to 'char*' - comparison between signed and unsigned integer expressions - label 'something' defined but not used - 'whatever' may be used uninitialized in this function Review URL: http://codereview.chromium.org/21093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/third_party/dmg_fp/README.chromium2
-rw-r--r--base/third_party/dmg_fp/dtoa.cc44
-rw-r--r--base/third_party/dmg_fp/g_fmt.cc10
-rw-r--r--base/third_party/dmg_fp/gcc_warnings.patch232
4 files changed, 263 insertions, 25 deletions
diff --git a/base/third_party/dmg_fp/README.chromium b/base/third_party/dmg_fp/README.chromium
index c024f20..c57333b 100644
--- a/base/third_party/dmg_fp/README.chromium
+++ b/base/third_party/dmg_fp/README.chromium
@@ -10,3 +10,5 @@ List of changes made to original code:
- renamed .c files to .cc
- added dmg_fp.h header
- added #define IEEE_8087 to dtoa.cc
+ - made some minor changes to allow clean compilation under g++ -Wall, see
+ gcc_warnings.patch.
diff --git a/base/third_party/dmg_fp/dtoa.cc b/base/third_party/dmg_fp/dtoa.cc
index 4f9f4fe..e409d4a 100644
--- a/base/third_party/dmg_fp/dtoa.cc
+++ b/base/third_party/dmg_fp/dtoa.cc
@@ -515,7 +515,7 @@ Balloc
#endif
ACQUIRE_DTOA_LOCK(0);
- if (rv = freelist[k]) {
+ if ((rv = freelist[k])) {
freelist[k] = rv->next;
}
else {
@@ -794,7 +794,7 @@ mult
xc0 = c->x;
#ifdef ULLong
for(; xb < xbe; xc0++) {
- if (y = *xb++) {
+ if ((y = *xb++)) {
x = xa;
xc = xc0;
carry = 0;
@@ -876,7 +876,7 @@ pow5mult
int i;
static int p05[3] = { 5, 25, 125 };
- if (i = k & 3)
+ if ((i = k & 3))
b = multadd(b, p05[i-1], 0);
if (!(k >>= 2))
@@ -957,7 +957,7 @@ lshift
z = *x++ >> k1;
}
while(x < xe);
- if (*x1 = z)
+ if ((*x1 = z))
++n1;
}
#else
@@ -1259,12 +1259,12 @@ d2b
z |= Exp_msk11;
#endif
#else
- if (de = (int)(d0 >> Exp_shift))
+ if ((de = (int)(d0 >> Exp_shift)))
z |= Exp_msk1;
#endif
#ifdef Pack_32
- if (y = d1) {
- if (k = lo0bits(&y)) {
+ if ((y = d1)) {
+ if ((k = lo0bits(&y))) {
x[0] = y | z << 32 - k;
z >>= k;
}
@@ -1452,13 +1452,13 @@ match
#ifdef KR_headers
(sp, t) char **sp, *t;
#else
- (CONST char **sp, char *t)
+ (CONST char **sp, CONST char *t)
#endif
{
int c, d;
CONST char *s = *sp;
- while(d = *t++) {
+ while((d = *t++)) {
if ((c = *++s) >= 'A' && c <= 'Z')
c += 'a' - 'A';
if (c != d)
@@ -1490,7 +1490,7 @@ hexnan
++s;
if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
s += 2;
- while(c = *(CONST unsigned char*)++s) {
+ while((c = *(CONST unsigned char*)++s)) {
if (c >= '0' && c <= '9')
c -= '0';
else if (c >= 'a' && c <= 'f')
@@ -1518,7 +1518,7 @@ hexnan
*sp = s + 1;
break;
}
- } while(c = *++s);
+ } while((c = *++s));
break;
}
#endif
@@ -1852,7 +1852,7 @@ strtod
/* Get starting approximation = rv * 10**e1 */
if (e1 > 0) {
- if (i = e1 & 15)
+ if ((i = e1 & 15))
dval(rv) *= tens[i];
if (e1 &= ~15) {
if (e1 > DBL_MAX_10_EXP) {
@@ -1912,7 +1912,7 @@ strtod
}
else if (e1 < 0) {
e1 = -e1;
- if (i = e1 & 15)
+ if ((i = e1 & 15))
dval(rv) /= tens[i];
if (e1 >>= 4) {
if (e1 >= 1 << n_bigtens)
@@ -2580,7 +2580,7 @@ rv_alloc(int i)
j = sizeof(ULong);
for(k = 0;
- sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
+ sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
j <<= 1)
k++;
r = (int*)Balloc(k);
@@ -2596,13 +2596,13 @@ rv_alloc(int i)
#ifdef KR_headers
nrv_alloc(s, rve, n) char *s, **rve; int n;
#else
-nrv_alloc(char *s, char **rve, int n)
+nrv_alloc(CONST char *s, char **rve, int n)
#endif
{
char *rv, *t;
t = rv = rv_alloc(n);
- while(*t = *s++) t++;
+ while((*t = *s++)) t++;
if (rve)
*rve = t;
return rv;
@@ -2707,7 +2707,7 @@ dtoa
to hold the suppressed trailing zeros.
*/
- int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
+ int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
spec_case, try_quick;
Long L;
@@ -2792,7 +2792,7 @@ dtoa
#ifdef Sudden_Underflow
i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
#else
- if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) {
+ if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
#endif
dval(d2) = dval(d);
word0(d2) &= Frac_mask1;
@@ -2946,7 +2946,7 @@ dtoa
}
dval(d) /= ds;
}
- else if (j1 = -k) {
+ else if ((j1 = -k)) {
dval(d) *= tens[j1 & 0xf];
for(j = j1 >> 4; j; j >>= 1, i++)
if (j & 1) {
@@ -3107,7 +3107,7 @@ dtoa
Bfree(b);
b = b1;
}
- if (j = b5 - m5)
+ if ((j = b5 - m5))
b = pow5mult(b, j);
}
else
@@ -3145,7 +3145,7 @@ dtoa
* can do shifts and ors to compute the numerator for q.
*/
#ifdef Pack_32
- if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)
+ if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
i = 32 - i;
#else
if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
@@ -3322,7 +3322,9 @@ dtoa
++*s++;
}
else {
+#ifdef Honor_FLT_ROUNDS
trimzeros:
+#endif
while(*--s == '0');
s++;
}
diff --git a/base/third_party/dmg_fp/g_fmt.cc b/base/third_party/dmg_fp/g_fmt.cc
index c746ca6..7f3c881 100644
--- a/base/third_party/dmg_fp/g_fmt.cc
+++ b/base/third_party/dmg_fp/g_fmt.cc
@@ -46,14 +46,14 @@ g_fmt(register char *b, double x)
if (sign)
*b++ = '-';
if (decpt == 9999) /* Infinity or Nan */ {
- while(*b++ = *s++);
+ while((*b++ = *s++));
goto done0;
}
if (decpt <= -4 || decpt > se - s + 5) {
*b++ = *s++;
if (*s) {
*b++ = '.';
- while(*b = *s++)
+ while((*b = *s++))
b++;
}
*b++ = 'e';
@@ -79,10 +79,10 @@ g_fmt(register char *b, double x)
*b++ = '.';
for(; decpt < 0; decpt++)
*b++ = '0';
- while(*b++ = *s++);
+ while((*b++ = *s++));
}
else {
- while(*b = *s++) {
+ while((*b = *s++)) {
b++;
if (--decpt == 0 && *s)
*b++ = '.';
@@ -93,7 +93,9 @@ g_fmt(register char *b, double x)
}
done0:
freedtoa(s0);
+#ifdef IGNORE_ZERO_SIGN
done:
+#endif
return b0;
}
diff --git a/base/third_party/dmg_fp/gcc_warnings.patch b/base/third_party/dmg_fp/gcc_warnings.patch
new file mode 100644
index 0000000..1a021d0
--- /dev/null
+++ b/base/third_party/dmg_fp/gcc_warnings.patch
@@ -0,0 +1,232 @@
+Index: dtoa.cc
+===================================================================
+--- dtoa.cc (revision 9233)
++++ dtoa.cc (working copy)
+@@ -515,7 +515,7 @@
+ #endif
+
+ ACQUIRE_DTOA_LOCK(0);
+- if (rv = freelist[k]) {
++ if ((rv = freelist[k])) {
+ freelist[k] = rv->next;
+ }
+ else {
+@@ -794,7 +794,7 @@
+ xc0 = c->x;
+ #ifdef ULLong
+ for(; xb < xbe; xc0++) {
+- if (y = *xb++) {
++ if ((y = *xb++)) {
+ x = xa;
+ xc = xc0;
+ carry = 0;
+@@ -876,7 +876,7 @@
+ int i;
+ static int p05[3] = { 5, 25, 125 };
+
+- if (i = k & 3)
++ if ((i = k & 3))
+ b = multadd(b, p05[i-1], 0);
+
+ if (!(k >>= 2))
+@@ -957,7 +957,7 @@
+ z = *x++ >> k1;
+ }
+ while(x < xe);
+- if (*x1 = z)
++ if ((*x1 = z))
+ ++n1;
+ }
+ #else
+@@ -1259,12 +1259,12 @@
+ z |= Exp_msk11;
+ #endif
+ #else
+- if (de = (int)(d0 >> Exp_shift))
++ if ((de = (int)(d0 >> Exp_shift)))
+ z |= Exp_msk1;
+ #endif
+ #ifdef Pack_32
+- if (y = d1) {
+- if (k = lo0bits(&y)) {
++ if ((y = d1)) {
++ if ((k = lo0bits(&y))) {
+ x[0] = y | z << 32 - k;
+ z >>= k;
+ }
+@@ -1452,13 +1452,13 @@
+ #ifdef KR_headers
+ (sp, t) char **sp, *t;
+ #else
+- (CONST char **sp, char *t)
++ (CONST char **sp, CONST char *t)
+ #endif
+ {
+ int c, d;
+ CONST char *s = *sp;
+
+- while(d = *t++) {
++ while((d = *t++)) {
+ if ((c = *++s) >= 'A' && c <= 'Z')
+ c += 'a' - 'A';
+ if (c != d)
+@@ -1490,7 +1490,7 @@
+ ++s;
+ if (s[1] == '0' && (s[2] == 'x' || s[2] == 'X'))
+ s += 2;
+- while(c = *(CONST unsigned char*)++s) {
++ while((c = *(CONST unsigned char*)++s)) {
+ if (c >= '0' && c <= '9')
+ c -= '0';
+ else if (c >= 'a' && c <= 'f')
+@@ -1518,7 +1518,7 @@
+ *sp = s + 1;
+ break;
+ }
+- } while(c = *++s);
++ } while((c = *++s));
+ break;
+ }
+ #endif
+@@ -1852,7 +1852,7 @@
+ /* Get starting approximation = rv * 10**e1 */
+
+ if (e1 > 0) {
+- if (i = e1 & 15)
++ if ((i = e1 & 15))
+ dval(rv) *= tens[i];
+ if (e1 &= ~15) {
+ if (e1 > DBL_MAX_10_EXP) {
+@@ -1912,7 +1912,7 @@
+ }
+ else if (e1 < 0) {
+ e1 = -e1;
+- if (i = e1 & 15)
++ if ((i = e1 & 15))
+ dval(rv) /= tens[i];
+ if (e1 >>= 4) {
+ if (e1 >= 1 << n_bigtens)
+@@ -2580,7 +2580,7 @@
+
+ j = sizeof(ULong);
+ for(k = 0;
+- sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= i;
++ sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (size_t)i;
+ j <<= 1)
+ k++;
+ r = (int*)Balloc(k);
+@@ -2596,13 +2596,13 @@
+ #ifdef KR_headers
+ nrv_alloc(s, rve, n) char *s, **rve; int n;
+ #else
+-nrv_alloc(char *s, char **rve, int n)
++nrv_alloc(CONST char *s, char **rve, int n)
+ #endif
+ {
+ char *rv, *t;
+
+ t = rv = rv_alloc(n);
+- while(*t = *s++) t++;
++ while((*t = *s++)) t++;
+ if (rve)
+ *rve = t;
+ return rv;
+@@ -2707,7 +2707,7 @@
+ to hold the suppressed trailing zeros.
+ */
+
+- int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
++ int bbits, b2, b5, be, dig, i, ieps, ilim = 0, ilim0, ilim1 = 0,
+ j, j1, k, k0, k_check, leftright, m2, m5, s2, s5,
+ spec_case, try_quick;
+ Long L;
+@@ -2792,7 +2792,7 @@
+ #ifdef Sudden_Underflow
+ i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
+ #else
+- if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) {
++ if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
+ #endif
+ dval(d2) = dval(d);
+ word0(d2) &= Frac_mask1;
+@@ -2946,7 +2946,7 @@
+ }
+ dval(d) /= ds;
+ }
+- else if (j1 = -k) {
++ else if ((j1 = -k)) {
+ dval(d) *= tens[j1 & 0xf];
+ for(j = j1 >> 4; j; j >>= 1, i++)
+ if (j & 1) {
+@@ -3107,7 +3107,7 @@
+ Bfree(b);
+ b = b1;
+ }
+- if (j = b5 - m5)
++ if ((j = b5 - m5))
+ b = pow5mult(b, j);
+ }
+ else
+@@ -3145,7 +3145,7 @@
+ * can do shifts and ors to compute the numerator for q.
+ */
+ #ifdef Pack_32
+- if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f)
++ if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
+ i = 32 - i;
+ #else
+ if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
+@@ -3322,7 +3322,9 @@
+ ++*s++;
+ }
+ else {
++#ifdef Honor_FLT_ROUNDS
+ trimzeros:
++#endif
+ while(*--s == '0');
+ s++;
+ }
+Index: g_fmt.cc
+===================================================================
+--- g_fmt.cc (revision 9233)
++++ g_fmt.cc (working copy)
+@@ -46,14 +46,14 @@
+ if (sign)
+ *b++ = '-';
+ if (decpt == 9999) /* Infinity or Nan */ {
+- while(*b++ = *s++);
++ while((*b++ = *s++));
+ goto done0;
+ }
+ if (decpt <= -4 || decpt > se - s + 5) {
+ *b++ = *s++;
+ if (*s) {
+ *b++ = '.';
+- while(*b = *s++)
++ while((*b = *s++))
+ b++;
+ }
+ *b++ = 'e';
+@@ -79,10 +79,10 @@
+ *b++ = '.';
+ for(; decpt < 0; decpt++)
+ *b++ = '0';
+- while(*b++ = *s++);
++ while((*b++ = *s++));
+ }
+ else {
+- while(*b = *s++) {
++ while((*b = *s++)) {
+ b++;
+ if (--decpt == 0 && *s)
+ *b++ = '.';
+@@ -93,7 +93,9 @@
+ }
+ done0:
+ freedtoa(s0);
++#ifdef IGNORE_ZERO_SIGN
+ done:
++#endif
+ return b0;
+ }
+