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

Commits on Aug 30, 2024

  1. Treat LCC as compiler different from GCC

    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.
    makise-homura committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    5b2ecaa View commit details
    Browse the repository at this point in the history
  2. Eliminate -Wreturn-type (at least on LCC)

    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.
    makise-homura committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    df6fa41 View commit details
    Browse the repository at this point in the history
  3. Extend NVC workaround for no-optimize-sibling-calls

    __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.
    makise-homura committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    24699b4 View commit details
    Browse the repository at this point in the history
  4. Correctly deal with abi::__cxa_demangle() on LCC

    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().
    makise-homura committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    2aa1e7c View commit details
    Browse the repository at this point in the history