Call user main from wrapper. May not be a great idea.

This commit is contained in:
2026-01-18 00:16:09 -05:00
parent c840536e1d
commit 350d198015
6 changed files with 37 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ akerr_ErrorContext *func1(void)
}
int main(void)
akerr_ErrorContext *akerr_user_main(int argc, char **argv)
{
PREPARE_ERROR(errctx);
ATTEMPT {
@@ -32,5 +32,6 @@ int main(void)
} PROCESS(errctx) {
} HANDLE(errctx, AKERR_NULLPOINTER) {
akerr_log_method("Caught exception");
} FINISH_NORETURN(errctx);
} FINISH(errctx, true);
SUCCEED(errctx);
}

View File

@@ -25,7 +25,7 @@ akerr_ErrorContext *func1(void)
SUCCEED_RETURN(errctx);
}
int main(void)
akerr_ErrorContext *akerr_user_main(int argc, char **argv)
{
x = 12345;
PREPARE_ERROR(errctx);
@@ -35,9 +35,8 @@ int main(void)
} PROCESS(errctx) {
} HANDLE(errctx, AKERR_NULLPOINTER) {
if ( x == 0 ) {
fprintf(stderr, "Cleanup works\n");
return 0;
FAIL_RETURN(errctx, AKERR_API, "Cleanup does not work");
}
return 1;
} FINISH_NORETURN(errctx);
} FINISH(errctx, true);
SUCCEED(errctx);
}

View File

@@ -23,12 +23,13 @@ akerr_ErrorContext *func1(void)
}
int main(void)
akerr_ErrorContext *akerr_user_main(int argc, char **argv)
{
PREPARE_ERROR(errctx);
ATTEMPT {
CATCH(errctx, func1());
} CLEANUP {
} PROCESS(errctx) {
} FINISH_NORETURN(errctx);
} FINISH(errctx, true);
SUCCEED(errctx);
}