[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / attr-maybeundef.c
blob09bb287bfc4b49e523aa137107cc57884bd73273
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // Decl annotations.
4 void f(int __attribute__((maybe_undef)) *a);
5 void (*fp)(int __attribute__((maybe_undef)) handle);
6 __attribute__((maybe_undef)) int i(); // expected-warning {{'maybe_undef' attribute only applies to parameters}}
7 int __attribute__((maybe_undef)) a; // expected-warning {{'maybe_undef' attribute only applies to parameters}}
8 int (* __attribute__((maybe_undef)) fpt)(char *); // expected-warning {{'maybe_undef' attribute only applies to parameters}}
9 void h(int *a __attribute__((maybe_undef("RandomString")))); // expected-error {{'maybe_undef' attribute takes no arguments}}
11 // Type annotations.
12 int __attribute__((maybe_undef)) ta; // expected-warning {{'maybe_undef' attribute only applies to parameters}}
14 // Typedefs.
15 typedef int callback(char *) __attribute__((maybe_undef)); // expected-warning {{'maybe_undef' attribute only applies to parameters}}