[clang] [SystemZ] Update clang lit tests for default trigraphs on z/OS (PR #238549)

Sean Perry via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 14:04:11 PST 2026


https://github.com/perry-ca created https://github.com/llvm/llvm-project/pull/238549

Update the clang lit tests so they work (or marked as xfail) on z/OS with trigraphs being on by default.

>From a12b59041795a7366fa4bf9062d15e56f8d532d7 Mon Sep 17 00:00:00 2001
From: Sean Perry <perry at ca.ibm.com>
Date: Mon, 2 Nov 2026 22:46:39 -0500
Subject: [PATCH] [SystemZ] Update clang lit tests for default trigraphs on
 z/OS

---
 clang/test/C/C23/n2940.c                   | 1 +
 clang/test/C/drs/dr3xx.c                   | 8 ++++++++
 clang/test/Lexer/bcpl-escaped-newline.c    | 2 +-
 clang/test/SemaCXX/cxx2a-nttp-printing.cpp | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/clang/test/C/C23/n2940.c b/clang/test/C/C23/n2940.c
index ee92b6ec94a8c7..108cd3f4352b9b 100644
--- a/clang/test/C/C23/n2940.c
+++ b/clang/test/C/C23/n2940.c
@@ -1,3 +1,4 @@
+// XFAIL: target={{.*}}-zos{{.*}}
 // RUN: %clang_cc1 -verify=no-trigraphs -std=c23 %s
 // RUN: %clang_cc1 -verify=no-trigraphs -std=gnu23 %s
 // RUN: %clang_cc1 -verify=no-trigraphs -std=gnu17 %s
diff --git a/clang/test/C/drs/dr3xx.c b/clang/test/C/drs/dr3xx.c
index 0f67470b013a5d..c78b66710c89ec 100644
--- a/clang/test/C/drs/dr3xx.c
+++ b/clang/test/C/drs/dr3xx.c
@@ -289,11 +289,19 @@ void f(long double f,
 /* WG14 DR309: yes
  * Clarifying trigraph substitution
  */
+#ifdef __MVS__
+/* Trigraphs are enabled by default on z/OS in every language mode, so the
+ * same warnings are produced for all standards. */
+int dr309??(1??) = { 1 }; /* expected-warning {{trigraph converted to '[' character}}
+                             expected-warning {{trigraph converted to ']' character}}
+                           */
+#else
 int dr309??(1??) = { 1 }; /* c17andearlier-warning {{trigraph converted to '[' character}}
                              c17andearlier-warning {{trigraph converted to ']' character}}
                              c23andup-warning 2 {{trigraph ignored}}
                              c23andup-error {{expected ';' after top level declarator}}
                            */
+#endif
 
 /* NOTE: Due to interactions with the diagnostic system, dr309 should be the
  * last test case in this file because subsequent diagnostics may not be
diff --git a/clang/test/Lexer/bcpl-escaped-newline.c b/clang/test/Lexer/bcpl-escaped-newline.c
index 0883173b224fda..bf91551877f327 100644
--- a/clang/test/Lexer/bcpl-escaped-newline.c
+++ b/clang/test/Lexer/bcpl-escaped-newline.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -Eonly -ftrigraphs %s
-// RUN: %clang_cc1 -Eonly -verify %s
+// RUN: %clang_cc1 -Eonly -fno-trigraphs -verify %s
 
 //\
 #error bar
diff --git a/clang/test/SemaCXX/cxx2a-nttp-printing.cpp b/clang/test/SemaCXX/cxx2a-nttp-printing.cpp
index cace0bc94f3909..09360ca739f3c8 100644
--- a/clang/test/SemaCXX/cxx2a-nttp-printing.cpp
+++ b/clang/test/SemaCXX/cxx2a-nttp-printing.cpp
@@ -1,3 +1,4 @@
+// XFAIL: target={{.*}}-zos{{.*}}
 // RUN: %clang_cc1 %s -std=c++20 -fsyntax-only -verify
 
 template <int N> struct Str {



More information about the cfe-commits mailing list