Skip to content

Commit 61b4b37

Browse files
authored
Mark abort and proc_exit as @noreturn. (#26587)
I'm not sure this has any actual benefit but it might help with @stephenduong1004's recent issue with closure warnings.
1 parent f3fef05 commit 61b4b37

File tree

5 files changed

+22
-12
lines changed

5 files changed

+22
-12
lines changed

src/lib/libwasi.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var WasiLibrary = {
1717
#endif
1818

1919
proc_exit__nothrow: true,
20+
proc_exit__docs: '/** @noreturn */',
2021
proc_exit: (code) => {
2122
#if MINIMAL_RUNTIME
2223
throw `exit(${code})`;

src/preamble.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ function postRun() {
235235
<<< ATPOSTRUNS >>>
236236
}
237237

238-
/** @param {string|number=} what */
238+
/**
239+
* @param {string|number=} what
240+
* @noreturn
241+
*/
239242
function abort(what) {
240243
#if expectToReceiveOnModule('onAbort')
241244
Module['onAbort']?.(what);

test/codesize/test_codesize_file_preload.expected.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ function preMain() {}
361361

362362
function postRun() {}
363363

364-
/** @param {string|number=} what */ function abort(what) {
364+
/**
365+
* @param {string|number=} what
366+
* @noreturn
367+
*/ function abort(what) {
365368
what = `Aborted(${what})`;
366369
// TODO(sbc): Should we remove printing and leave it up to whoever
367370
// catches the exception?
@@ -3079,7 +3082,7 @@ function _fd_write(fd, iov, iovcnt, pnum) {
30793082

30803083
var keepRuntimeAlive = () => true;
30813084

3082-
var _proc_exit = code => {
3085+
/** @noreturn */ var _proc_exit = code => {
30833086
EXITSTATUS = code;
30843087
if (!keepRuntimeAlive()) {
30853088
ABORT = true;

test/codesize/test_codesize_minimal_O0.expected.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,10 @@ function postRun() {
508508
// No ATPOSTRUNS hooks
509509
}
510510

511-
/** @param {string|number=} what */
511+
/**
512+
* @param {string|number=} what
513+
* @noreturn
514+
*/
512515
function abort(what) {
513516

514517
what = `Aborted(${what})`;
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"hello_world.js": 57042,
3-
"hello_world.js.gz": 17743,
2+
"hello_world.js": 57078,
3+
"hello_world.js.gz": 17753,
44
"hello_world.wasm": 14850,
55
"hello_world.wasm.gz": 7311,
6-
"no_asserts.js": 26618,
7-
"no_asserts.js.gz": 8888,
6+
"no_asserts.js": 26654,
7+
"no_asserts.js.gz": 8901,
88
"no_asserts.wasm": 12010,
99
"no_asserts.wasm.gz": 5880,
10-
"strict.js": 54860,
11-
"strict.js.gz": 17049,
10+
"strict.js": 54896,
11+
"strict.js.gz": 17061,
1212
"strict.wasm": 14850,
1313
"strict.wasm.gz": 7311,
14-
"total": 180230,
15-
"total_gz": 64182
14+
"total": 180338,
15+
"total_gz": 64217
1616
}

0 commit comments

Comments
 (0)