opnsense-src/test/CodeGen/constructor-attribute.c

39 lines
606 B
C
Raw Normal View History

2010-01-01 05:34:51 -05:00
// RUN: %clang_cc1 -emit-llvm -o %t %s
2009-11-18 09:59:57 -05:00
// RUN: grep -e "global_ctors.*@A" %t
// RUN: grep -e "global_dtors.*@B" %t
// RUN: grep -e "global_ctors.*@C" %t
2009-06-02 13:58:47 -04:00
// RUN: grep -e "global_dtors.*@D" %t
2009-11-18 09:59:57 -05:00
int printf(const char *, ...);
2009-06-02 13:58:47 -04:00
void A() __attribute__((constructor));
void B() __attribute__((destructor));
void A() {
printf("A\n");
}
void B() {
printf("B\n");
}
static void C() __attribute__((constructor));
static void D() __attribute__((destructor));
static int foo() {
return 10;
}
static void C() {
printf("A: %d\n", foo());
}
static void D() {
printf("B\n");
}
int main() {
return 0;
}