xref: /llvm-project/clang/test/Sema/attr-maybeundef.c (revision 09c41211231578765cdb296bda3b4c7f3c22b4ba)
1 // RUN: %clang_cc1  -fsyntax-only -verify %s
2 
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}}
10 
11 // Type annotations.
12 int __attribute__((maybe_undef)) ta; // expected-warning {{'maybe_undef' attribute only applies to parameters}}
13 
14 // Typedefs.
15 typedef int callback(char *) __attribute__((maybe_undef)); // expected-warning {{'maybe_undef' attribute only applies to parameters}}
16