Skip to content

Commit d5ebf26

Browse files
authored
Simplify FS missing assertions. NFC (#26641)
1 parent 12dcf75 commit d5ebf26

File tree

5 files changed

+38
-40
lines changed

5 files changed

+38
-40
lines changed

src/preamble.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,19 @@ function abort(what) {
301301

302302
#if ASSERTIONS && !('$FS' in addedLibraryItems)
303303
// show errors on likely calls to FS when it was not included
304+
function fsMissing() {
305+
abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
306+
}
304307
var FS = {
305-
error() {
306-
abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
307-
},
308-
init() { FS.error() },
309-
createDataFile() { FS.error() },
310-
createPreloadedFile() { FS.error() },
311-
createLazyFile() { FS.error() },
312-
open() { FS.error() },
313-
mkdev() { FS.error() },
314-
registerDevice() { FS.error() },
315-
analyzePath() { FS.error() },
316-
317-
ErrnoError() { FS.error() },
308+
init: fsMissing,
309+
createDataFile: fsMissing,
310+
createPreloadedFile: fsMissing,
311+
createLazyFile: fsMissing,
312+
open: fsMissing,
313+
mkdev: fsMissing,
314+
registerDevice: fsMissing,
315+
analyzePath: fsMissing,
316+
ErrnoError: fsMissing,
318317
};
319318
{{{
320319
addAtModule(`

test/codesize/test_codesize_hello_O0.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"a.out.js": 24261,
3-
"a.out.js.gz": 8720,
2+
"a.out.js": 24221,
3+
"a.out.js.gz": 8713,
44
"a.out.nodebug.wasm": 14850,
55
"a.out.nodebug.wasm.gz": 7311,
6-
"total": 39111,
7-
"total_gz": 16031,
6+
"total": 39071,
7+
"total_gz": 16024,
88
"sent": [
99
"fd_write"
1010
],

test/codesize/test_codesize_minimal_O0.expected.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -544,20 +544,19 @@ function abort(what) {
544544
}
545545

546546
// show errors on likely calls to FS when it was not included
547+
function fsMissing() {
548+
abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
549+
}
547550
var FS = {
548-
error() {
549-
abort('Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM');
550-
},
551-
init() { FS.error() },
552-
createDataFile() { FS.error() },
553-
createPreloadedFile() { FS.error() },
554-
createLazyFile() { FS.error() },
555-
open() { FS.error() },
556-
mkdev() { FS.error() },
557-
registerDevice() { FS.error() },
558-
analyzePath() { FS.error() },
559-
560-
ErrnoError() { FS.error() },
551+
init: fsMissing,
552+
createDataFile: fsMissing,
553+
createPreloadedFile: fsMissing,
554+
createLazyFile: fsMissing,
555+
open: fsMissing,
556+
mkdev: fsMissing,
557+
registerDevice: fsMissing,
558+
analyzePath: fsMissing,
559+
ErrnoError: fsMissing,
561560
};
562561

563562

test/codesize/test_codesize_minimal_O0.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"a.out.js": 19452,
3-
"a.out.js.gz": 7004,
2+
"a.out.js": 19412,
3+
"a.out.js.gz": 6999,
44
"a.out.nodebug.wasm": 1015,
55
"a.out.nodebug.wasm.gz": 602,
6-
"total": 20467,
7-
"total_gz": 7606,
6+
"total": 20427,
7+
"total_gz": 7601,
88
"sent": [],
99
"imports": [],
1010
"exports": [
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
2-
"hello_world.js": 57078,
3-
"hello_world.js.gz": 17757,
2+
"hello_world.js": 57030,
3+
"hello_world.js.gz": 17755,
44
"hello_world.wasm": 14850,
55
"hello_world.wasm.gz": 7311,
66
"no_asserts.js": 26654,
77
"no_asserts.js.gz": 8901,
88
"no_asserts.wasm": 12010,
99
"no_asserts.wasm.gz": 5880,
10-
"strict.js": 54896,
11-
"strict.js.gz": 17065,
10+
"strict.js": 54848,
11+
"strict.js.gz": 17063,
1212
"strict.wasm": 14850,
1313
"strict.wasm.gz": 7311,
14-
"total": 180338,
15-
"total_gz": 64225
14+
"total": 180242,
15+
"total_gz": 64221
1616
}

0 commit comments

Comments
 (0)