fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
authorCraig Dowell <craigdo@ee.washington.edu>
Mon, 06 Aug 2007 14:40:43 -0700
changeset 1210 599a311daef6
parent 1209 7629e5cd8f5e
child 1211 f96d69ef6038
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
src/devices/csma-cd/csma-cd-net-device.cc
src/routing/global-routing/global-router-interface.h
--- a/src/devices/csma-cd/csma-cd-net-device.cc	Mon Aug 06 15:45:29 2007 +0200
+++ b/src/devices/csma-cd/csma-cd-net-device.cc	Mon Aug 06 14:40:43 2007 -0700
@@ -477,13 +477,15 @@
   // Only receive if send side of net device is enabled
   if (!IsReceiveEnabled())
     {
-      goto drop;
+      m_dropTrace (p);
+      return;
     }
 
   if (m_encapMode == RAW)
     {
       ForwardUp (packet, 0, GetBroadcast ());
-      goto drop;
+      m_dropTrace (p);
+      return;
     }
   p.RemoveTrailer(trailer);
   trailer.CheckFcs(p);
@@ -495,10 +497,15 @@
       (header.GetDestination() != destination))
     {
       // not for us.
-      goto drop;
+      m_dropTrace (p);
+      return;
     }
+//
+// protocol must be initialized to avoid a compiler warning in the RAW
+// case that breaks the optimized build.
+//
+  uint16_t protocol = 0;
 
-  uint16_t protocol;
   switch (m_encapMode)
     {
     case ETHERNET_V1:
@@ -518,8 +525,6 @@
   m_rxTrace (p);
   ForwardUp (p, protocol, header.GetSource ());
   return;
- drop:
-  m_dropTrace (p);
 }
 
 Ptr<Queue>
--- a/src/routing/global-routing/global-router-interface.h	Mon Aug 06 15:45:29 2007 +0200
+++ b/src/routing/global-routing/global-router-interface.h	Mon Aug 06 14:40:43 2007 -0700
@@ -550,7 +550,7 @@
  */
   bool GetLSA (uint32_t n, GlobalRouterLSA &lsa) const;
 
-protected:
+private:
   virtual ~GlobalRouter ();
   void ClearLSAs (void);
 
@@ -564,13 +564,14 @@
 
   Ipv4Address m_routerId;
 
-private:
   // inherited from Object
   virtual void DoDispose (void);
+
 /**
  * @brief Global Router copy construction is disallowed.
  */
   GlobalRouter (GlobalRouter& sr);
+
 /**
  * @brief Global Router assignment operator is disallowed.
  */