Fix C++ standard syntax compatibility for repair()

This commit is contained in:
John Wellbelove 2024-01-20 10:08:15 +00:00
parent 1825c54570
commit db878c54c5
9 changed files with 58 additions and 44 deletions

View File

@ -1208,11 +1208,9 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE
virtual
#endif
virtual void repair() ETL_OVERRIDE
#else
void repair()
#ifdef ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
ETL_ASSERT(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::circular_buffer_incompatible_type));
@ -1395,11 +1393,9 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}

View File

@ -2483,11 +2483,9 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_IDEQUE_REPAIR_ENABLE
virtual
#endif
void repair()
#ifdef ETL_IDEQUE_REPAIR_ENABLE
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED

View File

@ -202,6 +202,14 @@ SOFTWARE.
#define ETL_HAS_IDEQUE_REPAIR 0
#endif
//*************************************
// Option to enable repair-after-memcpy for icircular_buffer.
#if defined(ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE)
#define ETL_HAS_ICIRCULAR_BUFFER_REPAIR 1
#else
#define ETL_HAS_ICIRCULAR_BUFFER_REPAIR 0
#endif
//*************************************
// Indicate if C++ exceptions are enabled.
#if defined(ETL_THROW_EXCEPTIONS)
@ -477,6 +485,7 @@ namespace etl
static ETL_CONSTANT bool has_string_clear_after_use = (ETL_HAS_STRING_CLEAR_AFTER_USE == 1);
static ETL_CONSTANT bool has_istring_repair = (ETL_HAS_ISTRING_REPAIR == 1);
static ETL_CONSTANT bool has_ivector_repair = (ETL_HAS_IVECTOR_REPAIR == 1);
static ETL_CONSTANT bool has_icircular_buffer_repair = (ETL_HAS_ICIRCULAR_BUFFER_REPAIR == 1);
static ETL_CONSTANT bool has_mutable_array_view = (ETL_HAS_MUTABLE_ARRAY_VIEW == 1);
static ETL_CONSTANT bool has_ideque_repair = (ETL_HAS_IDEQUE_REPAIR == 1);
static ETL_CONSTANT bool has_virtual_messages = (ETL_HAS_VIRTUAL_MESSAGES == 1);

View File

@ -246,9 +246,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::istring::repair_buffer(buffer);
@ -434,9 +435,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}

View File

@ -230,9 +230,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::iu16string::repair_buffer(buffer);
@ -414,9 +415,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}

View File

@ -230,9 +230,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::iu32string::repair_buffer(buffer);
@ -414,9 +415,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}

View File

@ -247,9 +247,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::iu8string::repair_buffer(buffer);
@ -435,9 +436,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}

View File

@ -1346,11 +1346,9 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#ifdef ETL_IVECTOR_REPAIR_ENABLE
virtual
#endif
virtual void repair() ETL_OVERRIDE
#else
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
#endif
{
ETL_ASSERT_OR_RETURN(etl::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
@ -1527,9 +1525,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}
@ -1649,9 +1648,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::ivector<T*>::repair_buffer(buffer);
@ -1806,9 +1806,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#ifdef ETL_IVECTOR_REPAIR_ENABLE
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::ivector<T*>::repair_buffer(this->p_buffer);

View File

@ -231,9 +231,10 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
#if ETL_HAS_ISTRING_REPAIR
virtual
#endif
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
etl::iwstring::repair_buffer(buffer);
}
@ -414,9 +415,10 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
#if ETL_HAS_ISTRING_REPAIR
ETL_OVERRIDE
virtual void repair() ETL_OVERRIDE
#else
void repair()
#endif
{
}