Skip to content

Commit 33e5510

Browse files
authored
[SYCL][E2E] Use system header search paths for SYCL headers in SYCL lit tests. (#18214)
SYCL header files contain some uses of deprecated declarations. When SYCL headers are found via a user header search path specified by the `CPATH` environment variable or the `-I` option, these uses can cause warnings to be produced that then cause tests that use `-Werror` to fail. This change updates lit configuration files to use `C_INCLUDE_PATH` and `CPLUS_INCLUDE_PATH` instead of `CPATH` and to use `-isystem` instead of `-I` to nominate header search paths for SYCL header files.
1 parent 79be841 commit 33e5510

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

sycl/test-e2e/lit.cfg.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,18 @@
126126
# Configure LD_LIBRARY_PATH or corresponding os-specific alternatives
127127
if platform.system() == "Linux":
128128
config.available_features.add("linux")
129-
llvm_config.with_system_environment(["LD_LIBRARY_PATH", "LIBRARY_PATH", "CPATH"])
129+
llvm_config.with_system_environment(
130+
["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]
131+
)
130132
llvm_config.with_environment(
131133
"LD_LIBRARY_PATH", config.sycl_libs_dir, append_path=True
132134
)
133135

134136
elif platform.system() == "Windows":
135137
config.available_features.add("windows")
136-
llvm_config.with_system_environment(["LIB", "CPATH", "INCLUDE"])
138+
llvm_config.with_system_environment(
139+
["LIB", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"]
140+
)
137141
llvm_config.with_environment("LIB", config.sycl_libs_dir, append_path=True)
138142
llvm_config.with_environment("PATH", config.sycl_libs_dir, append_path=True)
139143
llvm_config.with_environment(
@@ -142,14 +146,19 @@
142146

143147
elif platform.system() == "Darwin":
144148
# FIXME: surely there is a more elegant way to instantiate the Xcode directories.
145-
llvm_config.with_system_environment("CPATH")
149+
llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"])
146150
llvm_config.with_environment(
147-
"CPATH",
151+
"CPLUS_INCLUDE_PATH",
148152
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
149153
append_path=True,
150154
)
151155
llvm_config.with_environment(
152-
"CPATH",
156+
"C_INCLUDE_PATH",
157+
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
158+
append_path=True,
159+
)
160+
llvm_config.with_environment(
161+
"CPLUS_INCLUDE_PATH",
153162
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
154163
append_path=True,
155164
)
@@ -539,9 +548,9 @@ def open_check_file(file_name):
539548
"%sycl_options",
540549
" "
541550
+ os.path.normpath(os.path.join(config.sycl_libs_dir + "/../lib/sycl8.lib"))
542-
+ " /I"
551+
+ " -Xclang -isystem -Xclang "
543552
+ config.sycl_include
544-
+ " /I"
553+
+ " -Xclang -isystem -Xclang "
545554
+ os.path.join(config.sycl_include, "sycl"),
546555
)
547556
)
@@ -557,9 +566,9 @@ def open_check_file(file_name):
557566
(
558567
"%sycl_options",
559568
(" -lsycl8" if platform.system() == "Windows" else " -lsycl")
560-
+ " -I"
569+
+ " -isystem "
561570
+ config.sycl_include
562-
+ " -I"
571+
+ " -isystem "
563572
+ os.path.join(config.sycl_include, "sycl")
564573
+ " -L"
565574
+ config.sycl_libs_dir,

sycl/test/lit.cfg.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,19 @@
8989

9090
elif platform.system() == "Darwin":
9191
# FIXME: surely there is a more elegant way to instantiate the Xcode directories.
92-
llvm_config.with_system_environment("CPATH")
92+
llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"])
9393
llvm_config.with_environment(
94-
"CPATH",
94+
"CPLUS_INCLUDE_PATH",
9595
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
9696
append_path=True,
9797
)
9898
llvm_config.with_environment(
99-
"CPATH",
99+
"C_INCLUDE_PATH",
100+
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
101+
append_path=True,
102+
)
103+
llvm_config.with_environment(
104+
"CPLUS_INCLUDE_PATH",
100105
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/",
101106
append_path=True,
102107
)

0 commit comments

Comments
 (0)