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

Build and test googletest with IntelLLVM #4256

Merged

Conversation

niranjan-nilakantan
Copy link
Contributor

Make IntelLLVM use the same flags as Clang or MSVC (as appropriate).

Suppress warnings-as-error for the Windows build.

Use -ffp-model=precise or /fp:precise to override IntelLLVM's default choice of fast.

Use the same flags as Clang if the compiler id is IntelLLVM.

IntelLLVM warns if a double constant is assigned to a float.

```
[build] .../googletest/googletest/include/gtest/gtest-printers.h:516:17: warning: implicit conversion between floating point types of different sizes [-Wimplicit-float-size-conversion]
[build]       mulfor6 = 1e1;
```

IntelLLVM uses fp-model=fast by default, breaking IsNan and IsInf tests.
Use -ffp-model=precise to fix this.

IntelLLVM does not support -Wchar-subscripts

Fixes google#4255
Use /fp:precise to override IntelLLVM's default of /fp:fast.
This makes IsInf and IsNan work as expected by googletest.

```
[build]...\googletest\googlemock\test\gmock-function-mocker_test.cc(143,21): error: 'VoidReturning' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
[build]   MOCK_METHOD(void, VoidReturning, (int n));  // NOLINT
```

```
[build] ...\googletest\googlemock\test\gmock-function-mocker_test.cc(182,20): error: exception specification of overriding function is more lax than base version [-Werror,-Wmicrosoft-exception-spec]
[build]   MOCK_METHOD(int, CTNullary, (), (Calltype(STDMETHODCALLTYPE)));
```

```
[build] ...\googletest\googletest\test\googletest-death-test-test.cc(209,5): error: unused function 'DieInCRTDebugElse12' [-Werror,-Wunused-function]
[build] int DieInCRTDebugElse12(int* sideeffect) {
[build]     ^
```

```
[build] ...\googletest\googletest\test\gtest_unittest.cc(4096,7): error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
[build]   int n = 0;
```
@dinord dinord self-assigned this May 30, 2023
@dinord
Copy link
Collaborator

dinord commented May 30, 2023

Does IntelLLVM not support -Wchar-subscripts?

@niranjan-nilakantan
Copy link
Contributor Author

Does IntelLLVM not support -Wchar-subscripts?

When I enable this flag, I get the following warning.

[build] icpx: command line warning #10430: Unsupported command line options encountered
[build] These options as listed are not supported.
[build] For more information, use '-qnextgen-diag'.
[build] option list: 
[build] 	-Wchar-subscripts

The full list can be got from here.

docker pull intel/oneapi-basekit:latest

docker run -it intel/oneapi-basekit:latest icpx -qnextgen-diag
The LLVM based Intel Compiler maintains the expectation to be compatible with
the current Intel Compiler product. There are options and capabilities that
we may support in the future but are not currently available. There are also
options we do not plan to support.
options to be supported:
        -auto-p32
        ...
        -scalar-rep
options being removed:
        ...
        -Wchar-subscripts
        ...

@copybara-service copybara-service bot merged commit f625681 into google:main May 30, 2023
@niranjan-nilakantan niranjan-nilakantan deleted the niranjan-nilakantan/issue4255 branch May 30, 2023 20:43
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