[clang] Allow the no_stack_protector attribute on local variables (PR #173311)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 14 11:46:41 PST 2026
================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int __attribute__((stack_protector_ignore)) global_var; // expected-warning {{'stack_protector_ignore' attribute only applies to local variables}}
+
+void __attribute__((stack_protector_ignore)) func(void) {} // expected-warning {{'stack_protector_ignore' attribute only applies to local variables}}
+
+void func2(void) {
+ __attribute__((stack_protector_ignore)) int var;
+ __attribute__((stack_protector_ignore)) static int var2; // expected-warning {{'stack_protector_ignore' attribute only applies to local variables}}
+ __attribute__((stack_protector_ignore(2))) int var3; // expected-error {{'stack_protector_ignore' attribute takes no arguments}}
+ __attribute__((stack_protector_ignore)) var + var; // expected-error {{expected identifier or '('}}
----------------
cooperp wrote:
Done
https://github.com/llvm/llvm-project/pull/173311
More information about the cfe-commits
mailing list