bug 245: build failure with gcc 4.3.x
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed Jul 02 03:16:36 2008 -0700 (19 months ago)
changeset 33656409d2460601
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
     1.1 --- a/src/common/buffer.h	Tue Jul 01 11:00:29 2008 -0700
     1.2 +++ b/src/common/buffer.h	Wed Jul 02 03:16:36 2008 -0700
     1.3 @@ -536,6 +536,7 @@
     1.4  #ifdef BUFFER_USE_INLINE
     1.5  
     1.6  #include "ns3/assert.h"
     1.7 +#include <string.h>
     1.8  
     1.9  namespace ns3 {
    1.10  
     2.1 --- a/src/common/data-rate.cc	Tue Jul 01 11:00:29 2008 -0700
     2.2 +++ b/src/common/data-rate.cc	Wed Jul 02 03:16:36 2008 -0700
     2.3 @@ -29,7 +29,10 @@
     2.4    std::string::size_type n = s.find_first_not_of("0123456789.");
     2.5    if (n != std::string::npos)
     2.6    { // Found non-numeric
     2.7 -    double r = ::atof(s.substr(0, n).c_str());
     2.8 +    std::istringstream iss;
     2.9 +    iss.str (s.substr(0, n));
    2.10 +    double r;
    2.11 +    iss >> r;
    2.12      std::string trailer = s.substr(n, std::string::npos);
    2.13      if (trailer == "bps")
    2.14        {
    2.15 @@ -117,7 +120,9 @@
    2.16        }
    2.17      return true;
    2.18    }
    2.19 -  *v = ::atoll(s.c_str());
    2.20 +  std::istringstream iss;
    2.21 +  iss.str (s);
    2.22 +  iss >> *v;
    2.23    return true;
    2.24  }
    2.25  
     3.1 --- a/src/common/tag-list.cc	Tue Jul 01 11:00:29 2008 -0700
     3.2 +++ b/src/common/tag-list.cc	Wed Jul 02 03:16:36 2008 -0700
     3.3 @@ -20,6 +20,7 @@
     3.4  #include "tag-list.h"
     3.5  #include "ns3/log.h"
     3.6  #include <vector>
     3.7 +#include <string.h>
     3.8  
     3.9  NS_LOG_COMPONENT_DEFINE ("TagList");
    3.10  
     4.1 --- a/src/contrib/config-store.cc	Tue Jul 01 11:00:29 2008 -0700
     4.2 +++ b/src/contrib/config-store.cc	Wed Jul 02 03:16:36 2008 -0700
     4.3 @@ -8,6 +8,7 @@
     4.4  #include <fstream>
     4.5  #include <iostream>
     4.6  #include <unistd.h>
     4.7 +#include <stdlib.h>
     4.8  
     4.9  NS_LOG_COMPONENT_DEFINE ("ConfigStore");
    4.10  
     5.1 --- a/src/core/callback.h	Tue Jul 01 11:00:29 2008 -0700
     5.2 +++ b/src/core/callback.h	Wed Jul 02 03:16:36 2008 -0700
     5.3 @@ -25,6 +25,7 @@
     5.4  #include "fatal-error.h"
     5.5  #include "empty.h"
     5.6  #include "type-traits.h"
     5.7 +#include <typeinfo>
     5.8  
     5.9  namespace ns3 {
    5.10  
     6.1 --- a/src/core/double.h	Tue Jul 01 11:00:29 2008 -0700
     6.2 +++ b/src/core/double.h	Wed Jul 02 03:16:36 2008 -0700
     6.3 @@ -23,6 +23,7 @@
     6.4  #include "attribute.h"
     6.5  #include "attribute-helper.h"
     6.6  #include <stdint.h>
     6.7 +#include <limits>
     6.8  
     6.9  namespace ns3 {
    6.10  
     7.1 --- a/src/core/integer.h	Tue Jul 01 11:00:29 2008 -0700
     7.2 +++ b/src/core/integer.h	Wed Jul 02 03:16:36 2008 -0700
     7.3 @@ -23,6 +23,7 @@
     7.4  #include "attribute.h"
     7.5  #include "attribute-helper.h"
     7.6  #include <stdint.h>
     7.7 +#include <limits>
     7.8  
     7.9  namespace ns3 {
    7.10  
     8.1 --- a/src/core/uinteger.h	Tue Jul 01 11:00:29 2008 -0700
     8.2 +++ b/src/core/uinteger.h	Wed Jul 02 03:16:36 2008 -0700
     8.3 @@ -23,6 +23,7 @@
     8.4  #include "attribute.h"
     8.5  #include "attribute-helper.h"
     8.6  #include <stdint.h>
     8.7 +#include <limits>
     8.8  
     8.9  namespace ns3 {
    8.10  
     9.1 --- a/src/devices/wifi/status-code.h	Tue Jul 01 11:00:29 2008 -0700
     9.2 +++ b/src/devices/wifi/status-code.h	Wed Jul 02 03:16:36 2008 -0700
     9.3 @@ -21,6 +21,7 @@
     9.4  #define STATUS_CODE_H
     9.5  
     9.6  #include <stdint.h>
     9.7 +#include <ostream>
     9.8  #include "ns3/buffer.h"
     9.9  
    9.10  namespace ns3 {
    10.1 --- a/src/devices/wifi/supported-rates.h	Tue Jul 01 11:00:29 2008 -0700
    10.2 +++ b/src/devices/wifi/supported-rates.h	Wed Jul 02 03:16:36 2008 -0700
    10.3 @@ -21,6 +21,7 @@
    10.4  #define SUPPORTED_RATES_H
    10.5  
    10.6  #include <stdint.h>
    10.7 +#include <ostream>
    10.8  #include "ns3/buffer.h"
    10.9  
   10.10  namespace ns3 {
    11.1 --- a/src/helper/internet-stack-helper.cc	Tue Jul 01 11:00:29 2008 -0700
    11.2 +++ b/src/helper/internet-stack-helper.cc	Wed Jul 02 03:16:36 2008 -0700
    11.3 @@ -26,6 +26,7 @@
    11.4  #include "ns3/packet-socket-factory.h"
    11.5  #include "ns3/config.h"
    11.6  #include "ns3/simulator.h"
    11.7 +#include <limits>
    11.8  
    11.9  namespace ns3 {
   11.10  
    12.1 --- a/src/helper/olsr-helper.h	Tue Jul 01 11:00:29 2008 -0700
    12.2 +++ b/src/helper/olsr-helper.h	Wed Jul 02 03:16:36 2008 -0700
    12.3 @@ -39,7 +39,7 @@
    12.4     */
    12.5    void SetAgent (std::string tid,
    12.6  		 std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (),
    12.7 -		 std::string n1 = "", const AttributeValue &v2 = EmptyAttributeValue (),
    12.8 +		 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
    12.9  		 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
   12.10  		 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
   12.11  		 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
    13.1 --- a/src/internet-stack/sgi-hashmap.h	Tue Jul 01 11:00:29 2008 -0700
    13.2 +++ b/src/internet-stack/sgi-hashmap.h	Wed Jul 02 03:16:36 2008 -0700
    13.3 @@ -20,8 +20,14 @@
    13.4  namespace sgi = ::__gnu_cxx;       // GCC 3.1 and later
    13.5         #endif
    13.6       #else  // gcc 4.x and later
    13.7 +       #if __GNUC_MINOR__ < 3
    13.8         #include <ext/hash_map>
    13.9 -       namespace sgi = ::__gnu_cxx;
   13.10 +namespace sgi = ::__gnu_cxx;
   13.11 +       #else
   13.12 +#undef __DEPRECATED
   13.13 +       #include <backward/hash_map>
   13.14 +namespace sgi = ::__gnu_cxx;
   13.15 +       #endif
   13.16       #endif
   13.17    #endif
   13.18  #else      // ...  there are other compilers, right?
    14.1 --- a/src/node/address.cc	Tue Jul 01 11:00:29 2008 -0700
    14.2 +++ b/src/node/address.cc	Wed Jul 02 03:16:36 2008 -0700
    14.3 @@ -1,5 +1,6 @@
    14.4  #include "ns3/assert.h"
    14.5  #include "address.h"
    14.6 +#include <string.h>
    14.7  #include <iostream>
    14.8  #include <iomanip>
    14.9  
    15.1 --- a/src/node/mac48-address.cc	Tue Jul 01 11:00:29 2008 -0700
    15.2 +++ b/src/node/mac48-address.cc	Wed Jul 02 03:16:36 2008 -0700
    15.3 @@ -22,6 +22,7 @@
    15.4  #include "ns3/assert.h"
    15.5  #include <iomanip>
    15.6  #include <iostream>
    15.7 +#include <string.h>
    15.8  
    15.9  namespace ns3 {
   15.10  
    16.1 --- a/src/node/mac64-address.cc	Tue Jul 01 11:00:29 2008 -0700
    16.2 +++ b/src/node/mac64-address.cc	Wed Jul 02 03:16:36 2008 -0700
    16.3 @@ -22,6 +22,7 @@
    16.4  #include "ns3/assert.h"
    16.5  #include <iomanip>
    16.6  #include <iostream>
    16.7 +#include <string.h>
    16.8  
    16.9  namespace ns3 {
   16.10  
    17.1 --- a/src/node/socket.cc	Tue Jul 01 11:00:29 2008 -0700
    17.2 +++ b/src/node/socket.cc	Wed Jul 02 03:16:36 2008 -0700
    17.3 @@ -25,6 +25,7 @@
    17.4  #include "node.h"
    17.5  #include "socket.h"
    17.6  #include "socket-factory.h"
    17.7 +#include <limits>
    17.8  
    17.9  NS_LOG_COMPONENT_DEFINE ("Socket");
   17.10  
    18.1 --- a/src/routing/global-routing/global-route-manager-impl.cc	Tue Jul 01 11:00:29 2008 -0700
    18.2 +++ b/src/routing/global-routing/global-route-manager-impl.cc	Wed Jul 02 03:16:36 2008 -0700
    18.3 @@ -1425,6 +1425,7 @@
    18.4  
    18.5  #include "ns3/test.h"
    18.6  #include "ns3/simulator.h"
    18.7 +#include <stdlib.h> // for rand ()
    18.8  
    18.9  namespace ns3 {
   18.10  
    19.1 --- a/src/simulator/time.cc	Tue Jul 01 11:00:29 2008 -0700
    19.2 +++ b/src/simulator/time.cc	Wed Jul 02 03:16:36 2008 -0700
    19.3 @@ -72,7 +72,10 @@
    19.4    std::string::size_type n = s.find_first_not_of("0123456789.");
    19.5    if (n != std::string::npos)
    19.6    { // Found non-numeric
    19.7 -    double r = atof(s.substr(0, n).c_str());
    19.8 +    std::istringstream iss;
    19.9 +    iss.str (s.substr(0, n));
   19.10 +    double r;
   19.11 +    iss >> r;
   19.12      std::string trailer = s.substr(n, std::string::npos);
   19.13      if (trailer == std::string("s"))
   19.14      {
   19.15 @@ -113,7 +116,11 @@
   19.16    }
   19.17    //else
   19.18    //they didn't provide units, assume seconds
   19.19 -  m_data = HighPrecision (atof(s.c_str()) * TimeStepPrecision::g_tsPrecFactor);
   19.20 +  std::istringstream iss;
   19.21 +  iss. str (s);
   19.22 +  double v;
   19.23 +  iss >> v;
   19.24 +  m_data = HighPrecision (v * TimeStepPrecision::g_tsPrecFactor);
   19.25  }
   19.26  
   19.27  double 
    20.1 --- a/utils/bench-packets.cc	Tue Jul 01 11:00:29 2008 -0700
    20.2 +++ b/utils/bench-packets.cc	Wed Jul 02 03:16:36 2008 -0700
    20.3 @@ -23,6 +23,7 @@
    20.4  #include <iostream>
    20.5  #include <sstream>
    20.6  #include <string>
    20.7 +#include <stdlib.h> // for exit ()
    20.8  
    20.9  using namespace ns3;
   20.10  
   20.11 @@ -261,7 +262,9 @@
   20.12        if (strncmp ("--n=", argv[0],strlen ("--n=")) == 0) 
   20.13          {
   20.14            char const *nAscii = argv[0] + strlen ("--n=");
   20.15 -          n = atoi (nAscii);
   20.16 +          std::istringstream iss;
   20.17 +          iss.str (nAscii);
   20.18 +          iss >> n;
   20.19          }
   20.20        argc--;
   20.21        argv++;
    21.1 --- a/utils/bench-simulator.cc	Tue Jul 01 11:00:29 2008 -0700
    21.2 +++ b/utils/bench-simulator.cc	Wed Jul 02 03:16:36 2008 -0700
    21.3 @@ -23,6 +23,7 @@
    21.4  #include <iostream>
    21.5  #include <fstream>
    21.6  #include <vector>
    21.7 +#include <string.h>
    21.8  
    21.9  using namespace ns3;
   21.10  
    22.1 --- a/utils/replay-simulation.cc	Tue Jul 01 11:00:29 2008 -0700
    22.2 +++ b/utils/replay-simulation.cc	Wed Jul 02 03:16:36 2008 -0700
    22.3 @@ -24,6 +24,7 @@
    22.4  #include <deque>
    22.5  #include <fstream>
    22.6  #include <iostream>
    22.7 +#include <string.h>
    22.8  
    22.9  using namespace ns3;
   22.10