[clang] [AIX] fix unsupported diff flag on AIX (-strip-trailing-cr) (PR #120276)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 09:50:54 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Mark Danial (madanial0)

<details>
<summary>Changes</summary>

https://github.com/llvm/llvm-project/pull/119666 adds the `-strip-trailing-cr` flag to diff which is not supported on AIX switch to use the python implementation of diff instead

---
Full diff: https://github.com/llvm/llvm-project/pull/120276.diff


1 Files Affected:

- (modified) clang/test/Format/lit.local.cfg (+8) 


``````````diff
diff --git a/clang/test/Format/lit.local.cfg b/clang/test/Format/lit.local.cfg
index 8acf02725d701b..b060c79226cbda 100644
--- a/clang/test/Format/lit.local.cfg
+++ b/clang/test/Format/lit.local.cfg
@@ -1,3 +1,6 @@
+import platform
+import lit.formats
+
 # Suffixes supported by clang-format.
 config.suffixes = [
     ".c",
@@ -19,3 +22,8 @@ config.suffixes = [
     ".td",
     ".test"
 ]
+
+# AIX 'diff' command doesn't support --strip-trailing-cr, but the internal
+# python implementation does, so use that for cross platform compatibility
+if platform.system() == "AIX":
+    config.test_format = lit.formats.ShTest()

``````````

</details>


https://github.com/llvm/llvm-project/pull/120276


More information about the cfe-commits mailing list