bug 245: build failure with gcc 4.3.x
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 02 Jul 2008 03:16:36 -0700
changeset 3365 6409d2460601
parent 3364 8e6ac6061680
child 3366 923e47a54fe8
bug 245: build failure with gcc 4.3.x
src/common/buffer.h
src/common/data-rate.cc
src/common/tag-list.cc
src/contrib/config-store.cc
src/core/callback.h
src/core/double.h
src/core/integer.h
src/core/uinteger.h
src/devices/wifi/status-code.h
src/devices/wifi/supported-rates.h
src/helper/internet-stack-helper.cc
src/helper/olsr-helper.h
src/internet-stack/sgi-hashmap.h
src/node/address.cc
src/node/mac48-address.cc
src/node/mac64-address.cc
src/node/socket.cc
src/routing/global-routing/global-route-manager-impl.cc
src/simulator/time.cc
utils/bench-packets.cc
utils/bench-simulator.cc
utils/replay-simulation.cc
--- a/src/common/buffer.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/common/buffer.h	Wed Jul 02 03:16:36 2008 -0700
@@ -536,6 +536,7 @@
 #ifdef BUFFER_USE_INLINE
 
 #include "ns3/assert.h"
+#include <string.h>
 
 namespace ns3 {
 
--- a/src/common/data-rate.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/common/data-rate.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -29,7 +29,10 @@
   std::string::size_type n = s.find_first_not_of("0123456789.");
   if (n != std::string::npos)
   { // Found non-numeric
-    double r = ::atof(s.substr(0, n).c_str());
+    std::istringstream iss;
+    iss.str (s.substr(0, n));
+    double r;
+    iss >> r;
     std::string trailer = s.substr(n, std::string::npos);
     if (trailer == "bps")
       {
@@ -117,7 +120,9 @@
       }
     return true;
   }
-  *v = ::atoll(s.c_str());
+  std::istringstream iss;
+  iss.str (s);
+  iss >> *v;
   return true;
 }
 
--- a/src/common/tag-list.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/common/tag-list.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -20,6 +20,7 @@
 #include "tag-list.h"
 #include "ns3/log.h"
 #include <vector>
+#include <string.h>
 
 NS_LOG_COMPONENT_DEFINE ("TagList");
 
--- a/src/contrib/config-store.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/contrib/config-store.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -8,6 +8,7 @@
 #include <fstream>
 #include <iostream>
 #include <unistd.h>
+#include <stdlib.h>
 
 NS_LOG_COMPONENT_DEFINE ("ConfigStore");
 
--- a/src/core/callback.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/core/callback.h	Wed Jul 02 03:16:36 2008 -0700
@@ -25,6 +25,7 @@
 #include "fatal-error.h"
 #include "empty.h"
 #include "type-traits.h"
