unreachable / unreferenced warnings patch

David Scott Page page at cs.utexas.edu
Thu May 2 20:21:44 EDT 2002


Hi,

A userlevel compile of click with KCC generates some warnings
about unreachable statements and variables declared and assigned but
never used.  In this patch, I tried to exclude any code warned about
only because a feature is not implemented in userlevel (e.g.,
IPRateMon). Also, the first patch arguably should not be applied because
of readability.

--
Scott Page

--------------------------------- 8< -----------------------------------
diff -Naur click-20020501/elements/ip/ipfilter.cc click-20020501a/elements/ip/ipfilter.cc
--- click-20020501/elements/ip/ipfilter.cc	Fri Feb  8 00:03:08 2002
+++ click-20020501a/elements/ip/ipfilter.cc	Thu May  2 22:37:27 2002
@@ -448,7 +448,6 @@
 	goto retry;
       } else
 	return errh->error("specify `proto', `port', `icmp type', or `ip len'");
-      break;
 
      case TYPE_NONE:
       if (_transp_proto != UNKNOWN)
diff -Naur click-20020501/elements/ip/ipratemon.cc click-20020501a/elements/ip/ipratemon.cc
--- click-20020501/elements/ip/ipratemon.cc	Fri Apr 26 18:34:56 2002
+++ click-20020501a/elements/ip/ipratemon.cc	Thu May  2 22:37:27 2002
@@ -226,10 +226,8 @@
 {
   click_chatter("\n----------------");
   click_chatter("_base = %p, _first: %p, _last = %p\n", _base, _first, _last);
-  Stats *prev_r = 0;
   for (Stats *r = _first; r; r = r->_next) {
     click_chatter("r = %p, r->_prev = %p, r->_next = %p", r, r->_prev, r->_next);
-    prev_r = r;
   }
 }
 
diff -Naur click-20020501/lib/userutils.cc click-20020501a/lib/userutils.cc
--- click-20020501/lib/userutils.cc	Wed Apr 24 16:39:23 2002
+++ click-20020501a/lib/userutils.cc	Thu May  2 22:37:47 2002
@@ -127,8 +127,6 @@
     } else
       return false;
   }
-
-  return (spos == slen && ppos == plen);
 }
 
 String
diff -Naur click-20020501/tools/click-pretty/click-pretty.cc click-20020501a/tools/click-pretty/click-pretty.cc
--- click-20020501/tools/click-pretty/click-pretty.cc	Sun Jan  6 01:43:19 2002
+++ click-20020501a/tools/click-pretty/click-pretty.cc	Thu May  2 22:22:09 2002
@@ -69,7 +69,6 @@
 static const char *program_name;
 static HashMap<String, String> definitions;
 static int specified_driver = -1;
-static const ElementMap *element_map;
 
 static const char *default_template = "\
 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n\
@@ -1029,7 +1028,6 @@
     emap.set_driver(driver);
     ProcessingT processing(r, &emap, errh);
 
-    element_map = &emap;
     ElementMap::push_default(&emap);
     
     // process template
@@ -1085,7 +1083,6 @@
     const char *router_file = 0;
     const char *output_file = 0;
     String html_template = default_template;
-    bool output = false;
     bool write_template = false;
 
     while (1) {
@@ -1158,7 +1155,6 @@
 		goto bad_option;
 	    }
 	    output_file = clp->arg;
-	    output = true;
 	    break;
 
 	  case USERLEVEL_OPT:





More information about the click mailing list