From 275401c06aeb96193f0a0c35dc3bbb916d8b5fdc Mon Sep 17 00:00:00 2001 From: Egor00f Date: Sun, 22 Feb 2026 14:07:38 +0500 Subject: [PATCH] libc.obj: add `atexit` test --- .../ktcc/trunk/libc.obj/samples/Makefile | 3 ++- .../ktcc/trunk/libc.obj/samples/atexit_test.c | 18 ++++++++++++++++++ .../ktcc/trunk/libc.obj/samples/build_all.sh | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 programs/develop/ktcc/trunk/libc.obj/samples/atexit_test.c diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/Makefile b/programs/develop/ktcc/trunk/libc.obj/samples/Makefile index 49725be3d..020298237 100644 --- a/programs/develop/ktcc/trunk/libc.obj/samples/Makefile +++ b/programs/develop/ktcc/trunk/libc.obj/samples/Makefile @@ -27,7 +27,8 @@ BIN = \ libc_test.kex \ pipe.kex \ defgen.kex \ - futex.kex + futex.kex \ + atexit_test.kex all: $(BIN) diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/atexit_test.c b/programs/develop/ktcc/trunk/libc.obj/samples/atexit_test.c new file mode 100644 index 000000000..3bf8609d0 --- /dev/null +++ b/programs/develop/ktcc/trunk/libc.obj/samples/atexit_test.c @@ -0,0 +1,18 @@ +#include +#include + +void f() +{ + static int c = 1; + printf("exit #%d\n", c); + c++; +} + +int main() +{ + atexit(&f); + atexit(&f); + atexit(&f); + + return 0; +} diff --git a/programs/develop/ktcc/trunk/libc.obj/samples/build_all.sh b/programs/develop/ktcc/trunk/libc.obj/samples/build_all.sh index fb6e57cf7..4a75e9da9 100644 --- a/programs/develop/ktcc/trunk/libc.obj/samples/build_all.sh +++ b/programs/develop/ktcc/trunk/libc.obj/samples/build_all.sh @@ -23,5 +23,6 @@ cp clayer/logo.png /tmp0/1/tcc_samples/logo.png ../tcc defgen.c -o /tmp0/1/tcc_samples/defgen ../tcc pipe.c -o /tmp0/1/tcc_samples/pipe ../tcc futex.c -o /tmp0/1/tcc_samples/futex +../tcc atexit_test.c -o /tmp0/1/tcc_samples/atexit_test "/sys/File managers/Eolite" /tmp0/1/tcc_samples exit