[clang] [clang-cl][test] Use /Zs to avoid writing unnecessary output files (PR #204501)

Jordan Rupprecht via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 17 19:02:58 PDT 2026


https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/204501

#194779 adds a test clang/test/Preprocessor/init-datetime-macros.c which verifies some diagnostics. However, it does so with `/c`, which will unnecessarily generate an output, and when run on a build system that does not run tests in a writeable dir by default, will cause the test to fail.

Since we don't care about the resulting object file, use `/Zs` (equivalent of `-fsyntax-only`) to check the diagnostics but not produce any output files.

>From c607149537736204c253e1dd7a98d11ee961d397 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht <rupprecht at google.com>
Date: Wed, 17 Jun 2026 18:59:08 -0700
Subject: [PATCH] Use /Zs

---
 clang/test/Preprocessor/init-datetime-macros.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/Preprocessor/init-datetime-macros.c b/clang/test/Preprocessor/init-datetime-macros.c
index 239bafd2b241e..685cbdd617314 100644
--- a/clang/test/Preprocessor/init-datetime-macros.c
+++ b/clang/test/Preprocessor/init-datetime-macros.c
@@ -27,7 +27,7 @@
 //  /d1nodatetime - undefines __DATE__, __TIME__ and __TIMESTAMP__
 //  /Brepro - sets __DATE__, __TIME__ and __TIMESTAMP__ to "1"
 
-// RUN: %clang_cl -Xclang -verify /d1nodatetime /DDATETIME_UNDEFINED /c -- %s
+// RUN: %clang_cl -Xclang -verify /d1nodatetime /DDATETIME_UNDEFINED /Zs -- %s
 
 // RUN: %clang_cl -E /Brepro /DDATETIME_LITERALONE -- %s | FileCheck %s --check-prefix CHECK-INIT-DATETIME-LITERALONE
 



More information about the cfe-commits mailing list