[clang] 75d1cce - Add missing RUN lines to test

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 04:25:35 PDT 2025


Author: Aaron Ballman
Date: 2025-05-01T07:25:28-04:00
New Revision: 75d1cceb948666af9b2cb26fc3933d4176a2806d

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

LOG: Add missing RUN lines to test

These were intended to be present when 00f9ef282c7482754a0fea497417604d1deca9fa
landed

Added: 
    

Modified: 
    clang/test/Sema/warn-default-const-init.c

Removed: 
    


################################################################################
diff  --git a/clang/test/Sema/warn-default-const-init.c b/clang/test/Sema/warn-default-const-init.c
index b6c593e578bd5..da11f4189047f 100644
--- a/clang/test/Sema/warn-default-const-init.c
+++ b/clang/test/Sema/warn-default-const-init.c
@@ -1,5 +1,28 @@
+// Both of these should enable everything.
+// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field,zero-init-var,zero-init-field -Wc++-compat %s
+// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field,zero-init-var,zero-init-field -Wdefault-const-init %s
+
+// This should enable nothing.
+// RUN: %clang_cc1 -fsyntax-only -verify=good -Wno-default-const-init-unsafe %s
+
+// Only unsafe field and variable diagnostics
+// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field %s
 // RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field -Wdefault-const-init-unsafe %s
 
+// Only zero init field and variable diagnostics
+// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-var,zero-init-field -Wdefault-const-init -Wno-default-const-init-unsafe %s
+
+// Only zero init and unsafe field diagnostics
+// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-field,unsafe-field -Wno-default-const-init-var-unsafe -Wdefault-const-init-field %s
+
+// Only zero init and unsafe variable diagnostics
+// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-var,unsafe-var -Wno-default-const-init-field-unsafe -Wdefault-const-init-var %s
+
+// C++ tests
+// RUN: %clang_cc1 -fsyntax-only -verify=cxx -x c++ %s
+
+// good-no-diagnostics
+
 struct A { int i; };
 struct S{ const int i; };              // unsafe-field-note 2 {{member 'i' declared 'const' here}} \
                                           cxx-note 3 {{default constructor of 'S' is implicitly deleted because field 'i' of const-qualified type 'const int' would not be initialized}}
@@ -45,7 +68,7 @@ static const int j; // zero-init-var-warning {{default initialization of an obje
                        cxx-error {{default initialization of an object of const type 'const int'}}
 const int k;        // zero-init-var-warning {{default initialization of an object of type 'const int' is incompatible with C++}} \
                        cxx-error {{default initialization of an object of const type 'const int'}}
-const struct S s;   // zero-init-field-warning {{default initialization of an object of type 'const struct S' is incompatible with C++}} \
+const struct S s;   // zero-init-var-warning {{default initialization of an object of type 'const struct S' is incompatible with C++}} \
                        cxx-error {{call to implicitly-deleted default constructor of 'const struct S'}}
 
 void func() {


        


More information about the cfe-commits mailing list