From 1a9ea0ee47f73e81892b6b6c1293633a8587a84a Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Sun, 27 Apr 2025 19:48:55 -0700 Subject: [PATCH 1/2] [SYCL][E2E] Use system header search paths for SYCL headers in SYCL lit tests. 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. --- sycl/test-e2e/lit.cfg.py | 23 ++++++++++++++--------- sycl/test/lit.cfg.py | 11 ++++++++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index a396c84a95863..d73967bfc16bc 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -126,14 +126,14 @@ # Configure LD_LIBRARY_PATH or corresponding os-specific alternatives if platform.system() == "Linux": config.available_features.add("linux") - llvm_config.with_system_environment(["LD_LIBRARY_PATH", "LIBRARY_PATH", "CPATH"]) + llvm_config.with_system_environment(["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]) llvm_config.with_environment( "LD_LIBRARY_PATH", config.sycl_libs_dir, append_path=True ) elif platform.system() == "Windows": config.available_features.add("windows") - llvm_config.with_system_environment(["LIB", "CPATH", "INCLUDE"]) + llvm_config.with_system_environment(["LIB", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"]) llvm_config.with_environment("LIB", config.sycl_libs_dir, append_path=True) llvm_config.with_environment("PATH", config.sycl_libs_dir, append_path=True) llvm_config.with_environment( @@ -142,14 +142,19 @@ elif platform.system() == "Darwin": # FIXME: surely there is a more elegant way to instantiate the Xcode directories. - llvm_config.with_system_environment("CPATH") + llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]) llvm_config.with_environment( - "CPATH", + "CPLUS_INCLUDE_PATH", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1", append_path=True, ) llvm_config.with_environment( - "CPATH", + "C_INCLUDE_PATH", + "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", + append_path=True, + ) + llvm_config.with_environment( + "CPLUS_INCLUDE_PATH", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", append_path=True, ) @@ -537,9 +542,9 @@ def open_check_file(file_name): "%sycl_options", " " + os.path.normpath(os.path.join(config.sycl_libs_dir + "/../lib/sycl8.lib")) - + " /I" + + " -Xclang -isystem -Xclang " + config.sycl_include - + " /I" + + " -Xclang -isystem -Xclang " + os.path.join(config.sycl_include, "sycl"), ) ) @@ -555,9 +560,9 @@ def open_check_file(file_name): ( "%sycl_options", (" -lsycl8" if platform.system() == "Windows" else " -lsycl") - + " -I" + + " -isystem " + config.sycl_include - + " -I" + + " -isystem " + os.path.join(config.sycl_include, "sycl") + " -L" + config.sycl_libs_dir, diff --git a/sycl/test/lit.cfg.py b/sycl/test/lit.cfg.py index dfe1e6a231616..47f6e1e007a72 100644 --- a/sycl/test/lit.cfg.py +++ b/sycl/test/lit.cfg.py @@ -89,14 +89,19 @@ elif platform.system() == "Darwin": # FIXME: surely there is a more elegant way to instantiate the Xcode directories. - llvm_config.with_system_environment("CPATH") + llvm_config.with_system_environment(["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]) llvm_config.with_environment( - "CPATH", + "CPLUS_INCLUDE_PATH", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1", append_path=True, ) llvm_config.with_environment( - "CPATH", + "C_INCLUDE_PATH", + "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", + append_path=True, + ) + llvm_config.with_environment( + "CPLUS_INCLUDE_PATH", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", append_path=True, ) From 0027bf22720526a8bda877f5e68d0a2c03bc8835 Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Mon, 28 Apr 2025 13:22:16 -0700 Subject: [PATCH 2/2] Address code format complaints. --- sycl/test-e2e/lit.cfg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index d73967bfc16bc..a6d006a8a78b0 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -126,14 +126,18 @@ # Configure LD_LIBRARY_PATH or corresponding os-specific alternatives if platform.system() == "Linux": config.available_features.add("linux") - llvm_config.with_system_environment(["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"]) + llvm_config.with_system_environment( + ["LD_LIBRARY_PATH", "LIBRARY_PATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH"] + ) llvm_config.with_environment( "LD_LIBRARY_PATH", config.sycl_libs_dir, append_path=True ) elif platform.system() == "Windows": config.available_features.add("windows") - llvm_config.with_system_environment(["LIB", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"]) + llvm_config.with_system_environment( + ["LIB", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"] + ) llvm_config.with_environment("LIB", config.sycl_libs_dir, append_path=True) llvm_config.with_environment("PATH", config.sycl_libs_dir, append_path=True) llvm_config.with_environment(