extend test 03_struct for attr. __cleanup__

This commit is contained in:
Udo 2020-02-09 18:31:19 +01:00
parent 89b3cf0b87
commit a9e7fe19c7
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,13 @@
#include <stdio.h> extern int printf(const char*, ...);
struct fred struct fred;
void fred$(struct fred* this)
{
printf("~fred()\n");
}
struct __attribute__((__cleanup__(fred$))) fred
{ {
int boris; int boris;
int natasha; int natasha;
@ -8,7 +15,7 @@ struct fred
int main() int main()
{ {
struct fred bloggs; struct fred __attribute__((__cleanup__(fred$))) bloggs;
bloggs.boris = 12; bloggs.boris = 12;
bloggs.natasha = 34; bloggs.natasha = 34;

View File

@ -1,6 +1,8 @@
03_struct.c:14: warning: attribute '__cleanup__' ignored on type
12 12
34 34
12 12
34 34
56 56
78 78
~fred()