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 build warnings and errors on LCC (eLbrus C/C++ compiler) #4607

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

makise-homura
Copy link

This PR should fix issue #4603.
Due to no discussion (and thus, no objections) in said issue, I decided to submit this PR without being explicitly asked to to do so. I hope this fits contributing guidelines.

LCC (eLbrus C/C++ compiler) is an EDG-based compiler that in most cases
is similar in behavior to GNU, but it has different warning options
supported and enabled by default. It seems to have sense to treat LCC
and GNU differently, as CMake supports it from 3.23.

For it to be done, CMake policy CMP0129 should be set to NEW,
and then CMAKE_${LANG}_COMPILER_ID may be checked to be STREQUAL "LCC".

This commit does this, and introduces warning arguments in call
to compiler that are slightly different from GNU to let googletest be
buildable without unexpected warnings.
There are four GetName<T>() functions that are expected to have
a limited set of possible <T> types. But compiler does not know about
that, and may complain (and in LCC case, does) about no return
operator in the end of these functions.

This commit adds dummy return to each of these functions to eliminate
this warning.
__attribute__((optimize("no-optimize-sibling-calls"))) is not supported
for at least some versions of NVC (nVidia HPC compiler), and this case
has a workaround in gtest-port.h. Actually, this is true not just for
NVC (that defines __NVCOMPILER), but for other EDG-based compilers as
well, for example, LCC.

So the correct check here would be not just for __NVCOMPILER, but
for __EDG__ (NVC defines this too, because it is based on EDG).

This commit does this.
abi::__cxa_demangle("7MyArrayIbLi42EE", nullptr, nullptr, nullptr)
returns "MyArray<bool, 42>" on GCC/x86_64, but "MyArray<bool, (int)42>"
on LCC/e2k. This behavior causes googletest-list-tests-unittest test to
fail.

This commit fixes that by slightly modifying the regex to match this
behavior of abi::__cxa_demangle().
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.

1 participant