summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing/fuzzing.cpp
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2022-09-30 19:25:06 -0500
committerGitHub <noreply@github.com>2022-10-01 00:25:06 +0000
commit22f0f3ae45c9dc7d091282974d013ab340754b6e (patch)
treef3fad3969e95e82779137e7dc1cd6b5f019077bc /src/tools/fuzzing/fuzzing.cpp
parenta697046975cb2f952d7cc1e67474f7cd000ed027 (diff)
downloadbinaryen-22f0f3ae45c9dc7d091282974d013ab340754b6e.tar.gz
binaryen-22f0f3ae45c9dc7d091282974d013ab340754b6e.tar.bz2
binaryen-22f0f3ae45c9dc7d091282974d013ab340754b6e.zip
Change `exit()` to `Fatal()`; make it possible to throw on `Fatal()`. (#5087)
This patch makes binaryen easier to call from other applications by making more errors recoverable instead of early-exiting. The main thing it does is change three calls to exit on I/O errors into calls to Fatal(), which is an existing custom abstraction for handling unrecoverable errors. Currently Fatal's destructor calls _Exit(1). My intent is to make it possible for Fatal to not exit, but to throw, allowing an embedding application to catch the exception. Because the previous early exits were exiting with error code EXIT_FAILURE, I also changed Fatal to exit with EXIT_FAILURE. The test suite continues to pass so I assume this is ok. Next I changed Fatal to buffer its error message until the destructor instead of immediately printing it to stderr. This is for ease of patching Fatal to throw instead. Finally, I also included the patch I need to make Fatal throw when THROW_ON_FATAL is defined at compile time. I can carry this patch out of tree, but it is a small patch, so perhaps you will be willing to take it. I am happy to remove it. Fixes #4938
Diffstat (limited to 'src/tools/fuzzing/fuzzing.cpp')
0 files changed, 0 insertions, 0 deletions