Changes for GCC compatibility

This commit is contained in:
John Wellbelove 2016-03-02 21:10:24 +00:00
parent 7bc7406511
commit 62e2b3c750
14 changed files with 100 additions and 92 deletions

View File

@ -122,7 +122,7 @@ namespace etl
//*************************************************************************
checksum()
{
reset();
this->reset();
}
//*************************************************************************
@ -133,8 +133,8 @@ namespace etl
template<typename TIterator>
checksum(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
@ -151,7 +151,7 @@ namespace etl
//*************************************************************************
bsd_checksum()
{
reset();
this->reset();
}
//*************************************************************************
@ -162,8 +162,8 @@ namespace etl
template<typename TIterator>
bsd_checksum(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
@ -180,7 +180,7 @@ namespace etl
//*************************************************************************
xor_checksum()
{
reset();
this->reset();
}
//*************************************************************************
@ -191,11 +191,10 @@ namespace etl
template<typename TIterator>
xor_checksum(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}
#endif

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc16 16 bit CRC calculation
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc16()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc16(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc16_ccitt 16 bit CRC CCITT calculation
@ -50,7 +50,7 @@ namespace etl
/// \ingroup crc16_ccitt
//***************************************************************************
extern const uint16_t CRC_CCITT[];
//***************************************************************************
/// CRC16 CCITT policy.
/// Calculates CRC16 CCITT using polynomial 0x1021
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc16_ccitt()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc16_ccitt(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc16_kermit 16 bit CRC Kermit calculation
@ -50,7 +50,7 @@ namespace etl
/// \ingroup crc
//***************************************************************************
extern const uint16_t CRC_KERMIT[];
//***************************************************************************
/// CRC16 Kermit policy.
/// Calculates CRC16 Kermit using polynomial 0x1021
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc16_kermit()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc16_kermit(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc32 32 bit CRC calculation
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc32()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc32(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc64_ecma 64 bit CRC ECMA calculation
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc64_ecma()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc64_ecma(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -37,7 +37,7 @@ SOFTWARE.
#include "frame_check_sequence.h"
#if defined(COMPILER_KEIL)
#pragma diag_suppress 1300
#pragma diag_suppress 1300
#endif
///\defgroup crc8_ccitt 8 bit CRC calculation
@ -73,7 +73,7 @@ namespace etl
{
return crc;
}
};
};
//*************************************************************************
/// CRC8 CCITT
@ -87,7 +87,7 @@ namespace etl
//*************************************************************************
crc8_ccitt()
{
reset();
this->reset();
}
//*************************************************************************
@ -98,8 +98,8 @@ namespace etl
template<typename TIterator>
crc8_ccitt(TIterator begin, const TIterator end)
{
reset();
add(begin, end);
this->reset();
this->add(begin, end);
}
};
}

View File

@ -77,10 +77,10 @@ namespace etl
//*************************************************************************
/// Construct from size and value.
//*************************************************************************
explicit forward_list(size_t initialSize, typename iforward_list<T>::parameter_t value = T())
explicit forward_list(size_t initial_size, typename iforward_list<T>::parameter_t value = T())
: iforward_list<T>(node_pool, MAX_SIZE)
{
iforward_list<T>::assign(initialSize, value);
iforward_list<T>::assign(initial_size, value);
}
//*************************************************************************

View File

@ -76,7 +76,7 @@ namespace etl
intrusive_forward_list_empty(string_type file_name, numeric_type line_number)
: intrusive_forward_list_exception(ETL_ERROR_TEXT("intrusive_forward_list:empty", ETL_FILE"A"), file_name, line_number)
{
{
}
};
@ -845,7 +845,7 @@ namespace etl
{
iterator i_item = begin();
iterator i_last_item = before_begin();
while (i_item != end())
{
if (predicate(*i_item))
@ -1056,18 +1056,20 @@ namespace etl
private:
link_type start_link; ///< The link that acts as the intrusive_forward_list start.
//*************************************************************************
/// Counter type based on count option.
//*************************************************************************
template <const size_t OPTION>
class counter_type;
template <const size_t OPTION, bool dummy = true>
class counter_type
{
};
//*************************************************************************
/// Slow type.
//*************************************************************************
template <>
class counter_type<etl::count_option::SLOW_COUNT>
template <bool dummy>
class counter_type<etl::count_option::SLOW_COUNT, dummy>
{
public:
@ -1100,8 +1102,8 @@ namespace etl
//*************************************************************************
/// Fast type.
//*************************************************************************
template <>
class counter_type<etl::count_option::FAST_COUNT>
template <bool dummy>
class counter_type<etl::count_option::FAST_COUNT, dummy>
{
public:
@ -1144,7 +1146,7 @@ namespace etl
};
counter_type<COUNT_OPTION> current_size; ///< Counts the number of elements in the list.
//*************************************************************************
/// Is the intrusive_forward_list a trivial length?
//*************************************************************************

View File

@ -74,7 +74,7 @@ namespace etl
}
//***************************************************************************
/// Link exception.
/// Link exception.
//***************************************************************************
class link_exception : public etl::exception
{
@ -87,7 +87,7 @@ namespace etl
};
//***************************************************************************
/// not unlinked exception.
/// not unlinked exception.
//***************************************************************************
class not_unlinked_exception : public etl::link_exception
{
@ -131,7 +131,7 @@ namespace etl
/// A forward link.
//***************************************************************************
template <const size_t ID_ = 0, const size_t OPTION_ = etl::link_option::DEFAULT>
struct forward_link
struct forward_link
: public __private_intrusive_links__::forward_link_base<forward_link<ID_, OPTION_>, ID_, OPTION_>
{
};
@ -145,7 +145,7 @@ namespace etl
{
forward_link()
{
clear();
this->clear();
}
};
@ -160,12 +160,12 @@ namespace etl
{
forward_link()
{
clear();
this->clear();
}
~forward_link()
{
assert(etl_next != nullptr);
assert(this->etl_next != nullptr);
}
};
@ -279,7 +279,7 @@ namespace etl
else
{
last.etl_next = nullptr;
}
}
}
// Reference
@ -369,12 +369,12 @@ namespace etl
/// A bidirectional link.
//***************************************************************************
template <const size_t ID_ = 0, const size_t OPTION_ = etl::link_option::DEFAULT>
struct bidirectional_link
struct bidirectional_link
: public __private_intrusive_links__::bidirectional_link_base<bidirectional_link<ID_, OPTION_>, ID_, OPTION_>
{
void unlink()
{
base_unlink();
this->base_unlink();
}
};
@ -383,23 +383,23 @@ namespace etl
// When this link is destroyed it will automatically unlink itself.
//******************************************************************
template <const size_t ID_>
struct bidirectional_link<ID_, etl::link_option::AUTO>
struct bidirectional_link<ID_, etl::link_option::AUTO>
: public __private_intrusive_links__::bidirectional_link_base<bidirectional_link<ID_, etl::link_option::AUTO>, ID_, etl::link_option::AUTO>
{
bidirectional_link()
{
clear();
this->clear();
}
~bidirectional_link()
{
base_unlink();
this->base_unlink();
}
void unlink()
{
base_unlink();
clear();
this->base_unlink();
this->clear();
}
};
@ -409,24 +409,24 @@ namespace etl
// is destroyed.
//******************************************************************
template <const size_t ID_>
struct bidirectional_link<ID_, etl::link_option::CHECKED>
struct bidirectional_link<ID_, etl::link_option::CHECKED>
: public __private_intrusive_links__::bidirectional_link_base<bidirectional_link<ID_, etl::link_option::CHECKED>, ID_, etl::link_option::CHECKED>
{
bidirectional_link()
{
clear();
this->clear();
}
~bidirectional_link()
{
assert(etl_previous == nullptr);
assert(etl_next == nullptr);
assert(this->etl_previous == nullptr);
assert(this->etl_next == nullptr);
}
void unlink()
{
base_unlink();
clear();
this->base_unlink();
this->clear();
}
};
@ -696,7 +696,7 @@ namespace etl
{
tree_link()
{
clear();
this->clear();
}
};
@ -711,14 +711,14 @@ namespace etl
{
tree_link()
{
clear();
this->clear();
}
~tree_link()
{
assert(etl_parent != nullptr);
assert(etl_left != nullptr);
assert(etl_right != nullptr);
assert(this->etl_parent != nullptr);
assert(this->etl_left != nullptr);
assert(this->etl_right != nullptr);
}
};
@ -822,4 +822,4 @@ namespace etl
}
#undef ETL_FILE
#endif
#endif

View File

@ -700,10 +700,10 @@ namespace etl
const mapped_type& at(key_value_parameter_t key) const
{
// Find the bucket.
bucket_list_t::const_iterator ibucket = pbuckets->begin() + bucket(key);
typename bucket_list_t::const_iterator ibucket = pbuckets->begin() + bucket(key);
// Find the first node in the bucket.
bucket_t::const_iterator inode = ibucket->begin();
typename bucket_t::const_iterator inode = ibucket->begin();
// Walk the list looking for the right one.
while (inode != ibucket->end())
@ -1049,8 +1049,8 @@ namespace etl
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
/// element of the wanted range and the second pointing past the last
/// The range is defined by two iterators, the first pointing to the first
/// element of the wanted range and the second pointing past the last
/// element of the range.
///\param key The key to search for.
///\return An iterator pair to the range of elements if the key exists, otherwise end().
@ -1070,8 +1070,8 @@ namespace etl
//*********************************************************************
/// Returns a range containing all elements with key key in the container.
/// The range is defined by two iterators, the first pointing to the first
/// element of the wanted range and the second pointing past the last
/// The range is defined by two iterators, the first pointing to the first
/// element of the wanted range and the second pointing past the last
/// element of the range.
///\param key The key to search for.
///\return A const iterator pair to the range of elements if the key exists, otherwise end().

View File

@ -193,7 +193,7 @@ namespace etl
//*********************************************************************
void resize(size_t new_size)
{
ETL_ASSERT(new_size <= MAX_SIZE, ETL_ERROR(vector_full));
//ETL_ASSERT(new_size <= MAX_SIZE, ETL_ERROR(vector_full));
// Size up or size down?
if (new_size > current_size)
@ -273,6 +273,13 @@ namespace etl
reference at(size_t i)
{
ETL_ASSERT(i < current_size, ETL_ERROR(vector_out_of_bounds));
// if (i >= current_size)
// {
//
// throw etl::vector_out_of_bounds("a", 1);
// }
return p_buffer[i];
}

View File

@ -77,19 +77,19 @@ namespace etl
//*************************************************************************
/// Construct from size.
//*************************************************************************
explicit list(size_t initialSize)
explicit list(size_t initial_size)
: ilist<T>(node_pool, MAX_SIZE)
{
ilist<T>::assign(initialSize, T());
ilist<T>::assign(initial_size, T());
}
//*************************************************************************
/// Construct from size and value.
//*************************************************************************
list(size_t initialSize, typename ilist<T>::parameter_t value)
list(size_t initial_size, typename ilist<T>::parameter_t value)
: ilist<T>(node_pool, MAX_SIZE)
{
ilist<T>::assign(initialSize, value);
ilist<T>::assign(initial_size, value);
}
//*************************************************************************

View File

@ -72,25 +72,25 @@ namespace etl
//*************************************************************************
/// Constructor, with size.
///\param initialSize The initial size of the vector.
///\param initial_size The initial size of the vector.
//*************************************************************************
explicit vector(size_t initialSize)
explicit vector(size_t initial_size)
: ivector<T>(reinterpret_cast<T*>(&buffer), MAX_SIZE)
{
ivector<T>::initialise();
ivector<T>::resize(initialSize);
ivector<T>::resize(initial_size);
}
//*************************************************************************
/// Constructor, from initial size and value.
///\param initialSize The initial size of the vector.
///\param initial_size The initial size of the vector.
///\param value The value to fill the vector with.
//*************************************************************************
vector(size_t initialSize, typename ivector<T>::parameter_t value)
vector(size_t initial_size, typename ivector<T>::parameter_t value)
: ivector<T>(reinterpret_cast<T*>(&buffer), MAX_SIZE)
{
ivector<T>::initialise();
ivector<T>::resize(initialSize, value);
ivector<T>::resize(initial_size, value);
}
//*************************************************************************