llvm-project/clang/test/Sema/attr-used.c
Aaron Ballman e765e0bc8e Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the first batch of tests being updated (there are a significant
number of other tests left to be updated).
2022-02-03 16:42:27 -05:00

21 lines
822 B
C

// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
extern int l0 __attribute__((used)); // expected-warning {{'used' attribute ignored on a non-definition declaration}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{'used' attribute ignored on a non-definition declaration}}
struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables with non-local storage, functions, and Objective-C methods}}
int x;
};
int a __attribute__((used));
static void __attribute__((used)) f0(void) {
}
void f1(void) {
static int a __attribute__((used));
int b __attribute__((used)); // expected-warning {{'used' attribute only applies to variables with non-local storage, functions, and Objective-C methods}}
}
static void __attribute__((used)) f0(void);