gcc_warnings.patch 2.47 KB
Newer Older
gejun's avatar
gejun committed
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
Index: dtoa.cc
--- dtoa.cc    (old copy)
+++ dtoa.cc    (working copy)
@@ -179,6 +179,9 @@
  *	used for input more than STRTOD_DIGLIM digits long (default 40).
  */
 
+#define IEEE_8087
+#define NO_HEX_FP
+
 #ifndef Long
 #define Long long
 #endif
@@ -280,9 +283,7 @@
 #include "math.h"
 #endif
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+namespace dmg_fp {
 
 #ifndef CONST
 #ifdef KR_headers
@@ -511,11 +512,9 @@
 
 #define Kmax 7
 
-#ifdef __cplusplus
-extern "C" double strtod(const char *s00, char **se);
-extern "C" char *dtoa(double d, int mode, int ndigits,
+double strtod(const char *s00, char **se);
+char *dtoa(double d, int mode, int ndigits,
 			int *decpt, int *sign, char **rve);
-#endif
 
  struct
 Bigint {
@@ -1527,7 +1526,7 @@
 #ifdef KR_headers
 	(sp, t) char **sp, *t;
 #else
-	(CONST char **sp, char *t)
+	(CONST char **sp, CONST char *t)
 #endif
 {
 	int c, d;
@@ -2234,7 +2234,7 @@ bigcomp
 	nd = bc->nd;
 	nd0 = bc->nd0;
 	p5 = nd + bc->e0 - 1;
-	speccase = 0;
+	dd = speccase = 0;
 #ifndef Sudden_Underflow
 	if (rv->d == 0.) {	/* special case: value near underflow-to-zero */
 				/* threshold was rounded to zero */
@@ -3431,7 +3430,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);
@@ -3447,7 +3446,7 @@
 #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;
@@ -4202,6 +4201,5 @@
 		*rve = s;
 	return s0;
 	}
-#ifdef __cplusplus
-}
-#endif
+
+}  // namespace dmg_fp
Index: g_fmt.cc
--- g_fmt.cc   (old copy)
+++ g_fmt.cc   (new copy)
@@ -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;
 	}