+#include <typeinfo>
 
 namespace ns3 {
 
--- a/src/core/double.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/core/double.h	Wed Jul 02 03:16:36 2008 -0700
@@ -23,6 +23,7 @@
 #include "attribute.h"
 #include "attribute-helper.h"
 #include <stdint.h>
+#include <limits>
 
 namespace ns3 {
 
--- a/src/core/integer.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/core/integer.h	Wed Jul 02 03:16:36 2008 -0700
@@ -23,6 +23,7 @@
 #include "attribute.h"
 #include "attribute-helper.h"
 #include <stdint.h>
+#include <limits>
 
 namespace ns3 {
 
--- a/src/core/uinteger.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/core/uinteger.h	Wed Jul 02 03:16:36 2008 -0700
@@ -23,6 +23,7 @@
 #include "attribute.h"
 #include "attribute-helper.h"
 #include <stdint.h>
+#include <limits>
 
 namespace ns3 {
 
--- a/src/devices/wifi/status-code.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/devices/wifi/status-code.h	Wed Jul 02 03:16:36 2008 -0700
@@ -21,6 +21,7 @@
 #define STATUS_CODE_H
 
 #include <stdint.h>
+#include <ostream>
 #include "ns3/buffer.h"
 
 namespace ns3 {
--- a/src/devices/wifi/supported-rates.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/devices/wifi/supported-rates.h	Wed Jul 02 03:16:36 2008 -0700
@@ -21,6 +21,7 @@
 #define SUPPORTED_RATES_H
 
 #include <stdint.h>
+#include <ostream>
 #include "ns3/buffer.h"
 
 namespace ns3 {
--- a/src/helper/internet-stack-helper.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/helper/internet-stack-helper.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -26,6 +26,7 @@
 #include "ns3/packet-socket-factory.h"
 #include "ns3/config.h"
 #include "ns3/simulator.h"
+#include <limits>
 
 namespace ns3 {
 
--- a/src/helper/olsr-helper.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/helper/olsr-helper.h	Wed Jul 02 03:16:36 2008 -0700
@@ -39,7 +39,7 @@
    */
   void SetAgent (std::string tid,
 		 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
-		 std::string n1 = "", const AttributeValue &v2 = EmptyAttributeValue (),
+		 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
 		 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
 		 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
 		 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
--- a/src/internet-stack/sgi-hashmap.h	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/internet-stack/sgi-hashmap.h	Wed Jul 02 03:16:36 2008 -0700
@@ -20,8 +20,14 @@
 namespace sgi = ::__gnu_cxx;       // GCC 3.1 and later
        #endif
      #else  // gcc 4.x and later
+       #if __GNUC_MINOR__ < 3
        #include <ext/hash_map>
-       namespace sgi = ::__gnu_cxx;
+namespace sgi = ::__gnu_cxx;
+       #else
+#undef __DEPRECATED
+       #include <backward/hash_map>
+namespace sgi = ::__gnu_cxx;
+       #endif
      #endif
   #endif
 #else      // ...  there are other compilers, right?
--- a/src/node/address.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/node/address.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -1,5 +1,6 @@
 #include "ns3/assert.h"
 #include "address.h"
+#include <string.h>
 #include <iostream>
 #include <iomanip>
 
--- a/src/node/mac48-address.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/node/mac48-address.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -22,6 +22,7 @@
 #include "ns3/assert.h"
 #include <iomanip>
 #include <iostream>
+#include <string.h>
 
 namespace ns3 {
 
--- a/src/node/mac64-address.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/node/mac64-address.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -22,6 +22,7 @@
 #include "ns3/assert.h"
 #include <iomanip>
 #include <iostream>
+#include <string.h>
 
 namespace ns3 {
 
--- a/src/node/socket.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/node/socket.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -25,6 +25,7 @@
 #include "node.h"
 #include "socket.h"
 #include "socket-factory.h"
+#include <limits>
 
 NS_LOG_COMPONENT_DEFINE ("Socket");
 
--- a/src/routing/global-routing/global-route-manager-impl.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/routing/global-routing/global-route-manager-impl.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -1425,6 +1425,7 @@
 
 #include "ns3/test.h"
 #include "ns3/simulator.h"
+#include <stdlib.h> // for rand ()
 
 namespace ns3 {
 
--- a/src/simulator/time.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/src/simulator/time.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -72,7 +72,10 @@
   std::string::size_type n = s.find_first_not_of("0123456789.");
   if (n != std::string::npos)
   { // Found non-numeric
-    double r = atof(s.substr(0, n).c_str());
+    std::istringstream iss;
+    iss.str (s.substr(0, n));
+    double r;
+    iss >> r;
     std::string trailer = s.substr(n, std::string::npos);
     if (trailer == std::string("s"))
     {
@@ -113,7 +116,11 @@
   }
   //else
   //they didn't provide units, assume seconds
-  m_data = HighPrecision (atof(s.c_str()) * TimeStepPrecision::g_tsPrecFactor);
+  std::istringstream iss;
+  iss. str (s);
+  double v;
+  iss >> v;
+  m_data = HighPrecision (v * TimeStepPrecision::g_tsPrecFactor);
 }
 
 double 
--- a/utils/bench-packets.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/utils/bench-packets.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -23,6 +23,7 @@
 #include <iostream>
 #include <sstream>
 #include <string>
+#include <stdlib.h> // for exit ()
 
 using namespace ns3;
 
@@ -261,7 +262,9 @@
       if (strncmp ("--n=", argv[0],strlen ("--n=")) == 0) 
         {
           char const *nAscii = argv[0] + strlen ("--n=");
-          n = atoi (nAscii);
+          std::istringstream iss;
+          iss.str (nAscii);
+          iss >> n;
         }
       argc--;
       argv++;
--- a/utils/bench-simulator.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/utils/bench-simulator.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -23,6 +23,7 @@
 #include <iostream>
 #include <fstream>
 #include <vector>
+#include <string.h>
 
 using namespace ns3;
 
--- a/utils/replay-simulation.cc	Tue Jul 01 11:00:29 2008 -0700
+++ b/utils/replay-simulation.cc	Wed Jul 02 03:16:36 2008 -0700
@@ -24,6 +24,7 @@
 #include <deque>
 #include <fstream>
 #include <iostream>
+#include <string.h>
 
 using namespace ns3;