[x] Tests for the changes have been added (for bug fixes / features)
[x] Documentation has been added / updated (for bug fixes / features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
This PR aims to solve the type punning issues of https://github.com/novelrt/NovelRT/issues/402. I am not certain if that will be enough to get GCC support up and running.
Is there an open issue that this resolves? If so, please link it here.
This PR
What is the current behavior? (You can also link to an open issue here)
NovelRT fails to build with GCC.
What is the new behavior (if this is a feature change)?
NovelRT no longer fails to build with GCC due to type punning issues.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
This should not introduce a breaking change to the API or behavior.
Other information:
this handles most cases, as long as C++ 17 is used and the macros don't cry.
in C++ 20 std::bit_set is used.
some compilers support it in earlier C++ versions as a sort of compiler intrinsic, if one is available it might use it. if the compiler has not implemented std::bit_set yet or a built in implementation cannot be found, it will fallback on memcpy for GNU based compilers except clang and icc, these use reinterpret_cast as fallback.
the list of gnu exceptions is a tricky one to pin down and this is my current best attempt.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) This PR aims to solve the type punning issues of https://github.com/novelrt/NovelRT/issues/402. I am not certain if that will be enough to get GCC support up and running.
Is there an open issue that this resolves? If so, please link it here. This PR
What is the current behavior? (You can also link to an open issue here) NovelRT fails to build with GCC.
What is the new behavior (if this is a feature change)? NovelRT no longer fails to build with GCC due to type punning issues.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?) This should not introduce a breaking change to the API or behavior.
Other information:
this handles most cases, as long as C++ 17 is used and the macros don't cry.
in C++ 20 std::bit_set is used. some compilers support it in earlier C++ versions as a sort of compiler intrinsic, if one is available it might use it. if the compiler has not implemented std::bit_set yet or a built in implementation cannot be found, it will fallback on memcpy for GNU based compilers except clang and icc, these use reinterpret_cast as fallback.
the list of gnu exceptions is a tricky one to pin down and this is my current best attempt.