Skip to content

[SYCL][NFC] Use -fsyntax-only more extensively in LIT tests #8144

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/accessor/addrspace_exposure.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//==------- addrspace_exposure.cpp - SYCL accessor AS exposure test --------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx -fsycl -fsyntax-only %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only -fsycl-targets=spir64_fpga %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
// RUN: %clangxx -fsycl -fsyntax-only -fsycl-targets=spir64_fpga %s

// When using zero dimension accessors with atomic access we
// want to make sure they are compiling correctly on all devices,
Expand Down Expand Up @@ -63,4 +63,4 @@ int main(int argc, char *argv[]) {
std::cout << std::endl;

return 0;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised to see dynamic asserts in this test (lines 56/57). Unrelated to this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test was added like this in #4458. We should probably be more careful when reviewing tests and perhaps we should do another round of tests review to refactor them, i.e.:

  • move to llvm-test-suite anything which requires actual devices
  • and/or rewrite that to unit-tests
  • remove runtime checks from -fsyntax-only tests to simplify and cleanup them

2 changes: 1 addition & 1 deletion sycl/test/basic_tests/atomic-ref-instantiation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -o %t.out -Xclang -verify-ignore-unexpected=note
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note
// expected-no-diagnostics
#include <sycl/atomic_ref.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/cl_sycl_hpp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -c -o %t.o
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <CL/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/define_vendors.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -c -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
#include <sycl/sycl.hpp>

#if !defined(SYCL_IMPLEMENTATION_ONEAPI)
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/generic_type_traits.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <cassert>
#include <iostream>
Expand Down
8 changes: 4 additions & 4 deletions sycl/test/basic_tests/interop-cuda.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// REQUIRES: cuda
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s
//
/// Also test the experimental CUDA interop interface
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API -DSYCL_EXT_ONEAPI_BACKEND_CUDA_EXPERIMENTAL %s
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this particular file, it's just when I realized it... What if a mistake is done inside the pi.def-related mapping and some symbol/offset is missing, would -fsyntax-only catch that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand correctly, it is likely that SYCL RT (or unit-tests) won't be built at all.

For example, if you add something new into pi.def, but not anywhere else, then the following piece of code will try to reference non-existing function:

struct FunctionPointers {
#define _PI_API(api) decltype(::api) *api;
#include <sycl/detail/pi.def>
} PiFunctionTable;

// expected-no-diagnostics

// Test for legacy and experimental CUDA interop API
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/basic_tests/interop-hip.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// REQUIRES: hip_be
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s
// expected-no-diagnostics

// Test for HIP interop API
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/basic_tests/interop-level-zero-2020.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -D__SYCL_INTERNAL_API %s

// Test for SYCL-2020 Level Zero interop API

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/kernel_size_mismatch.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning -o - %s
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s

// Tests for static assertion failure when kernel lambda mismatches between host
// and device.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/parallel_for_user_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -c -o %t.o
// RUN: %clangxx -fsycl -fsyntax-only %s

// This test performs basic check of supporting user defined class that are
// implicitly converted from sycl::item/sycl::nd_item in parallel_for.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//=---queue_offset_shortcut_initlist.cpp - SYCL queue offset shortcuts test--=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

//==- queue_parallel_for_generic.cpp - SYCL queue parallel_for interface test -=//
//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/single_task_error_message.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note -o - %s
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
#include <iostream>
#include <sycl/sycl.hpp>
int main() {
Expand Down
10 changes: 5 additions & 5 deletions sycl/test/basic_tests/stdcpp_compat.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify-ignore-unexpected=error,note,warning -Xclang -verify=expected,cxx14 %s -c -o %t.out
// RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify-ignore-unexpected=error,note,warning -Xclang -verify=cxx14,warning_extension,expected %s -c -o %t.out
// RUN: %clangxx -std=c++17 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out
// RUN: %clangxx -std=c++20 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out
// RUN: %clangxx -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s -c -o %t.out
// RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify-ignore-unexpected=error,note,warning -Xclang -verify=expected,cxx14 %s
// RUN: %clangxx -std=c++14 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify-ignore-unexpected=error,note,warning -Xclang -verify=cxx14,warning_extension,expected %s
// RUN: %clangxx -std=c++17 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -std=c++20 -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s
// RUN: %clangxx -fsycl -Wall -pedantic -Wno-c99-extensions -Wno-deprecated -fsyntax-only -Xclang -verify %s

// The test checks SYCL headers C++ compiance and that a warning is emitted
// when compiling in < C++17 mode.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/stream/byte.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note,warning %s
// expected-error@sycl/stream.hpp:* {{Convert the byte to a numeric value using std::to_integer}}

#include <sycl/sycl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/basic_tests/version.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/extensions/fpga.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <sycl/ext/intel/fpga_extensions.hpp>
#include <sycl/sycl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/extensions/inline_asm.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is a basic acceptance test for inline ASM feature. More tests can be
// found in https://github.com/intel/llvm-test-suite/tree/intel/SYCL/InlineAsm
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <cmath>
#include <iostream>
Expand Down
31 changes: 17 additions & 14 deletions sycl/test/extensions/macro.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
// This test checks presence of macros for available extensions.
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <iostream>
#include <sycl/sycl.hpp>
int main() {

#if SYCL_BACKEND_OPENCL == 1
std::cout << "SYCL_BACKEND_OPENCL=1" << std::endl;
constexpr bool backend_opencl_macro_defined = true;
#else
std::cerr << "SYCL_BACKEND_OPENCL!=1" << std::endl;
exit(1);
constexpr bool backend_opencl_macro_defined = false;
#endif

#if SYCL_EXT_ONEAPI_SUB_GROUP_MASK == 1
std::cout << "SYCL_EXT_ONEAPI_SUB_GROUP_MASK=1" << std::endl;
constexpr bool sub_group_mask_macro_defined = true;
#else
std::cerr << "SYCL_EXT_ONEAPI_SUB_GROUP_MASK!=1" << std::endl;
exit(1);
constexpr bool sub_group_mask_macro_defined = false;
#endif

#if SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO == 3
std::cout << "SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO=3" << std::endl;
constexpr bool backend_level_zero_macro_defined = true;
#else
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_LEVEL_ZERO!=3" << std::endl;
exit(1);
constexpr bool backend_level_zero_macro_defined = false;
#endif
exit(0);

int main() {
static_assert(backend_opencl_macro_defined);
static_assert(sub_group_mask_macro_defined);
static_assert(backend_level_zero_macro_defined);

return 0;
}
18 changes: 10 additions & 8 deletions sycl/test/extensions/macro_cuda.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// This test checks presence of macros for available extensions.
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
// REQUIRES: cuda_be
#include <iostream>

#include <sycl/sycl.hpp>
int main() {

#if SYCL_EXT_ONEAPI_BACKEND_CUDA == 1
std::cout << "SYCL_EXT_ONEAPI_BACKEND_CUDA=1" << std::endl;
constexpr bool macro_defined = true;
#else
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_CUDA!=1" << std::endl;
exit(1);
constexpr bool macro_defined = false;
#endif
exit(0);

int main() {
static_assert(macro_defined);

return 0;
}
18 changes: 10 additions & 8 deletions sycl/test/extensions/macro_esimd_emulator.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// This test checks presence of macros for available extensions.
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
// REQUIRES: esimd_emulator_be
#include <iostream>

#include <sycl/sycl.hpp>
int main() {

#if SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR == 1
std::cout << "SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR=1" << std::endl;
constexpr bool macro_defined = true;
#else
std::cerr << "SYCL_EXT_INTEL_BACKEND_ESIMD_EMULATOR!=1" << std::endl;
exit(1);
constexpr bool macro_defined = false;
#endif
exit(0);

int main() {
static_assert(macro_defined);

return 0;
}
18 changes: 10 additions & 8 deletions sycl/test/extensions/macro_hip.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// This test checks presence of macros for available extensions.
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
// REQUIRES: hip_be
#include <iostream>

#include <sycl/sycl.hpp>
int main() {

#if SYCL_EXT_ONEAPI_BACKEND_HIP == 1
std::cout << "SYCL_EXT_ONEAPI_BACKEND_HIP=1" << std::endl;
constexpr bool macro_defined = true;
#else
std::cerr << "SYCL_EXT_ONEAPI_BACKEND_HIP!=1" << std::endl;
exit(1);
constexpr bool macro_defined = false;
#endif
exit(0);

int main() {
static_assert(macro_defined);

return 0;
}
2 changes: 1 addition & 1 deletion sycl/test/extensions/test_complex.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#define SYCL_EXT_ONEAPI_COMPLEX

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/async_work_group_copy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o -
// RUN: %clangxx -fsycl -fsyntax-only %s

// Test checks for that no compile errors occur for
// builtin async_work_group_copy
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/buffer_from_rvalue.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
// expected-no-diagnostics

#include <sycl/sycl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/copy-with-unnamed-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsyntax-only %s
// The purpose of this test is to check that the following code can be
// successfully compiled
#include <sycl/sycl.hpp>
Expand Down
3 changes: 1 addition & 2 deletions sycl/test/regression/half_union.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/headers_conflict.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -o %t.out -Xclang -verify-ignore-unexpected=note,warning
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//
//===----------------------------------------------------------------------===//
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/regression/multi_ptr_gen_casting.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//
// Tests that casting multi_ptr to and from generic compiles for various
// combinations of valid qualifiers.
Expand Down
5 changes: 1 addition & 4 deletions sycl/test/regression/operator-names.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// RUN: %clangxx -fsycl -c %s -o %t.out -Wno-deprecated -fno-operator-names
// RUN: %clangxx -fsycl -fsyntax-only %s -Wno-deprecated -fno-operator-names
Copy link
Contributor

Choose a reason for hiding this comment

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

Line 7?

Copy link
Contributor

Choose a reason for hiding this comment

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

it does not appear to respect the -fno-operator-names option

What does it mean? Modified test passes.

I suggest we a use of operator name in the test itself and add --verify option with checks that operator names are used in the test, but no detected in the headers.

BTW, I suppose DPC++ extensions, which are not implicitly included by <sycl/sycl.hpp> should be tested as well. Right?

@Pennycook, FYI.

Copy link
Contributor Author

@AlexeySachkov AlexeySachkov Jan 31, 2023

Choose a reason for hiding this comment

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

It seems like the comment on line 7 is not correct. From my local experiments:

$ ./bin/clang++ -fsyntax-only t.cpp -fno-operator-names
t.cpp:2:13: error: expected ')'
  if (a > b and b >c ) {
            ^
t.cpp:2:6: note: to match this '('
  if (a > b and b >c ) {
     ^
1 error generated.
$ ./bin/clang++ -fsyntax-only t.cpp -foperator-names
$ echo $?
0

UPD: -fsycl doesn't alter the behavior, -fno-operator-names still works as expected with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the comment in b29ae74

//
//===----------------------------------------------------------------------===//
// This test checks if any SYCL header files use C++ operator name keywords
// e.g. and, or, not
//
// This test does not use -fsyntax-only because it does not appear to respect
// the -fno-operator-names option
//===----------------------------------------------------------------------===//

#include <sycl/sycl.hpp>
2 changes: 1 addition & 1 deletion sycl/test/regression/unnamed-lambda-split-order.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsyntax-only %s
#include "sycl.hpp"

// This validates the case where using a lambda in a kernel in a different order
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/regression/unnamed-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %clangxx -fsycl -c %s -o %t.temp
// RUN: %clangxx -fsycl -sycl-std=1.2.1 -c %s -o %t.temp
// RUN: %clangxx -fsycl -fsyntax-only %s
// RUN: %clangxx -fsycl -sycl-std=1.2.1 -fsyntax-only %s

#include "sycl.hpp"

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/type_traits/half_operator_types.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//==-------------- type_traits.cpp - SYCL type_traits test -----------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/type_traits/integer_n_bit.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//==---- integer_n_bit.cpp - SYCL integerNbit type traits test -------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/type_traits/type_list.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//==---------------- type_list.cpp - SYCL type_list test -------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/type_traits/type_traits.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl %s -o %t.out
// RUN: %clangxx -fsycl -fsyntax-only %s
//==-------------- type_traits.cpp - SYCL type_traits test -----------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
Expand Down
2 changes: 1 addition & 1 deletion sycl/test/warnings/free_function_leader.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/warnings/group_local_memory_deprecation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx -fsycl-device-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx -fsycl-device-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/warnings/interop_task_deprecation.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/warnings/run_on_host_intel_deprecation.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s

#include <sycl/sycl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/test/warnings/sycl_2020_deprecations.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clangxx %fsycl-host-only -fsyntax-only -ferror-limit=0 -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
// RUN: %clangxx %fsycl-host-only -fsyntax-only -ferror-limit=0 -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s

#include <CL/sycl.hpp>
#include <sycl/ext/intel/experimental/online_compiler.hpp>
Expand Down