[Git][cmucl/cmucl][master] 2 commits: Remove unused variable "zero".

Raymond Toy rtoy at common-lisp.net
Sun Aug 30 20:36:29 UTC 2015


Raymond Toy pushed to branch master at cmucl / cmucl


Commits:
82821f30 by Raymond Toy at 2015-08-30T13:34:52Z
Remove unused variable "zero".

Gets rid of compiler warning too.

- - - - -
0e58a8f3 by Raymond Toy at 2015-08-30T13:36:10Z
Use enum names in switch statement and fix warning.

Instead of using random integers in the switch statement, use the
fdlibm enum values.

Also fix a compiler warning that ret might be used uninitialized.  Fix
this by adding a default case, which should never happen.

- - - - -


2 changed files:

- src/lisp/e_log10.c
- src/lisp/setexception.c


Changes:

=====================================
src/lisp/e_log10.c
=====================================
--- a/src/lisp/e_log10.c
+++ b/src/lisp/e_log10.c
@@ -56,8 +56,6 @@ ivln10     =  4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
 log10_2hi  =  3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
 log10_2lo  =  3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
 
-static double zero   =  0.0;
-
 #ifdef __STDC__
 	double __ieee754_log10(double x)
 #else


=====================================
src/lisp/setexception.c
=====================================
--- a/src/lisp/setexception.c
+++ b/src/lisp/setexception.c
@@ -46,7 +46,7 @@ fdlibm_setexception(double x, enum FDLIBM_EXCEPTION type)
     double ret;
     
     switch (type) {
-      case 0:
+      case FDLIBM_DIVIDE_BY_ZERO:
           /* Division by zero. Use the sign of x to get the correct
            *  signed infinity
            */
@@ -54,17 +54,17 @@ fdlibm_setexception(double x, enum FDLIBM_EXCEPTION type)
           
           ret = copysign(INFINITY, x);
           break;
-      case 1:
+      case FDLIBM_UNDERFLOW:
           /* Underflow. Use the sign of x to get a signed zero. */
           feraiseexcept(FE_UNDERFLOW);
           ret = copysign(0.0, x);
           break;
-      case 2:
+      case FDLIBM_OVERFLOW:
           /* overflow */
           feraiseexcept(FE_OVERFLOW);
           ret = copysign(INFINITY, x);
           break;
-      case 3:
+      case FDLIBM_INVALID:
       {
           /* invalid */
 
@@ -88,6 +88,10 @@ fdlibm_setexception(double x, enum FDLIBM_EXCEPTION type)
           
           break;
       }
+    default:
+      /* Shouldn't happen! */
+      ret = 0.0;
+      break;
     }
 
     return ret;



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/61adc721e2c97f930ccb8792d315a7b8a1957cd0...0e58a8f30111bc20059f4e69ddfb4ca4925833f6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20150830/08dff81c/attachment-0001.html>


More information about the cmucl-cvs mailing list