Skip to content

Conversation

aelovikov-intel
Copy link
Contributor

It contains all our "-Werror/-W*/etc." that we use to build the project that have nothing to do with our end-to-end tests.

…iguration

It contains all our "-Werror/-W*/etc." that we use to build the project
that have nothing to do with our end-to-end tests.
@aelovikov-intel aelovikov-intel requested a review from a team as a code owner April 14, 2023 17:34
@aelovikov-intel
Copy link
Contributor Author

Also tagging @frasercrmck because I can't add him to the reviewers.

@aelovikov-intel aelovikov-intel temporarily deployed to aws April 14, 2023 17:59 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws April 14, 2023 18:30 — with GitHub Actions Inactive
@@ -17,6 +17,7 @@ if(SYCL_TEST_E2E_STANDALONE)
set(SYCL_CXX_COMPILER ${CMAKE_CXX_COMPILER})
else()
set(SYCL_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++")
unset(CMAKE_CXX_FLAGS)
Copy link
Contributor

Choose a reason for hiding this comment

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

probably should have a comment. The one you put in the PR would suffice.

Copy link
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

one comment. otherwise LGTM

@aelovikov-intel aelovikov-intel temporarily deployed to aws April 14, 2023 23:40 — with GitHub Actions Inactive
@aelovikov-intel aelovikov-intel temporarily deployed to aws April 15, 2023 00:57 — with GitHub Actions Inactive
@aelovikov-intel
Copy link
Contributor Author

@intel/llvm-gatekeepers , this PR is ready.

@steffenlarsen steffenlarsen merged commit e83e16d into intel:sycl Apr 17, 2023
@aelovikov-intel aelovikov-intel deleted the intree-e2e-cmake-cxx-flags branch May 1, 2023 16:14
Maetveis added a commit to Maetveis/llvm that referenced this pull request Sep 10, 2025
Before intel#9075 the value of CMAKE_CXX_FLAGS was passed to SYCL E2E
compilations. In intel#9075 the variable was explicitly unset in
non-standalone (in-tree) builds of the tests. Unsetting a normal
variable however exposes the cmake cache variable of the same name.

I believe this was not the intent, rather the intent was to not pass
any CMAKE_CXX_FLAGS to the E2E tests in non-standalone builds. It is weird
to pass the user's CMAKE_CXX_FLAGS to the E2E tests, as these flags
are for the SYCL toolchain, not tests.

Passing `CMAKE_CXX_FLAGS` to the E2E tests can cause problems, for example
a test might wish to override options such as setting `-ffp-model=fast`, but this can
fails with a warning/error if `CMAKE_CXX_FLAGS` contains `-ffp-model=precise`:
`error: overriding '-ffp-model=precise' option with '-ffp-model=fast' [-Werror,-Woverriding-option]`.

While the error could be worked around in the test by appending `-Wno-overriding-option`
to the test flags, I don't believe this is the right solution.

It is possible that the user is running on a system where some flags
have to be passed to clang++ to make it produce working executables.
For this reason, allow setting `SYCL_E2E_CLANG_CXX_FLAGS` by the user
if needed in in-tree builds, but do not pass `CMAKE_CXX_FLAGS` by default.

Contains a drive-by fix to make sure `-Werror` is passed to clang++ even
when the c++ flags are overriden by the lit parameter `--param cxx_flags=...`
(it can still be disabled using `-Wno-error` explicitly).
sarnex pushed a commit that referenced this pull request Sep 11, 2025
…20039)

Before #9075 the value of CMAKE_CXX_FLAGS was passed to SYCL E2E
compilations. In #9075 the variable was explicitly unset in
non-standalone (in-tree) builds of the tests. Unsetting a normal
variable however exposes the cmake cache variable of the same name.

I believe this was not the intent, rather the intent was to not pass any
CMAKE_CXX_FLAGS to the E2E tests in non-standalone builds. It is weird
to pass the user's CMAKE_CXX_FLAGS to the E2E tests, as these flags are
for the SYCL toolchain, not tests.

Passing `CMAKE_CXX_FLAGS` to the E2E tests can cause problems, for
example a test might wish to override options such as setting
`-ffp-model=fast`, but this fails with a warning/error if
`CMAKE_CXX_FLAGS` contains `-ffp-model=precise`: `error: overriding
'-ffp-model=precise' option with '-ffp-model=fast'
[-Werror,-Woverriding-option]`.

While the error could be worked around in the test by appending
`-Wno-overriding-option` to the test flags, I don't believe this is the
right solution.

It is possible that the user is running on a system where some flags
have to be passed to clang++ to make it produce working executables. For
this reason, allow setting `SYCL_E2E_CLANG_CXX_FLAGS` by the user if
needed in in-tree builds, but do not pass `CMAKE_CXX_FLAGS` by default.

Contains a drive-by fix to make sure `-Werror` is passed to clang++ even
when the c++ flags are overriden by the lit parameter `--param
cxx_flags=...` (it can still be disabled using `-Wno-error` explicitly).
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.

3 participants