[clang] [Clang] Fix rewrite-includes-bom.c to use POSIX-compliant regex (PR #176043)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 14 14:07:34 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Alison Zhang (azhan92)
<details>
<summary>Changes</summary>
As `\s` is a GNU extension, it is not supported by the system grep on AIX and thus fails in the [buildbot](https://lab.llvm.org/buildbot/#/builders/64/builds/6835):
```
******************** TEST 'Clang :: Frontend/rewrite-includes-bom.c' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
cat /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/Frontend/Inputs/rewrite-includes-bom.h | od -t x1 | grep -q 'ef\s*bb\s*bf'
# executed command: cat /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/Frontend/Inputs/rewrite-includes-bom.h
# executed command: od -t x1
# executed command: grep -q 'ef\s*bb\s*bf'
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
--
********************
```
This change replaces `\s` with the POSIX-compliant `[[:space::]]` so the test is supported on AIX.
---
Full diff: https://github.com/llvm/llvm-project/pull/176043.diff
1 Files Affected:
- (modified) clang/test/Frontend/rewrite-includes-bom.c (+2-2)
``````````diff
diff --git a/clang/test/Frontend/rewrite-includes-bom.c b/clang/test/Frontend/rewrite-includes-bom.c
index 27bf470ba1fd1..0c60ee66c8e73 100644
--- a/clang/test/Frontend/rewrite-includes-bom.c
+++ b/clang/test/Frontend/rewrite-includes-bom.c
@@ -1,6 +1,6 @@
-// RUN: cat %S/Inputs/rewrite-includes-bom.h | od -t x1 | grep -q 'ef\s*bb\s*bf'
+// RUN: cat %S/Inputs/rewrite-includes-bom.h | od -t x1 | grep -q 'ef[[:space:]]*bb[[:space:]]*bf'
// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o %t.c
-// RUN: cat %t.c | od -t x1 | not grep -q 'ef\s*bb\s*bf'
+// RUN: cat %t.c | od -t x1 | not grep -q 'ef[[:space:]]*bb[[:space:]]*bf'
// RUN: %clang_cc1 -fsyntax-only -verify %t.c
// expected-no-diagnostics
// UNSUPPORTED: system-windows
``````````
</details>
https://github.com/llvm/llvm-project/pull/176043
More information about the cfe-commits
mailing list