[clang] Allow the no_stack_protector attribute on local variables (PR #173311)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 6 11:12:37 PST 2026


================
@@ -4,5 +4,10 @@
 [[clang::no_stack_protector]] void test2(void) {}
 
 void __attribute__((no_stack_protector)) foo(void) {}
-int __attribute__((no_stack_protector)) var; // expected-warning {{'no_stack_protector' attribute only applies to functions}}
+int __attribute__((no_stack_protector)) var; // expected-warning {{'no_stack_protector' attribute only applies to functions and local variables}}
 void  __attribute__((no_stack_protector(2))) bar(void) {} // expected-error {{'no_stack_protector' attribute takes no arguments}}
+
+void func()
+{
+	int __attribute__((no_stack_protector)) localvar;
+}
----------------
AaronBallman wrote:

Newline here as well

https://github.com/llvm/llvm-project/pull/173311


More information about the cfe-commits mailing list