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

Feature/#646 improve type traits #648

Conversation

aBraM-aBraM
Copy link
Contributor

@aBraM-aBraM aBraM-aBraM commented Dec 20, 2022

add #646 requirements

I'll elaborate on the importance of this addition. this causes variant of classes/structs to have a move ctor that doesn't do anything and thus causes result to have a move ctor that does nothing but can change type from result to error.

These are two undefined behaviors I've found more might be the result of this

@aBraM-aBraM aBraM-aBraM force-pushed the feature/#646-improve-type-traits branch from d169714 to 682606f Compare December 20, 2022 19:41
@jwellbelove jwellbelove changed the base branch from master to feature/#646-improve-type-traits December 21, 2022 20:54
Copy link
Contributor

@jwellbelove jwellbelove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these traits are only available for C++11 or above.
You will need to surround the code with #if ETL_USING_CPP11 conditionals and make the C++03 compatible code available for that standard.

Copy link
Contributor

@jwellbelove jwellbelove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type traits are generated from type_traits_generator.h.
You must ensure that type_traits.h is correctly generated from it when the script generate_type_traits.bat is run.
The best way I found to do this is to manually change the generated header to what you want, commit it, and then modify the generator header until it generates a header with no differences to that committed.

@aBraM-aBraM
Copy link
Contributor Author

aBraM-aBraM commented Dec 21, 2022

Some of these traits are only available for C++11 or above. You will need to surround the code with #if ETL_USING_CPP11 conditionals and make the C++03 compatible code available for that standard.

By only available for C++11 do you mean they don't compile in C++03 or just not defined by the standard?

If they are just not defined I don't think there's a good reason not to define them (without them some containers have undefined / unexpected behavior).

If those traits are not compiling should I just keep it for C++03 to only work with pointers and integral values? Also I'm not sure if the documentation is part of the repository and if so, please tell me so I'd be able to update them.

@jwellbelove
Copy link
Contributor

What I mean is, that for any improved type trait that is implemented using features only available in C++11 and above, then the older C++03 implementation (if one exists) should be available if C++11 is not supported.

#if ETL_USING_CPP11
  // C++11 implementation
#else
  // C++03 implementation
#endif

#if ETL_USING_CPP11
  // C++11 only implementation
#endif

@aBraM-aBraM aBraM-aBraM force-pushed the feature/#646-improve-type-traits branch from 682606f to 4fc89fe Compare December 21, 2022 22:29
@aBraM-aBraM
Copy link
Contributor Author

What I mean is, that for any improved type trait that is implemented using features only available in C++11 and above, then the older C++03 implementation (if one exists) should be available if C++11 is not supported.

#if ETL_USING_CPP11
  // C++11 implementation
#else
  // C++03 implementation
#endif

#if ETL_USING_CPP11
  // C++11 only implementation
#endif

done

@jwellbelove jwellbelove merged commit 688c404 into ETLCPP:feature/#646-improve-type-traits Dec 22, 2022
jwellbelove pushed a commit that referenced this pull request Dec 29, 2022
jwellbelove added a commit that referenced this pull request Jan 11, 2023
Updates and more tests

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Fixed perfect forwarding for make_xxx helper functions

Don't warn on tag missing when subproject (#653) (#655)

Different solution than proposed in the issue, since that proposed
solution would given unexpected results when an intermediate
(untagged) commit is checked out.

This change simply skips warning about a missing git version when this
is a subproject, and uses the original version calculation logic.

I've also renamed `determine_version` to `determine_version_with_file`.
I'd originally done this in an intermediate version of this PR, but I
think that keeping the renaming is clearer code.

Removed superfluous semicolons

Updated version and release notes

Removed testing for 18.04

Added testing for 22.04

Updated Github Actions for Clang

Updated version and release notes

clang updates for Github Actions

Added missing notes

