diff --git a/src/core/examples/hash-example.cc b/src/core/examples/hash-example.cc --- a/src/core/examples/hash-example.cc +++ b/src/core/examples/hash-example.cc @@ -359,7 +359,7 @@ // // Number of buckets = k = 2^bits long double k32 = 0xFFFFFFFF; - long double k64 = 0xFFFFFFFFFFFFFFFFULL; + long double k64 = static_cast (0xFFFFFFFFFFFFFFFFULL); long double n = m_nphrases; long double Ec32 = n * (n - 1) / ( 2 * k32) * (1 - (n - 2)/(3 * k32)); diff --git a/src/core/helper/random-variable-stream-helper.cc b/src/core/helper/random-variable-stream-helper.cc --- a/src/core/helper/random-variable-stream-helper.cc +++ b/src/core/helper/random-variable-stream-helper.cc @@ -39,8 +39,9 @@ NS_LOG_FUNCTION_NOARGS (); NS_ASSERT (stream >= 0); Config::MatchContainer mc = Config::LookupMatches (path); - int64_t i = 0; - for (Config::MatchContainer::Iterator mci = mc.Begin (); mci != mc.End (); ++mci, ++i) + + std::size_t i = 0; + for ( ; i < mc.GetN (); ++i) { PointerValue ptr = mc.Get (i); Ptr rvs = ptr.Get (); diff --git a/src/core/model/attribute-accessor-helper.h b/src/core/model/attribute-accessor-helper.h --- a/src/core/model/attribute-accessor-helper.h +++ b/src/core/model/attribute-accessor-helper.h @@ -21,6 +21,7 @@ #define ATTRIBUTE_ACCESSOR_HELPER_H #include "attribute.h" +#include "unused.h" /** * \file @@ -325,6 +326,8 @@ {} private: virtual bool DoSet (T *object, const V *v) const { + NS_UNUSED (object); + NS_UNUSED (v); return false; } virtual bool DoGet (const T *object, V *v) const { @@ -385,6 +388,8 @@ return true; } virtual bool DoGet (const T *object, V *v) const { + NS_UNUSED (object); + NS_UNUSED (v); return false; } virtual bool HasGetter (void) const { diff --git a/src/core/model/cairo-wideint.c b/src/core/model/cairo-wideint.c --- a/src/core/model/cairo-wideint.c +++ b/src/core/model/cairo-wideint.c @@ -27,6 +27,8 @@ * * Contributor(s): * Keith R. Packard + * + * Code changes from for ns-3 from upstream are marked with `//PDB' */ #include "cairo-wideint-private.h" @@ -311,11 +313,11 @@ den = _cairo_int64_negate (den); uqr = _cairo_uint64_divrem (num, den); if (num_neg) - qr.rem = _cairo_int64_negate (uqr.rem); + qr.rem = _cairo_int64_negate ((cairo_int64_t)uqr.rem); //PDB else qr.rem = uqr.rem; if (num_neg != den_neg) - qr.quo = (cairo_int64_t) _cairo_int64_negate (uqr.quo); + qr.quo = (cairo_int64_t) _cairo_int64_negate ((cairo_int64_t)uqr.quo); else qr.quo = (cairo_int64_t) uqr.quo; return qr; @@ -689,7 +691,7 @@ cairo_uint64_t x = _cairo_uint128_to_uint64 (_cairo_uint128_rsl(num, 32)); /* Initialise the result to indicate overflow. */ - result.quo = _cairo_uint32s_to_uint64 (-1U, -1U); + result.quo = _cairo_uint32s_to_uint64 (UINT_MAX, UINT_MAX); //PDB result.rem = den; /* Don't bother if the quotient is going to overflow. */ @@ -756,7 +758,7 @@ /* Add the main term's contribution to quotient. Note B-v = * -v as an uint32 (unless v = 0) */ if (v) - quorem = _cairo_uint64_divrem (_cairo_uint32x32_64_mul (q, -v), den); + quorem = _cairo_uint64_divrem (_cairo_uint32x32_64_mul (q, -(int32_t)v), den); //PDB else quorem = _cairo_uint64_divrem (_cairo_uint32s_to_uint64 (q, 0), den); quotient += _cairo_uint64_to_uint32 (quorem.quo); @@ -805,17 +807,17 @@ uqr = _cairo_uint_96by64_32x64_divrem (num, nonneg_den); if (_cairo_uint64_eq (uqr.rem, _cairo_int64_to_uint64 (nonneg_den))) { /* bail on overflow. */ - qr.quo = _cairo_uint32s_to_uint64 (0x7FFFFFFF, -1U);; + qr.quo = _cairo_uint32s_to_uint64 (0x7FFFFFFF, UINT_MAX); //PDB qr.rem = den; return qr; } if (num_neg) - qr.rem = _cairo_int64_negate (uqr.rem); + qr.rem = _cairo_int64_negate ((cairo_int64_t)uqr.rem); //PDB else qr.rem = uqr.rem; if (num_neg != den_neg) - qr.quo = _cairo_int64_negate (uqr.quo); + qr.quo = _cairo_int64_negate ((cairo_int64_t)uqr.quo); //PDB else qr.quo = uqr.quo; return qr; diff --git a/src/core/model/calendar-scheduler.cc b/src/core/model/calendar-scheduler.cc --- a/src/core/model/calendar-scheduler.cc +++ b/src/core/model/calendar-scheduler.cc @@ -140,8 +140,8 @@ uint64_t bucketTop = m_bucketTop; Scheduler::Event minEvent; minEvent.impl = 0; - minEvent.key.m_ts = ~0; - minEvent.key.m_uid = ~0; + minEvent.key.m_ts = UINT64_MAX; + minEvent.key.m_uid = UINT32_MAX; minEvent.key.m_context = 0; do { @@ -274,7 +274,7 @@ } } -uint32_t +uint64_t CalendarScheduler::CalculateNewWidth (void) { NS_LOG_FUNCTION (this); @@ -354,7 +354,7 @@ return totalSeparation; } void -CalendarScheduler::DoResize (uint32_t newSize, uint32_t newWidth) +CalendarScheduler::DoResize (uint32_t newSize, uint64_t newWidth) { NS_LOG_FUNCTION (this << newSize << newWidth); @@ -378,7 +378,7 @@ NS_LOG_FUNCTION (this << newSize); // PrintInfo (); - uint32_t newWidth = CalculateNewWidth (); + uint64_t newWidth = CalculateNewWidth (); DoResize (newSize, newWidth); } diff --git a/src/core/model/calendar-scheduler.h b/src/core/model/calendar-scheduler.h --- a/src/core/model/calendar-scheduler.h +++ b/src/core/model/calendar-scheduler.h @@ -90,7 +90,7 @@ * * \returns The new width. */ - uint32_t CalculateNewWidth (void); + uint64_t CalculateNewWidth (void); /** * Initialize the calendar queue. * @@ -116,7 +116,7 @@ * \param [in] newSize The number of buckets. * \param [in] newWidth The size of the new buckets. */ - void DoResize (uint32_t newSize, uint32_t newWidth); + void DoResize (uint32_t newSize, uint64_t newWidth); /** * Remove the earliest event. * diff --git a/src/core/model/config.cc b/src/core/model/config.cc --- a/src/core/model/config.cc +++ b/src/core/model/config.cc @@ -65,14 +65,14 @@ NS_LOG_FUNCTION (this); return m_objects.end (); } -uint32_t +std::size_t MatchContainer::GetN (void) const { NS_LOG_FUNCTION (this); return m_objects.size (); } Ptr -MatchContainer::Get (uint32_t i) const +MatchContainer::Get (std::size_t i) const { NS_LOG_FUNCTION (this << i); return m_objects[i]; @@ -500,13 +500,13 @@ continue; } // attempt to cast to a pointer checker. - const PointerChecker *ptr = dynamic_cast (PeekPointer (info.checker)); - if (ptr != 0) + const PointerChecker *pChecker = dynamic_cast (PeekPointer (info.checker)); + if (pChecker != 0) { NS_LOG_DEBUG ("GetAttribute(ptr)="< obj); /** \copydoc Config::GetRootNamespaceObjectN() */ - uint32_t GetRootNamespaceObjectN (void) const; + std::size_t GetRootNamespaceObjectN (void) const; /** \copydoc Config::GetRootNamespaceObject() */ - Ptr GetRootNamespaceObject (uint32_t i) const; + Ptr GetRootNamespaceObject (std::size_t i) const; private: /** @@ -740,14 +740,14 @@ } } -uint32_t +std::size_t ConfigImpl::GetRootNamespaceObjectN (void) const { NS_LOG_FUNCTION (this); return m_roots.size (); } Ptr -ConfigImpl::GetRootNamespaceObject (uint32_t i) const +ConfigImpl::GetRootNamespaceObject (std::size_t i) const { NS_LOG_FUNCTION (this << i); return m_roots[i]; diff --git a/src/core/model/config.h b/src/core/model/config.h --- a/src/core/model/config.h +++ b/src/core/model/config.h @@ -176,12 +176,12 @@ /** * \returns The number of items in the container */ - uint32_t GetN (void) const; + std::size_t GetN (void) const; /** * \param [in] i Index of item to lookup ([0,n[) * \returns The item requested. */ - Ptr Get (uint32_t i) const; + Ptr Get (std::size_t i) const; /** * \param [in] i Index of item to lookup ([0,n[) * \returns The fully-qualified matching path associated diff --git a/src/core/model/hash-fnv.cc b/src/core/model/hash-fnv.cc --- a/src/core/model/hash-fnv.cc +++ b/src/core/model/hash-fnv.cc @@ -159,7 +159,7 @@ /** * 32 bit FNV-0 hash type */ -typedef u_int32_t Fnv32_t; +typedef uint32_t Fnv32_t; //PDB /** @@ -202,7 +202,7 @@ * 64 bit FNV-0 hash */ #if defined(HAVE_64BIT_LONG_LONG) -typedef u_int64_t Fnv64_t; +typedef uint64_t Fnv64_t; //PDB #else /* HAVE_64BIT_LONG_LONG */ typedef struct { u_int32_t w32[2]; /* w32[0] is low order, w32[1] is high order word */ diff --git a/src/core/model/hash-murmur3.cc b/src/core/model/hash-murmur3.cc --- a/src/core/model/hash-murmur3.cc +++ b/src/core/model/hash-murmur3.cc @@ -493,8 +493,8 @@ h1 += h2; h2 += h1; - ((uint32_t *)out)[0] = h1; - ((uint32_t *)out)[1] = h2; + ((uint32_t *)out)[0] = static_cast (h1); //PDB + ((uint32_t *)out)[1] = static_cast (h2); //PDB } @@ -521,7 +521,8 @@ { using namespace Murmur3Implementation; - MurmurHash3_x86_32_incr (buffer, size, m_hash32, (void *) & m_hash32); + MurmurHash3_x86_32_incr (buffer, static_cast (size), + m_hash32, (void *) & m_hash32); m_size32 += size; uint32_t hash; MurmurHash3_x86_32_fin (m_size32, m_hash32, (void *) & hash); @@ -533,7 +534,8 @@ Murmur3::GetHash64 (const char * buffer, const size_t size) { using namespace Murmur3Implementation; - MurmurHash3_x86_128_incr (buffer, size, + + MurmurHash3_x86_128_incr (buffer, static_cast (size), (uint32_t *)(void *)m_hash64, m_hash64); m_size64 += size; @@ -551,7 +553,7 @@ // Using uint32_t here avoids the bug, and continues to works with newer gcc. uint32_t hash[4]; - MurmurHash3_x86_128_fin (m_size64, + MurmurHash3_x86_128_fin (static_cast (m_size64), (uint32_t *)(void *)m_hash64, hash); uint64_t result = hash[1]; result = (result << 32) | hash[0]; @@ -563,7 +565,7 @@ { m_hash32 = (uint32_t)SEED; m_size32 = 0; - m_hash64[0] = m_hash64[1] = ((uint64_t)(SEED) << 32) + (uint64_t)SEED; + m_hash64[0] = m_hash64[1] = ((uint64_t)SEED << 32) | (uint32_t)SEED; m_size64 = 0; } diff --git a/src/core/model/hash-murmur3.h b/src/core/model/hash-murmur3.h --- a/src/core/model/hash-murmur3.h +++ b/src/core/model/hash-murmur3.h @@ -109,7 +109,7 @@ */ /**@{*/ uint32_t m_hash32; - uint32_t m_size32; + uint64_t m_size32; /**@}*/ /** murmur3 produces 128-bit hash and state; we use just the first 64-bits. */ diff --git a/src/core/model/heap-scheduler.cc b/src/core/model/heap-scheduler.cc --- a/src/core/model/heap-scheduler.cc +++ b/src/core/model/heap-scheduler.cc @@ -102,7 +102,7 @@ return (id == Root ()) ? true : false; } -uint32_t +std::size_t HeapScheduler::Last (void) const { NS_LOG_FUNCTION (this); diff --git a/src/core/model/heap-scheduler.h b/src/core/model/heap-scheduler.h --- a/src/core/model/heap-scheduler.h +++ b/src/core/model/heap-scheduler.h @@ -113,7 +113,7 @@ * Return the index of the last element. * \returns The last index. */ - uint32_t Last (void) const; + std::size_t Last (void) const; /** * Test if an index is the root. * diff --git a/src/core/model/int64x64-cairo.cc b/src/core/model/int64x64-cairo.cc --- a/src/core/model/int64x64-cairo.cc +++ b/src/core/model/int64x64-cairo.cc @@ -174,7 +174,7 @@ qr = _cairo_uint128_divrem (rem, den); // Add in the quotient as shift bits of the fraction - result = _cairo_uint128_lsl (result, shift); + result = _cairo_uint128_lsl (result, static_cast (shift)); result = _cairo_uint128_add (result, qr.quo); rem = qr.rem; digis += shift; @@ -184,7 +184,7 @@ if (digis < DIGITS) { shift = DIGITS - digis; - result = _cairo_uint128_lsl (result, shift); + result = _cairo_uint128_lsl (result, static_cast (shift)); } return result; diff --git a/src/core/model/int64x64-cairo.h b/src/core/model/int64x64-cairo.h --- a/src/core/model/int64x64-cairo.h +++ b/src/core/model/int64x64-cairo.h @@ -108,8 +108,8 @@ // TestSuite int64x64 const long double round = 0.5; flo = flo * HP_MAX_64 + round; - cairo_int64_t hi = fhi; - const cairo_uint64_t lo = flo; + cairo_int64_t hi = (cairo_int64_t)fhi; + const cairo_uint64_t lo = (cairo_uint64_t)flo; if (flo >= HP_MAX_64) { // conversion to uint64 rolled over @@ -197,12 +197,12 @@ { const bool negative = _cairo_int128_negative (_v); const cairo_int128_t value = negative ? _cairo_int128_negate (_v) : _v; - const long double fhi = value.hi; + const long double fhi = static_cast (value.hi); const long double flo = value.lo / HP_MAX_64; long double retval = fhi; retval += flo; retval = negative ? -retval : retval; - return retval; + return static_cast (retval); } /** * Get the integer portion. diff --git a/src/core/model/int64x64-double.h b/src/core/model/int64x64-double.h --- a/src/core/model/int64x64-double.h +++ b/src/core/model/int64x64-double.h @@ -99,13 +99,13 @@ inline int64x64_t (long int v) : _v (v) {} inline int64x64_t (long long int v) - : _v (v) {} + : _v (static_cast (v)) {} inline int64x64_t (unsigned int v) : _v (v) {} inline int64x64_t (unsigned long int v) : _v (v) {} inline int64x64_t (unsigned long long int v) - : _v (v) {} + : _v (static_cast (v)) {} /**@}*/ /** * Construct from explicit high and low values. @@ -116,7 +116,8 @@ explicit inline int64x64_t (int64_t hi, uint64_t lo) { const bool negative = hi < 0; - const long double fhi = negative ? -hi : hi; + const long double hild = static_cast (hi); + const long double fhi = negative ? -hild : hild; const long double flo = lo / HP_MAX_64; _v = negative ? - fhi : fhi; _v += flo; @@ -173,8 +174,8 @@ // TestSuite int64x64 const long double round = 0.5; flo = flo * HP_MAX_64 + round; - int64_t hi = fhi; - uint64_t lo = flo; + int64_t hi = static_cast (fhi); + uint64_t lo = static_cast (flo); if (flo >= HP_MAX_64) { // conversion to uint64 rolled over diff --git a/src/core/model/log.cc b/src/core/model/log.cc --- a/src/core/model/log.cc +++ b/src/core/model/log.cc @@ -680,4 +680,36 @@ return *this; } +template<> +ParameterLogger& +ParameterLogger::operator<< (const int8_t param) +{ + if (m_first) + { + m_os << static_cast (param); + m_first = false; + } + else + { + m_os << static_cast (param); + } + return *this; +} + +template<> +ParameterLogger& +ParameterLogger::operator<< (const uint8_t param) +{ + if (m_first) + { + m_os << static_cast (param); + m_first = false; + } + else + { + m_os << static_cast (param); + } + return *this; +} + } // namespace ns3 diff --git a/src/core/model/log.h b/src/core/model/log.h --- a/src/core/model/log.h +++ b/src/core/model/log.h @@ -511,6 +511,24 @@ ParameterLogger& ParameterLogger::operator<< (const char * param); +/** + * Specialization for int8_t. + * \param [in] param The function parameter. + * \return This ParameterLogger, so it's chainable. + */ +template<> +ParameterLogger& + ParameterLogger::operator<< (int8_t param); + +/** + * Specialization for uint8_t. + * \param [in] param The function parameter. + * \return This ParameterLogger, so it's chainable. + */ +template<> +ParameterLogger& + ParameterLogger::operator<< (uint8_t param); + } // namespace ns3 /**@}*/ // \ingroup logging diff --git a/src/core/model/nstime.h b/src/core/model/nstime.h --- a/src/core/model/nstime.h +++ b/src/core/model/nstime.h @@ -380,7 +380,7 @@ } inline double GetDouble (void) const { - return m_data; + return static_cast (m_data); } inline int64_t GetInteger (void) const { diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -140,10 +140,10 @@ if (equal != std::string::npos) { std::string name = tmp.substr (0, equal); - std::string value = tmp.substr (equal+1, tmp.size () - equal - 1); + std::string envval = tmp.substr (equal+1, tmp.size () - equal - 1); if (name == tid.GetAttributeFullName (i)) { - if (DoSet (info.accessor, info.checker, StringValue (value))) + if (DoSet (info.accessor, info.checker, StringValue (envval))) { NS_LOG_DEBUG ("construct \""<< tid.GetName ()<<"::"<< info.name <<"\" from env var"); diff --git a/src/core/model/object-map.h b/src/core/model/object-map.h --- a/src/core/model/object-map.h +++ b/src/core/model/object-map.h @@ -81,7 +81,7 @@ { struct MemberStdContainer : public ObjectPtrContainerAccessor { - virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const { + virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const { const T *obj = dynamic_cast (object); if (obj == 0) { @@ -90,7 +90,7 @@ *n = (obj->*m_memberVector).size (); return true; } - virtual Ptr DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const { + virtual Ptr DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const { const T *obj = static_cast (object); typename U::const_iterator begin = (obj->*m_memberVector).begin (); typename U::const_iterator end = (obj->*m_memberVector).end (); diff --git a/src/core/model/object-ptr-container.cc b/src/core/model/object-ptr-container.cc --- a/src/core/model/object-ptr-container.cc +++ b/src/core/model/object-ptr-container.cc @@ -47,14 +47,14 @@ NS_LOG_FUNCTION (this); return m_objects.end (); } -uint32_t +std::size_t ObjectPtrContainerValue::GetN (void) const { NS_LOG_FUNCTION (this); return m_objects.size (); } Ptr -ObjectPtrContainerValue::Get (uint32_t i) const +ObjectPtrContainerValue::Get (std::size_t i) const { NS_LOG_FUNCTION (this << i); Iterator it = m_objects.find (i); @@ -113,7 +113,7 @@ return false; } v->m_objects.clear (); - uint32_t n; + std::size_t n; bool ok = DoGetN (object, &n); if (!ok) { @@ -121,7 +121,7 @@ } for (uint32_t i = 0; i < n; i++) { - uint32_t index; + std::size_t index; Ptr o = DoGet (object, i, &index); v->m_objects.insert (std::pair > (index, o)); } diff --git a/src/core/model/object-ptr-container.h b/src/core/model/object-ptr-container.h --- a/src/core/model/object-ptr-container.h +++ b/src/core/model/object-ptr-container.h @@ -68,14 +68,14 @@ * * \returns The number of objects. */ - uint32_t GetN (void) const; + std::size_t GetN (void) const; /** * Get a specific Object. * * \param [in] i The index of the requested object. * \returns The requested object */ - Ptr Get (uint32_t i) const; + Ptr Get (std::size_t i) const; /** * Get a copy of this container. @@ -228,7 +228,7 @@ * \param [out] n The number of instances in the container. * \returns true if the value could be obtained successfully. */ - virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const = 0; + virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const = 0; /** * Get an instance from the container, identified by index. * @@ -237,7 +237,7 @@ * \param [out] index The index retrieved. * \returns The index requested. */ - virtual Ptr DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const = 0; + virtual Ptr DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const = 0; }; template @@ -247,16 +247,16 @@ { struct MemberGetters : public ObjectPtrContainerAccessor { - virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const { + virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const { const T *obj = dynamic_cast (object); if (obj == 0) { return false; } - *n = (obj->*m_getN)(); + *n = static_cast ((obj->*m_getN)()); return true; } - virtual Ptr DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const { + virtual Ptr DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const { const T *obj = static_cast (object); *index = i; return (obj->*m_get)(i); diff --git a/src/core/model/object-vector.h b/src/core/model/object-vector.h --- a/src/core/model/object-vector.h +++ b/src/core/model/object-vector.h @@ -82,7 +82,7 @@ { struct MemberStdContainer : public ObjectPtrContainerAccessor { - virtual bool DoGetN (const ObjectBase *object, uint32_t *n) const { + virtual bool DoGetN (const ObjectBase *object, std::size_t *n) const { const T *obj = dynamic_cast (object); if (obj == 0) { @@ -91,11 +91,11 @@ *n = (obj->*m_memberVector).size (); return true; } - virtual Ptr DoGet (const ObjectBase *object, uint32_t i, uint32_t *index) const { + virtual Ptr DoGet (const ObjectBase *object, std::size_t i, std::size_t *index) const { const T *obj = static_cast (object); typename U::const_iterator begin = (obj->*m_memberVector).begin (); typename U::const_iterator end = (obj->*m_memberVector).end (); - uint32_t k = 0; + std::size_t k = 0; for (typename U::const_iterator j = begin; j != end; j++, k++) { if (k == i) diff --git a/src/core/model/random-variable-stream.cc b/src/core/model/random-variable-stream.cc --- a/src/core/model/random-variable-stream.cc +++ b/src/core/model/random-variable-stream.cc @@ -1488,7 +1488,7 @@ } void -DeterministicRandomVariable::SetValueArray (double* values, uint64_t length) +DeterministicRandomVariable::SetValueArray (double* values, std::size_t length) { NS_LOG_FUNCTION (this << values << length); // Delete any values currently set. @@ -1503,7 +1503,7 @@ m_next = length; // Copy the values. - for (uint64_t i = 0; i < m_count; i++) + for (std::size_t i = 0; i < m_count; i++) { m_data[i] = values[i]; } diff --git a/src/core/model/random-variable-stream.h b/src/core/model/random-variable-stream.h --- a/src/core/model/random-variable-stream.h +++ b/src/core/model/random-variable-stream.h @@ -2381,7 +2381,7 @@ * Note that the values in the array are copied and stored * (deep-copy). */ - void SetValueArray (double* values, uint64_t length); + void SetValueArray (double* values, std::size_t length); /** * \brief Returns the next value in the sequence. @@ -2396,11 +2396,11 @@ virtual uint32_t GetInteger (void); private: - /** Position in the array of values. */ - uint64_t m_count; + /** Size of the array of values. */ + std::size_t m_count; /** Position of the next value in the array of values. */ - uint64_t m_next; + std::size_t m_next; /** Array of values to return in sequence. */ double* m_data; diff --git a/src/core/model/realtime-simulator-impl.cc b/src/core/model/realtime-simulator-impl.cc --- a/src/core/model/realtime-simulator-impl.cc +++ b/src/core/model/realtime-simulator-impl.cc @@ -373,7 +373,7 @@ tsJitter = m_currentTs - tsFinal; } - if (tsJitter > static_cast(m_hardLimit.GetTimeStep ())) + if (tsJitter > static_cast (m_hardLimit.GetTimeStep ())) { NS_FATAL_ERROR ("RealtimeSimulatorImpl::ProcessOneEvent (): " "Hard real-time limit exceeded (jitter = " << tsJitter << ")"); @@ -433,7 +433,7 @@ m_synchronizer->SetOrigin (m_currentTs); // Sleep until signalled - uint64_t tsNow; + uint64_t tsNow = 0; uint64_t tsDelay = 1000000000; // wait time of 1 second (in nanoseconds) while (!m_stop) diff --git a/src/core/model/rng-seed-manager.cc b/src/core/model/rng-seed-manager.cc --- a/src/core/model/rng-seed-manager.cc +++ b/src/core/model/rng-seed-manager.cc @@ -20,7 +20,7 @@ #include "rng-seed-manager.h" #include "global-value.h" #include "attribute-helper.h" -#include "integer.h" +#include "uinteger.h" #include "config.h" #include "log.h" @@ -51,8 +51,8 @@ */ static ns3::GlobalValue g_rngSeed ("RngSeed", "The global seed of all rng streams", - ns3::IntegerValue(1), - ns3::MakeIntegerChecker ()); + ns3::UintegerValue(1), + ns3::MakeUintegerChecker ()); /** * \relates RngSeedManager * The random number generator substream index. This is used to generate @@ -64,36 +64,36 @@ */ static ns3::GlobalValue g_rngRun ("RngRun", "The substream index used for all streams", - ns3::IntegerValue (1), - ns3::MakeIntegerChecker ()); + ns3::UintegerValue (1), + ns3::MakeUintegerChecker ()); uint32_t RngSeedManager::GetSeed (void) { NS_LOG_FUNCTION_NOARGS (); - IntegerValue seedValue; + UintegerValue seedValue; g_rngSeed.GetValue (seedValue); - return seedValue.Get (); + return static_cast (seedValue.Get ()); } void RngSeedManager::SetSeed (uint32_t seed) { NS_LOG_FUNCTION (seed); - Config::SetGlobal ("RngSeed", IntegerValue(seed)); + Config::SetGlobal ("RngSeed", UintegerValue(seed)); } void RngSeedManager::SetRun (uint64_t run) { NS_LOG_FUNCTION (run); - Config::SetGlobal ("RngRun", IntegerValue (run)); + Config::SetGlobal ("RngRun", UintegerValue (run)); } uint64_t RngSeedManager::GetRun () { NS_LOG_FUNCTION_NOARGS (); - IntegerValue value; + UintegerValue value; g_rngRun.GetValue (value); - int run = value.Get(); + uint64_t run = value.Get(); return run; } diff --git a/src/core/model/simple-ref-count.h b/src/core/model/simple-ref-count.h --- a/src/core/model/simple-ref-count.h +++ b/src/core/model/simple-ref-count.h @@ -25,6 +25,7 @@ #include "empty.h" #include "default-deleter.h" #include "assert.h" +#include "unused.h" #include #include @@ -82,7 +83,9 @@ */ SimpleRefCount (const SimpleRefCount &o) : m_count (1) - {} + { + NS_UNUSED (o); + } /** * Assignment operator * \param [in] o The object to copy @@ -90,6 +93,7 @@ */ SimpleRefCount &operator = (const SimpleRefCount &o) { + NS_UNUSED (o); return *this; } /** diff --git a/src/core/model/simulator.h b/src/core/model/simulator.h --- a/src/core/model/simulator.h +++ b/src/core/model/simulator.h @@ -184,8 +184,14 @@ */ static uint32_t GetContext (void); - /** Context enum values. */ - enum { + /** + * Context enum values. + * + * \internal + * This enum type is fixed to match the representation size + * of simulation context. + */ + enum : uint32_t { /** * Flag for events not associated with any particular context. */ diff --git a/src/core/model/synchronizer.cc b/src/core/model/synchronizer.cc --- a/src/core/model/synchronizer.cc +++ b/src/core/model/synchronizer.cc @@ -90,9 +90,9 @@ if (tDrift < 0) { - return -NanosecondToTimeStep (-tDrift); + return -static_cast (NanosecondToTimeStep (-tDrift)); } else { - return NanosecondToTimeStep (tDrift); + return static_cast (NanosecondToTimeStep (tDrift)); } } diff --git a/src/core/model/system-path.cc b/src/core/model/system-path.cc --- a/src/core/model/system-path.cc +++ b/src/core/model/system-path.cc @@ -27,13 +27,13 @@ #include -#if defined (HAVE_DIRENT_H) and defined (HAVE_SYS_TYPES_H) +#if defined (HAVE_DIRENT_H) && defined (HAVE_SYS_TYPES_H) /** Do we have an \c opendir function? */ #define HAVE_OPENDIR #include #include #endif -#if defined (HAVE_SYS_STAT_H) and defined (HAVE_SYS_TYPES_H) +#if defined (HAVE_SYS_STAT_H) && defined (HAVE_SYS_TYPES_H) /** Do we have a \c makedir function? */ #define HAVE_MKDIR_H #include diff --git a/src/core/model/test.h b/src/core/model/test.h --- a/src/core/model/test.h +++ b/src/core/model/test.h @@ -1426,19 +1426,19 @@ * * \returns The new test vector index */ - uint32_t Add (T vector); + std::size_t Add (T vector); /** * \brief Get the total number of test vectors. * \return The number of test vectors */ - uint32_t GetN (void) const; + std::size_t GetN (void) const; /** * \brief Get the i'th test vector * \param [in] i The requested vector index * \return The requested vector */ - T Get (uint32_t i) const; + T Get (std::size_t i) const; private: typedef std::vector TestVector; //!< Container type @@ -1464,16 +1464,16 @@ } template -uint32_t +std::size_t TestVectors::Add (T vector) { - uint32_t index = m_vectors.size (); + std::size_t index = m_vectors.size (); m_vectors.push_back (vector); return index; } template -uint32_t +std::size_t TestVectors::GetN (void) const { return m_vectors.size (); @@ -1481,7 +1481,7 @@ template T -TestVectors::Get (uint32_t i) const +TestVectors::Get (std::size_t i) const { NS_ABORT_MSG_UNLESS (m_vectors.size () > i, "TestVectors::Get(): Bad index"); return m_vectors[i]; diff --git a/src/core/model/type-id.cc b/src/core/model/type-id.cc --- a/src/core/model/type-id.cc +++ b/src/core/model/type-id.cc @@ -171,7 +171,7 @@ * Get the total number of type ids. * \returns The total number. */ - uint32_t GetRegisteredN (void) const; + uint16_t GetRegisteredN (void) const; /** * Get a type id by index. * @@ -181,7 +181,7 @@ * \param [in] i The index. * \returns The type id. */ - uint16_t GetRegistered (uint32_t i) const; + uint16_t GetRegistered (uint16_t i) const; /** * Record a new attribute in a type id. * \param [in] uid The id. @@ -214,21 +214,21 @@ * \param [in] initialValue The new initial value to use for this attribute. */ void SetAttributeInitialValue(uint16_t uid, - uint32_t i, + std::size_t i, Ptr initialValue); /** * Get the number of attributes. * \param [in] uid The id. * \returns The number of attributes associated to this TypeId */ - uint32_t GetAttributeN (uint16_t uid) const; + std::size_t GetAttributeN (uint16_t uid) const; /** * Get Attribute information by index. * \param [in] uid The id. * \param [in] i Index into attribute array * \returns The information associated to attribute whose index is \p i. */ - struct TypeId::AttributeInformation GetAttribute(uint16_t uid, uint32_t i) const; + struct TypeId::AttributeInformation GetAttribute(uint16_t uid, std::size_t i) const; /** * Record a new TraceSource. * \param [in] uid The id. @@ -256,14 +256,14 @@ * \param [in] uid The id. * \returns The number of trace sources defined in this TypeId. */ - uint32_t GetTraceSourceN (uint16_t uid) const; + std::size_t GetTraceSourceN (uint16_t uid) const; /** * Get the trace source by index. * \param [in] uid The id. * \param [in] i Index into trace source array. * \returns Detailed information about the requested trace source. */ - struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, uint32_t i) const; + struct TypeId::TraceSourceInformation GetTraceSource(uint16_t uid, std::size_t i) const; /** * Check if this TypeId should not be listed in documentation. * \param [in] uid The id. @@ -423,7 +423,7 @@ else { // chain old type NS_LOG_LOGIC (IIDL << "Old TypeId '" << hinfo->name << "' getting chained."); - uint32_t oldUid = GetUid (hinfo->hash); + uint16_t oldUid = GetUid (hinfo->hash); m_hashmap.erase (m_hashmap.find (hinfo->hash)); hinfo->hash = hash | HashChainFlag; m_hashmap.insert (std::make_pair (hinfo->hash, oldUid)); @@ -440,7 +440,7 @@ information.hasConstructor = false; information.mustHideFromDocumentation = false; m_information.push_back (information); - uint32_t uid = m_information.size (); + uint16_t uid = static_cast (m_information.size ()); NS_ASSERT (uid <= 0xffff); // Add to both maps: @@ -594,14 +594,14 @@ return hasC; } -uint32_t +uint16_t IidManager::GetRegisteredN (void) const { NS_LOG_FUNCTION (IID << m_information.size ()); - return m_information.size (); + return static_cast (m_information.size ()); } uint16_t -IidManager::GetRegistered (uint32_t i) const +IidManager::GetRegistered (uint16_t i) const { NS_LOG_FUNCTION (IID << i); return i + 1; @@ -679,7 +679,7 @@ } void IidManager::SetAttributeInitialValue(uint16_t uid, - uint32_t i, + std::size_t i, Ptr initialValue) { NS_LOG_FUNCTION (IID << uid << i << initialValue); @@ -690,17 +690,17 @@ -uint32_t +std::size_t IidManager::GetAttributeN (uint16_t uid) const { NS_LOG_FUNCTION (IID << uid); struct IidInformation *information = LookupInformation (uid); - uint32_t size = information->attributes.size (); + std::size_t size = information->attributes.size (); NS_LOG_LOGIC (IIDL << size); return size; } struct TypeId::AttributeInformation -IidManager::GetAttribute(uint16_t uid, uint32_t i) const +IidManager::GetAttribute(uint16_t uid, std::size_t i) const { NS_LOG_FUNCTION (IID << uid << i); struct IidInformation *information = LookupInformation (uid); @@ -768,17 +768,17 @@ information->traceSources.push_back (source); NS_LOG_LOGIC (IIDL << information->traceSources.size () - 1); } -uint32_t +std::size_t IidManager::GetTraceSourceN (uint16_t uid) const { NS_LOG_FUNCTION (IID << uid); struct IidInformation *information = LookupInformation (uid); - uint32_t size = information->traceSources.size (); + std::size_t size = information->traceSources.size (); NS_LOG_LOGIC (IIDL << size); return size; } struct TypeId::TraceSourceInformation -IidManager::GetTraceSource(uint16_t uid, uint32_t i) const +IidManager::GetTraceSource(uint16_t uid, std::size_t i) const { NS_LOG_FUNCTION (IID << uid << i); struct IidInformation *information = LookupInformation (uid); @@ -859,14 +859,14 @@ return true; } -uint32_t +uint16_t TypeId::GetRegisteredN (void) { NS_LOG_FUNCTION_NOARGS (); return IidManager::Get ()->GetRegisteredN (); } TypeId -TypeId::GetRegistered (uint32_t i) +TypeId::GetRegistered (uint16_t i) { NS_LOG_FUNCTION (i); return TypeId (IidManager::Get ()->GetRegistered (i)); @@ -880,7 +880,7 @@ TypeId nextTid = *this; do { tid = nextTid; - for (uint32_t i = 0; i < tid.GetAttributeN (); i++) + for (std::size_t i = 0; i < tid.GetAttributeN (); i++) { struct TypeId::AttributeInformation tmp = tid.GetAttribute(i); if (tmp.name == name) @@ -1039,7 +1039,7 @@ } bool -TypeId::SetAttributeInitialValue(uint32_t i, +TypeId::SetAttributeInitialValue(std::size_t i, Ptr initialValue) { NS_LOG_FUNCTION (this << i << initialValue); @@ -1064,35 +1064,35 @@ return mustHide; } -uint32_t +std::size_t TypeId::GetAttributeN (void) const { NS_LOG_FUNCTION (this); - uint32_t n = IidManager::Get ()->GetAttributeN (m_tid); + std::size_t n = IidManager::Get ()->GetAttributeN (m_tid); return n; } struct TypeId::AttributeInformation -TypeId::GetAttribute(uint32_t i) const +TypeId::GetAttribute(std::size_t i) const { NS_LOG_FUNCTION (this << i); return IidManager::Get ()->GetAttribute(m_tid, i); } std::string -TypeId::GetAttributeFullName (uint32_t i) const +TypeId::GetAttributeFullName (std::size_t i) const { NS_LOG_FUNCTION (this << i); struct TypeId::AttributeInformation info = GetAttribute(i); return GetName () + "::" + info.name; } -uint32_t +std::size_t TypeId::GetTraceSourceN (void) const { NS_LOG_FUNCTION (this); return IidManager::Get ()->GetTraceSourceN (m_tid); } struct TypeId::TraceSourceInformation -TypeId::GetTraceSource(uint32_t i) const +TypeId::GetTraceSource(std::size_t i) const { NS_LOG_FUNCTION (this << i); return IidManager::Get ()->GetTraceSource(m_tid, i); @@ -1141,7 +1141,7 @@ struct TypeId::TraceSourceInformation tmp; do { tid = nextTid; - for (uint32_t i = 0; i < tid.GetTraceSourceN (); i++) + for (std::size_t i = 0; i < tid.GetTraceSourceN (); i++) { tmp = tid.GetTraceSource (i); if (tmp.name == name) diff --git a/src/core/model/type-id.h b/src/core/model/type-id.h --- a/src/core/model/type-id.h +++ b/src/core/model/type-id.h @@ -156,14 +156,14 @@ * * \returns The number of TypeId instances registered. */ - static uint32_t GetRegisteredN (void); + static uint16_t GetRegisteredN (void); /** * Get a TypeId by index. * * \param [in] i Index of the TypeId. * \returns The TypeId instance whose index is \c i. */ - static TypeId GetRegistered (uint32_t i); + static TypeId GetRegistered (uint16_t i); /** * Constructor. @@ -247,21 +247,21 @@ * * \returns The number of attributes associated to this TypeId */ - uint32_t GetAttributeN (void) const; + std::size_t GetAttributeN (void) const; /** * Get Attribute information by index. * * \param [in] i Index into attribute array * \returns The information associated to attribute whose index is \p i. */ - struct TypeId::AttributeInformation GetAttribute(uint32_t i) const; + struct TypeId::AttributeInformation GetAttribute(std::size_t i) const; /** * Get the Attribute name by index. * * \param [in] i Index into attribute array * \returns The full name associated to the attribute whose index is \p i. */ - std::string GetAttributeFullName (uint32_t i) const; + std::string GetAttributeFullName (std::size_t i) const; /** * Get the constructor callback. @@ -284,14 +284,14 @@ * * \returns The number of trace sources defined in this TypeId. */ - uint32_t GetTraceSourceN (void) const; + std::size_t GetTraceSourceN (void) const; /** * Get the trace source by index. * * \param [in] i Index into trace source array. * \returns Detailed information about the requested trace source. */ - struct TypeId::TraceSourceInformation GetTraceSource(uint32_t i) const; + struct TypeId::TraceSourceInformation GetTraceSource(std::size_t i) const; /** * Set the parent TypeId. @@ -390,7 +390,7 @@ * \param [in] initialValue The new initial value to use for this attribute. * \returns \c true if the call was successfuly. */ - bool SetAttributeInitialValue(uint32_t i, + bool SetAttributeInitialValue(std::size_t i, Ptr initialValue); /** diff --git a/src/core/model/wall-clock-synchronizer.cc b/src/core/model/wall-clock-synchronizer.cc --- a/src/core/model/wall-clock-synchronizer.cc +++ b/src/core/model/wall-clock-synchronizer.cc @@ -391,7 +391,7 @@ { NS_LOG_FUNCTION (this << ns << tv); NS_ASSERT ((ns % US_PER_NS) == 0); - tv->tv_sec = ns / NS_PER_SEC; + tv->tv_sec = static_cast (ns / NS_PER_SEC); tv->tv_usec = (ns % NS_PER_SEC) / US_PER_NS; } diff --git a/src/core/test/attribute-test-suite.cc b/src/core/test/attribute-test-suite.cc --- a/src/core/test/attribute-test-suite.cc +++ b/src/core/test/attribute-test-suite.cc @@ -62,14 +62,18 @@ bool operator != (const ValueClassTest &a, const ValueClassTest &b) { + NS_UNUSED (a); + NS_UNUSED (b); return true; } std::ostream & operator << (std::ostream &os, ValueClassTest v) { + NS_UNUSED (v); return os; } std::istream & operator >> (std::istream &is, ValueClassTest &v) { + NS_UNUSED (v); return is; } @@ -259,8 +263,8 @@ bool DoGetTestB (void) const { return m_boolTestA; } int16_t DoGetInt16 (void) const { return m_int16SetGet; } void DoSetInt16 (int16_t v) { m_int16SetGet = v; } - uint32_t DoGetVectorN (void) const { return m_vector2.size (); } - Ptr DoGetVector (uint32_t i) const { return m_vector2[i]; } + std::size_t DoGetVectorN (void) const { return m_vector2.size (); } + Ptr DoGetVector (std::size_t i) const { return m_vector2[i]; } bool DoSetIntSrc (int8_t v) { m_intSrc2 = v; return true; } int8_t DoGetIntSrc (void) const { return m_intSrc2; } bool DoSetEnum (Test_e v) { m_enumSetGet = v; return true; } @@ -1069,7 +1073,11 @@ private: virtual void DoRun (void); - void NotifySource1 (int8_t old, int8_t n) { m_got1 = n; } + void NotifySource1 (int8_t old, int8_t n) + { + NS_UNUSED (old); + m_got1 = n; + } int64_t m_got1; }; @@ -1141,7 +1149,12 @@ private: virtual void DoRun (void); - void NotifySource2 (double a, int b, float c) { m_got2 = a; } + void NotifySource2 (double a, int b, float c) + { + NS_UNUSED (b); + NS_UNUSED (c); + m_got2 = a; + } double m_got2; }; @@ -1215,7 +1228,12 @@ private: virtual void DoRun (void); - void NotifySource2 (double a, int b, float c) { m_got2 = a; } + void NotifySource2 (double a, int b, float c) + { + NS_UNUSED (b); + NS_UNUSED (c); + m_got2 = a; + } double m_got2; }; diff --git a/src/core/test/callback-test-suite.cc b/src/core/test/callback-test-suite.cc --- a/src/core/test/callback-test-suite.cc +++ b/src/core/test/callback-test-suite.cc @@ -18,6 +18,7 @@ #include "ns3/test.h" #include "ns3/callback.h" +#include "ns3/unused.h" #include using namespace ns3; @@ -33,8 +34,18 @@ void Target1 (void) { m_test1 = true; } int Target2 (void) { m_test2 = true; return 2; } - void Target3 (double a) { m_test3 = true; } - int Target4 (double a, int b) { m_test4 = true; return 4; } + void Target3 (double a) + { + NS_UNUSED (a); + m_test3 = true; + } + int Target4 (double a, int b) + { + NS_UNUSED (a); + NS_UNUSED (b); + m_test4 = true; + return 4; + } private: virtual void DoRun (void); @@ -163,8 +174,18 @@ void Target1 (void) { m_test1 = true; } int Target2 (void) { m_test2 = true; return 2; } - void Target3 (double a) { m_test3 = true; } - int Target4 (double a, int b) { m_test4 = true; return 4; } + void Target3 (double a) + { + NS_UNUSED (a); + m_test3 = true; + } + int Target4 (double a, int b) + { + NS_UNUSED (a); + NS_UNUSED (b); + m_test4 = true; + return 4; + } private: virtual void DoRun (void); diff --git a/src/core/test/config-test-suite.cc b/src/core/test/config-test-suite.cc --- a/src/core/test/config-test-suite.cc +++ b/src/core/test/config-test-suite.cc @@ -30,6 +30,7 @@ #include "ns3/names.h" #include "ns3/pointer.h" #include "ns3/log.h" +#include "ns3/unused.h" #include @@ -621,7 +622,11 @@ * \param oldValue The old value. * \param newValue The new value. */ - void Trace (int16_t oldValue, int16_t newValue) { m_newValue = newValue; } + void Trace (int16_t oldValue, int16_t newValue) + { + NS_UNUSED (oldValue); + m_newValue = newValue; + } /** * Trace callback with context path. * \param path The context path. @@ -629,7 +634,11 @@ * \param newValue The new value. */ void TraceWithPath (std::string path, int16_t old, int16_t newValue) - { m_newValue = newValue; m_path = path; } + { + NS_UNUSED (old); + m_newValue = newValue; + m_path = path; + } private: virtual void DoRun (void); diff --git a/src/core/test/int64x64-test-suite.cc b/src/core/test/int64x64-test-suite.cc --- a/src/core/test/int64x64-test-suite.cc +++ b/src/core/test/int64x64-test-suite.cc @@ -171,7 +171,7 @@ if (int64x64_t::implementation == int64x64_t::ld_impl) { // Darwin 12.5.0 (Mac 10.8.5) g++ 4.2.1 - low = HP_MAX_64 * std::numeric_limits::epsilon (); + low = static_cast (HP_MAX_64 * std::numeric_limits::epsilon ()); } Check ( 0, 0); @@ -259,7 +259,7 @@ Check ("-1.0", -1, 0, tolerance); Check ("-1.0000", -1, 0, tolerance); Check (" 1.000000000000000000054", 1, 1, tolerance); - Check ("-1.000000000000000000054", -2, -1, tolerance); + Check ("-1.000000000000000000054", (int64_t)-2, (uint64_t)-1, tolerance); } @@ -1078,11 +1078,11 @@ std::cout << GetParent ()->GetName () << " Double: " << "integer: " << intPart << std::endl; - m_last = intPart; + m_last = static_cast (intPart); m_deltaCount = 0; // Nudging the integer part eliminates deltas around 0 - long double v = intPart; + long double v = static_cast (intPart); Check (v +0.0000000000000000000542L, intPart, 0x1ULL); Check (v +0.0000000000000000001084L, intPart, 0x2ULL); diff --git a/src/core/test/random-variable-stream-test-suite.cc b/src/core/test/random-variable-stream-test-suite.cc --- a/src/core/test/random-variable-stream-test-suite.cc +++ b/src/core/test/random-variable-stream-test-suite.cc @@ -2603,7 +2603,9 @@ // There are no simple analytic forms for the Riemann zeta function, // which is why the gsl library is used in this test to calculate // the known mean of the values. - double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha); + double expectedMean = + gsl_sf_zeta_int (static_cast (alpha - 1)) / + gsl_sf_zeta_int (static_cast (alpha) ); // Test that values have approximately the right mean value. double TOLERANCE = expectedMean * 1e-2; @@ -2670,7 +2672,9 @@ // There are no simple analytic forms for the Riemann zeta function, // which is why the gsl library is used in this test to calculate // the known mean of the values. - double expectedMean = gsl_sf_zeta_int (alpha - 1) / gsl_sf_zeta_int (alpha); + double expectedMean = + gsl_sf_zeta_int (static_cast (alpha) - 1) / + gsl_sf_zeta_int (static_cast (alpha) ); // Test that values have approximately the right mean value. double TOLERANCE = expectedMean * 1e-2; @@ -2715,7 +2719,7 @@ // 4, 4, 7, 7, 10, 10 . // double array1 [] = { 4, 4, 7, 7, 10, 10}; - uint64_t count1 = 6; + std::size_t count1 = 6; s->SetValueArray (array1, count1); double value; @@ -2739,7 +2743,7 @@ // 1000, 2000, 7, 7 . // double array2 [] = { 1000, 2000, 3000, 4000}; - uint64_t count2 = 4; + std::size_t count2 = 4; s->SetValueArray (array2, count2); // Test that the second sequence is correct. diff --git a/src/core/test/simulator-test-suite.cc b/src/core/test/simulator-test-suite.cc --- a/src/core/test/simulator-test-suite.cc +++ b/src/core/test/simulator-test-suite.cc @@ -64,6 +64,7 @@ void SimulatorEventsTestCase::EventA (int a) { + NS_UNUSED (a); m_a = false; } @@ -85,6 +86,7 @@ void SimulatorEventsTestCase::EventC (int c) { + NS_UNUSED (c); m_c = false; } diff --git a/src/core/test/traced-callback-test-suite.cc b/src/core/test/traced-callback-test-suite.cc --- a/src/core/test/traced-callback-test-suite.cc +++ b/src/core/test/traced-callback-test-suite.cc @@ -18,6 +18,7 @@ #include "ns3/test.h" #include "ns3/traced-callback.h" +#include "ns3/unused.h" using namespace ns3; @@ -45,12 +46,16 @@ void BasicTracedCallbackTestCase::CbOne (uint8_t a, double b) { + NS_UNUSED (a); + NS_UNUSED (b); m_one = true; } void BasicTracedCallbackTestCase::CbTwo (uint8_t a, double b) { + NS_UNUSED (a); + NS_UNUSED (b); m_two = true; } diff --git a/src/lte/examples/lena-intercell-interference.cc b/src/lte/examples/lena-intercell-interference.cc --- a/src/lte/examples/lena-intercell-interference.cc +++ b/src/lte/examples/lena-intercell-interference.cc @@ -60,7 +60,7 @@ // determine the string tag that identifies this simulation run // this tag is then appended to all filenames - IntegerValue runValue; + UintegerValue runValue; GlobalValue::GetValueByName ("RngRun", runValue); std::ostringstream tag; diff --git a/src/lte/examples/lena-pathloss-traces.cc b/src/lte/examples/lena-pathloss-traces.cc --- a/src/lte/examples/lena-pathloss-traces.cc +++ b/src/lte/examples/lena-pathloss-traces.cc @@ -60,7 +60,7 @@ // determine the string tag that identifies this simulation run // this tag is then appended to all filenames - IntegerValue runValue; + UintegerValue runValue; GlobalValue::GetValueByName ("RngRun", runValue); std::ostringstream tag; diff --git a/src/lte/test/lte-test-cell-selection.cc b/src/lte/test/lte-test-cell-selection.cc --- a/src/lte/test/lte-test-cell-selection.cc +++ b/src/lte/test/lte-test-cell-selection.cc @@ -154,7 +154,7 @@ { NS_LOG_FUNCTION (this << GetName ()); - Config::SetGlobal ("RngRun", IntegerValue (m_rngRun)); + Config::SetGlobal ("RngRun", UintegerValue (m_rngRun)); Ptr lteHelper = CreateObject (); lteHelper->SetAttribute ("PathlossModel", diff --git a/src/lte/test/lte-test-phy-error-model.cc b/src/lte/test/lte-test-phy-error-model.cc --- a/src/lte/test/lte-test-phy-error-model.cc +++ b/src/lte/test/lte-test-phy-error-model.cc @@ -166,7 +166,7 @@ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true)); Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false)); - Config::SetGlobal ("RngRun", IntegerValue (m_rngRun)); + Config::SetGlobal ("RngRun", UintegerValue (m_rngRun)); //Disable Uplink Power Control Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false)); @@ -322,7 +322,7 @@ Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (true)); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::RrFfMacScheduler::HarqEnabled", BooleanValue (false)); - Config::SetGlobal ("RngRun", IntegerValue (m_rngRun)); + Config::SetGlobal ("RngRun", UintegerValue (m_rngRun)); //Disable Uplink Power Control Config::SetDefault ("ns3::LteUePhy::EnableUplinkPowerControl", BooleanValue (false)); diff --git a/src/lte/test/lte-test-rlc-am-e2e.cc b/src/lte/test/lte-test-rlc-am-e2e.cc --- a/src/lte/test/lte-test-rlc-am-e2e.cc +++ b/src/lte/test/lte-test-rlc-am-e2e.cc @@ -146,7 +146,7 @@ // LogComponentEnable ("LteRlcUm", level); // LogComponentEnable ("LteRlcAm", level); - Config::SetGlobal ("RngRun", IntegerValue (m_run)); + Config::SetGlobal ("RngRun", UintegerValue (m_run)); Config::SetDefault ("ns3::LteRlcAm::PollRetransmitTimer", TimeValue (MilliSeconds (20))); Config::SetDefault ("ns3::LteRlcAm::ReorderingTimer", TimeValue (MilliSeconds (10))); Config::SetDefault ("ns3::LteRlcAm::StatusProhibitTimer", TimeValue (MilliSeconds (40))); diff --git a/src/lte/test/lte-test-secondary-cell-selection.cc b/src/lte/test/lte-test-secondary-cell-selection.cc --- a/src/lte/test/lte-test-secondary-cell-selection.cc +++ b/src/lte/test/lte-test-secondary-cell-selection.cc @@ -92,7 +92,7 @@ { NS_LOG_FUNCTION (this << GetName ()); - Config::SetGlobal ("RngRun", IntegerValue (m_rngRun)); + Config::SetGlobal ("RngRun", UintegerValue (m_rngRun)); // Create helpers. auto lteHelper = CreateObject ();