[llvm-branch-commits] [clang] db99723 - [Clang] Fix rewrite-includes-bom.c to use POSIX-compliant regex (#176043)

Cullen Rhodes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 28 01:25:19 PST 2026


Author: Alison Zhang
Date: 2026-01-28T09:25:10Z
New Revision: db9972322071ceb5206605186ab37aaf08bdf11b

URL: https://github.com/llvm/llvm-project/commit/db9972322071ceb5206605186ab37aaf08bdf11b
DIFF: https://github.com/llvm/llvm-project/commit/db9972322071ceb5206605186ab37aaf08bdf11b.diff

LOG: [Clang] Fix rewrite-includes-bom.c to use POSIX-compliant regex (#176043)

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.

Co-authored-by: Alison Zhang <alisonzhang at ibm.com>
(cherry picked from commit 8ac6c4adbdf014b6d384d9a9120dc2318aab10a4)

Added: 
    

Modified: 
    clang/test/Frontend/rewrite-includes-bom.c

Removed: 
    


################################################################################
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


        


More information about the llvm-branch-commits mailing list