mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-15 05:20:06 +08:00
More cleanup tests
test3 wasn't working originally.
This commit is contained in:
parent
4cc802a88e
commit
08e22d8ad2
@ -1,5 +1,4 @@
|
||||
#include <tcclib.h>
|
||||
|
||||
extern int printf(const char*, ...);
|
||||
static int glob_i = 0;
|
||||
|
||||
void incr_glob_i(int *i)
|
||||
@ -115,6 +114,41 @@ void test_ret2()
|
||||
}
|
||||
}
|
||||
|
||||
void test2(void) {
|
||||
int chk = 0;
|
||||
again:
|
||||
if (!chk) {
|
||||
char * __attribute__ ((cleanup(check2))) stop_that = "test2";
|
||||
chk++;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
||||
int test3(void) {
|
||||
char * __attribute__ ((cleanup(check2))) stop_that = "three";
|
||||
int chk = 0;
|
||||
|
||||
if (chk) {
|
||||
{
|
||||
outside:
|
||||
{
|
||||
char * __attribute__ ((cleanup(check2))) stop_that = "two";
|
||||
printf("---- %d\n", chk);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!chk)
|
||||
{
|
||||
char * __attribute__ ((cleanup(check2))) stop_that = "one";
|
||||
|
||||
if (!chk) {
|
||||
chk = 1;
|
||||
goto outside;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int i __attribute__ ((__cleanup__(check))) = 0, not_i;
|
||||
@ -138,6 +172,8 @@ int main()
|
||||
printf("because what if free was call inside cleanup function\n", test());
|
||||
test_ret();
|
||||
test_ret2();
|
||||
test2();
|
||||
test3();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,11 @@ str: that
|
||||
str: this should appear only once
|
||||
str: -that2
|
||||
str: -that
|
||||
str: test2
|
||||
str: one
|
||||
---- 1
|
||||
str: two
|
||||
str: three
|
||||
---- 0
|
||||
---- 1
|
||||
str: plop
|
||||
|
Loading…
Reference in New Issue
Block a user