From a9e7fe19c7542001eeae75a3fb776fc270e24bae Mon Sep 17 00:00:00 2001 From: Udo Date: Sun, 9 Feb 2020 18:31:19 +0100 Subject: [PATCH] extend test 03_struct for attr. __cleanup__ --- tests/tests2/03_struct.c | 13 ++++++++++--- tests/tests2/03_struct.expect | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/tests2/03_struct.c b/tests/tests2/03_struct.c index c5d48c5..fd73133 100644 --- a/tests/tests2/03_struct.c +++ b/tests/tests2/03_struct.c @@ -1,6 +1,13 @@ -#include +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 natasha; @@ -8,7 +15,7 @@ struct fred int main() { - struct fred bloggs; + struct fred __attribute__((__cleanup__(fred$))) bloggs; bloggs.boris = 12; bloggs.natasha = 34; diff --git a/tests/tests2/03_struct.expect b/tests/tests2/03_struct.expect index ecbf589..be8df37 100644 --- a/tests/tests2/03_struct.expect +++ b/tests/tests2/03_struct.expect @@ -1,6 +1,8 @@ +03_struct.c:14: warning: attribute '__cleanup__' ignored on type 12 34 12 34 56 78 +~fred()