[clang] [Clang] Fix rewrite-includes-bom.c to use POSIX-compliant regex (PR #176043)
Alison Zhang via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 14 14:07:02 PST 2026
https://github.com/azhan92 created https://github.com/llvm/llvm-project/pull/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.
>From d988aa08aea7f6445d230fe80c378a892903874a Mon Sep 17 00:00:00 2001
From: Alison Zhang <alisonzhang at ibm.com>
Date: Wed, 14 Jan 2026 17:02:56 -0500
Subject: [PATCH] Fix rewrite-includes-bom.c to use posix grep regex
---
clang/test/Frontend/rewrite-includes-bom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 cfe-commits
mailing list