emplace member functions return reference to emplaced value (#659)

emplace_front, emplace_back updates

Updated version and release info

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Work In Progress

Work in progress

Work In Progress

Work in progress
jwellbelove pushed a commit that referenced this pull request Jan 21, 2023
jwellbelove added a commit that referenced this pull request Jan 21, 2023
Updated etl::delgate to handle const functors correctly

Updated version info

Fixed functor delegate enable_if

Updated release notes

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Fixed perfect forwarding for make_xxx helper functions

Don't warn on tag missing when subproject (#653) (#655)

Different solution than proposed in the issue, since that proposed
solution would given unexpected results when an intermediate
(untagged) commit is checked out.

This change simply skips warning about a missing git version when this
is a subproject, and uses the original version calculation logic.

I've also renamed `determine_version` to `determine_version_with_file`.
I'd originally done this in an intermediate version of this PR, but I
think that keeping the renaming is clearer code.

Removed superfluous semicolons

Updated version and release notes

Removed testing for 18.04

Added testing for 22.04

Updated Github Actions for Clang

Updated version and release notes

clang updates for Github Actions

Added missing notes

emplace member functions return reference to emplaced value (#659)

emplace_front, emplace_back updates

Updated version and release info

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Initial code
jwellbelove added a commit that referenced this pull request Jan 21, 2023
fix set of ETL_NO_STL flag (#628)

Co-authored-by: Sergey Skorokhod <s.skorokhod@1440.space>

Removed duplicate include

unique_ptr updates - Work in progress

Updated versions & memory.h

Fix duplicate function

Fixed incorrect 'valid' flag in assignment operator for arithmetic specialisation

Updated version and release notes

Fix bug #636 in optional emplace for pod types (#638)

Updated version info

Updated generator test script

Only build tests if top level project (#639)

Removed trailing spaces

Updated version info

Incorrect C++03 enable_if syntax

Updated version info

Don't use `push_macro` and `pull_macro` with Tasking compiler (#643)

* Autodetect Tasking compiler

#642

* Don't use `push_macro` and `pop_macro` for Tasking compiler

#642

Co-authored-by: Todd Snider <tsnider@jlg.com>

#643 Don't use push_macro and pull_macro with Tasking compiler

Updated etl::delgate to handle const functors correctly

Updated version info

Fixed functor delegate enable_if

Updated release notes

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Fixed perfect forwarding for make_xxx helper functions

Don't warn on tag missing when subproject (#653) (#655)

Different solution than proposed in the issue, since that proposed
solution would given unexpected results when an intermediate
(untagged) commit is checked out.

This change simply skips warning about a missing git version when this
is a subproject, and uses the original version calculation logic.

I've also renamed `determine_version` to `determine_version_with_file`.
I'd originally done this in an intermediate version of this PR, but I
think that keeping the renaming is clearer code.

Removed superfluous semicolons

Updated version and release notes

Removed testing for 18.04

Added testing for 22.04

Updated Github Actions for Clang

Updated version and release notes

clang updates for Github Actions

Added missing notes

emplace member functions return reference to emplaced value (#659)

emplace_front, emplace_back updates

Updated version and release info

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Work-In-Progress

Work-In-Progress

Added indexed emplace

More typedefs for etl::result

Work in progress

Work in progress

Work in progress

Changed default constructor

Added function comments
jwellbelove added a commit that referenced this pull request Jan 21, 2023
Removed duplicate include

unique_ptr updates - Work in progress

Updated versions & memory.h

Fix duplicate function

Fixed incorrect 'valid' flag in assignment operator for arithmetic specialisation

Updated version and release notes

Fix bug #636 in optional emplace for pod types (#638)

Updated version info

Updated generator test script

Only build tests if top level project (#639)

Removed trailing spaces

Updated version info

Incorrect C++03 enable_if syntax

Updated version info

Don't use `push_macro` and `pull_macro` with Tasking compiler (#643)

* Autodetect Tasking compiler

#642

* Don't use `push_macro` and `pop_macro` for Tasking compiler

#642

Co-authored-by: Todd Snider <tsnider@jlg.com>

#643 Don't use push_macro and pull_macro with Tasking compiler

Updated etl::delgate to handle const functors correctly

Updated version info

Fixed functor delegate enable_if

Updated release notes

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes
jwellbelove added a commit that referenced this pull request Jan 21, 2023
Work In Progress

Work in progress

Work In Progress

Work in progress

Work in progress

Work in progress

Fix syntax error from class rename

Deprecated error functions

Removed ETL_DEPRECATED from error_handler

Removed unused ETL_USE_MEM_BUILTINS from CMakelist files

Added constexpr tests

Extra constexpr tests

Added more call_if & call_or tests

Added runtime version of member_function_wrapper

Commenting

Rationalised call_or definitions

Rationalised function typenames

Work in progress

Re-enabled state chart tests

Abandoned C++03 function wrapper

Fix delegate unit test compilation directive

Updates and more tests

Fix delegate unit test compilation directive

Updates and more tests

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Fixed perfect forwarding for make_xxx helper functions

Don't warn on tag missing when subproject (#653) (#655)

Different solution than proposed in the issue, since that proposed
solution would given unexpected results when an intermediate
(untagged) commit is checked out.

This change simply skips warning about a missing git version when this
is a subproject, and uses the original version calculation logic.

I've also renamed `determine_version` to `determine_version_with_file`.
I'd originally done this in an intermediate version of this PR, but I
think that keeping the renaming is clearer code.

Removed superfluous semicolons

Updated version and release notes

Removed testing for 18.04

Added testing for 22.04

Updated Github Actions for Clang

Updated version and release notes

clang updates for Github Actions

Added missing notes

emplace member functions return reference to emplaced value (#659)

emplace_front, emplace_back updates

Updated version and release info

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Work In Progress

Work in progress

Work In Progress

Work in progress
jwellbelove added a commit that referenced this pull request Feb 6, 2023
fix set of ETL_NO_STL flag (#628)

Co-authored-by: Sergey Skorokhod <s.skorokhod@1440.space>

Removed duplicate include

unique_ptr updates - Work in progress

Updated versions & memory.h

Fix duplicate function

Fixed incorrect 'valid' flag in assignment operator for arithmetic specialisation

Updated version and release notes

Fix bug #636 in optional emplace for pod types (#638)

Updated version info

Updated generator test script

Only build tests if top level project (#639)

Removed trailing spaces

Updated version info

Incorrect C++03 enable_if syntax

Updated version info

Don't use `push_macro` and `pull_macro` with Tasking compiler (#643)

* Autodetect Tasking compiler

#642

* Don't use `push_macro` and `pop_macro` for Tasking compiler

#642

Co-authored-by: Todd Snider <tsnider@jlg.com>

#643 Don't use push_macro and pull_macro with Tasking compiler

Updated etl::delgate to handle const functors correctly

Updated version info

Fixed functor delegate enable_if

Updated release notes

Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`. (#645)

* Avoid 'missing return statement at end of non-void function' in `etl::visit<>()`.

For some definitions of `ETL_ASSERT()` there may be no return statement in case of an invalid type.
This results in undefined behavior.

Warning[Pe940]: missing return statement at end of non-void function "etl::visit<TReturn,TVisitor,TVariant>(TVisitor &, TVariant const &) include\etl\private\variant_legacy.h 976

* Use more self-explaining code.

Substitute ET_ASSERT() and return by dedicated macro.
This moves the responsibility of how to handle errors to the dedicated place.

improve is_constructible, is_copy_constructible, is_move_constructible for type traits with default definitions (#648)

Removed unused ETL_USE_MEM_BUILTINS option

Updated version info

Updated release notes

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Added etl::result<TValue, void> specialisation

Reverted code for etl::result<void, TError> specialisation

Fixed perfect forwarding for make_xxx helper functions

Don't warn on tag missing when subproject (#653) (#655)

Different solution than proposed in the issue, since that proposed
solution would given unexpected results when an intermediate
(untagged) commit is checked out.

This change simply skips warning about a missing git version when this
is a subproject, and uses the original version calculation logic.

I've also renamed `determine_version` to `determine_version_with_file`.
I'd originally done this in an intermediate version of this PR, but I
think that keeping the renaming is clearer code.

Removed superfluous semicolons

Updated version and release notes

Removed testing for 18.04

Added testing for 22.04

Updated Github Actions for Clang

Updated version and release notes

clang updates for Github Actions

Added missing notes

emplace member functions return reference to emplaced value (#659)

emplace_front, emplace_back updates

Updated version and release info

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Changed unit test macro CHECK_FALSE_EQUAL to CHECK_NOT_EQUAL

Improved emplace testing

Work-In-Progress

Work-In-Progress

Added indexed emplace

More typedefs for etl::result

Work in progress

Work in progress

Work in progress

Changed default constructor

Added function comments
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