Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation of reference_counted_message_pool with ETL_LOG_ERROR enabled #531

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

valentink-eroad
Copy link
Contributor

@valentink-eroad valentink-eroad commented Apr 11, 2022

The fix is for the following compilation errors that were reported when ETL_LOG_ERROR was enabled

etl/include/etl/reference_counted_message_pool.h:125:7: error: ‘etl::exception’ is an inaccessible base of ‘etl::reference_counted_message_pool_allocation_failure’
  125 |       ETL_ASSERT((p != ETL_NULLPTR), ETL_ERROR(etl::reference_counted_message_pool_allocation_failure));
      |       ^~~~~~~~~~
...
etl/reference_counted_message_pool.h:167:7: error: ‘etl::exception’ is an inaccessible base of ‘etl::reference_counted_message_pool_release_failure’
  167 |       ETL_ASSERT(released, ETL_ERROR(etl::reference_counted_message_pool_release_failure));
      |       ^~~~~~~~~~

Here is the content of our etl_profile.h:

#ifndef ETL_PROFILE_INCLUDED_
#define ETL_PROFILE_INCLUDED_

#include "etl/profiles/determine_compiler_language_support.h"
#include "etl/profiles/determine_compiler_version.h"
#include "etl/profiles/determine_development_os.h"

//*****************************************************************************
// Generic C++17
//*****************************************************************************
#ifdef UNITTEST
#define ETL_IN_UNIT_TEST

#define ETL_TARGET_OS_LINUX

#ifndef ETL_COMPILER_TYPE_DETECTED
#define ETL_COMPILER_GCC
#endif

#else /* ifdef UNITTEST */

#define ETL_TARGET_DEVICE_ARM

#define ETL_TARGET_OS_NONE

#ifndef ETL_COMPILER_TYPE_DETECTED
#define ETL_COMPILER_ARM7
#endif

#endif /* ifdef UNITTEST else */


#ifndef ETL_CPP17_SUPPORTED
#define ETL_CPP17_SUPPORTED 1
#endif

#ifdef ETL_CPP20_SUPPORTED
#undef ETL_CPP20_SUPPORTED
#endif
#define ETL_CPP20_SUPPORTED 0


/* ETL Error handling */
#define ETL_LOG_ERRORS 1
#define ETL_CHECK_PUSH_POP 1
#define ETL_VERBOSE_ERRORS 1

namespace etl {
    class exception;
};

/**
 * @brief ETL error handler
 *
 * The error handler only logs an error raised in ETL.
 * Note that many ETL methods use ETL_ASSERT macro that allows to continue
 * running the method code even if assert failed.
 *
 * @param e exception info from ETL
 */
void etl_err_handler(const etl::exception& e);

#endif /* #ifndef ETL_PROFILE_INCLUDED_ */

PS: fixed a couple of typos in etl_platform.h

@jwellbelove
Copy link
Contributor

jwellbelove commented Apr 11, 2022

"The error handler only logs an error raised in ETL.
 * Note that many ETL methods use ETL_ASSERT macro that allows to continue
 * running the method code even if assert failed."

It is expected that your error handler will halt in the appropriate way for your platform.

@jwellbelove jwellbelove merged commit 70cc720 into ETLCPP:master Apr 11, 2022
jwellbelove pushed a commit that referenced this pull request Apr 11, 2022
…TL_LOG_ERROR enabled due to non-public inheritance.
jwellbelove pushed a commit that referenced this pull request Apr 11, 2022
…TL_LOG_ERROR enabled due to non-public inheritance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants