From 3cfaebd1127731548f760845ffb9ac7d251c4e4e Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 16 Apr 2026 15:24:14 -0700 Subject: [PATCH] Consistent assert message. NFC - Message should not start with capital letter - Message should not end with period. - No need to end message with exclamation point --- src/Fetch.js | 4 +- src/jsifier.mjs | 4 +- src/lib/libasync.js | 8 ++-- src/lib/libbrowser.js | 4 +- src/lib/libc_preprocessor.js | 4 +- src/lib/libccall.js | 2 +- src/lib/libcore.js | 2 +- src/lib/libdylink.js | 2 +- src/lib/libembind.js | 4 +- src/lib/libemval.js | 2 +- src/lib/libeventloop.js | 2 +- src/lib/libglfw.js | 2 +- src/lib/libhtml5.js | 4 +- src/lib/libpthread.js | 22 +++++----- src/lib/libstrings.js | 14 +++---- src/lib/libwasm_worker.js | 6 +-- src/lib/libwebaudio.js | 14 +++---- src/lib/libwebgl.js | 48 +++++++++++----------- src/lib/libwebgl2.js | 36 ++++++++-------- src/parseTools.mjs | 2 +- src/shell.js | 10 ++--- test/core/embind_lib_with_asyncify.test.js | 2 +- test/core/test_asyncify_assertions.out | 2 +- test/test_browser.py | 2 +- test/test_other.py | 2 +- 25 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/Fetch.js b/src/Fetch.js index 5d0fd81c38af5..970280c5bfa61 100644 --- a/src/Fetch.js +++ b/src/Fetch.js @@ -536,7 +536,7 @@ function fetchXHR(fetch, onsuccess, onerror, onprogress, onreadystatechange) { if (!fetchAttrSynchronous) xhr.timeout = timeoutMsecs; // XHR timeout field is only accessible in async XHRs, and must be set after .open() but before .send(). xhr.url_ = url_; // Save the url for debugging purposes (and for comparing to the responseURL that server side advertised) #if ASSERTIONS && !FETCH_STREAMING - assert(!fetchAttrStreamData, 'Streaming is only supported when FETCH_STREAMING is enabled.'); + assert(!fetchAttrStreamData, 'streaming is only supported when FETCH_STREAMING is enabled'); #endif xhr.responseType = 'arraybuffer'; @@ -667,7 +667,7 @@ function fetchXHR(fetch, onsuccess, onerror, onprogress, onreadystatechange) { dbg(`fetch: allocating ${ptrLen} bytes in Emscripten heap for xhr data`); #endif #if ASSERTIONS - assert(onprogress, 'When doing a streaming fetch, you should have an onprogress handler registered to receive the chunks!'); + assert(onprogress, 'streaming fetch requires an onprogress handler'); #endif // The data pointer malloc()ed here has the same lifetime as the emscripten_fetch_t structure itself has, and is // freed when emscripten_fetch_close() is called. diff --git a/src/jsifier.mjs b/src/jsifier.mjs index 81a073fb7171c..76d6934db6881 100644 --- a/src/jsifier.mjs +++ b/src/jsifier.mjs @@ -515,7 +515,7 @@ ${body} snippet, (args, body) => ` function(${args}) { - assert(!ENVIRONMENT_IS_WASM_WORKER, "Attempted to call proxied function '${mangled}' in a Wasm Worker, but in Wasm Worker enabled builds, proxied function architecture is not available!"); + assert(!ENVIRONMENT_IS_WASM_WORKER, "attempt to call proxied function '${mangled}' from a Wasm Worker (where proxying is not possible)"); ${body} }\n`, ); @@ -871,7 +871,7 @@ function(${args}) { orderedPostSets[j] = temp; i--; limit--; - assert(limit > 0, 'Could not sort postsets!'); + assert(limit > 0, 'could not sort postsets'); break; } } diff --git a/src/lib/libasync.js b/src/lib/libasync.js index 17ca2c0b011d4..4c54f73208f2c 100644 --- a/src/lib/libasync.js +++ b/src/lib/libasync.js @@ -253,8 +253,8 @@ addToLibrary({ whenDone() { #if ASSERTIONS - assert(Asyncify.currData, 'Tried to wait for an async operation when none is in progress.'); - assert(!Asyncify.asyncPromiseHandlers, 'Cannot have multiple async operations in flight at once'); + assert(Asyncify.currData, 'tried to wait for an async operation when none is in progress'); + assert(!Asyncify.asyncPromiseHandlers, 'cannot have multiple async operations in flight at once'); #endif return new Promise((resolve, reject) => { Asyncify.asyncPromiseHandlers = { resolve, reject }; @@ -330,7 +330,7 @@ addToLibrary({ // and other async methods for simple examples of usage. handleSleep(startAsync) { #if ASSERTIONS - assert(Asyncify.state !== Asyncify.State.Disabled, 'Asyncify cannot be done during or after the runtime exits'); + assert(Asyncify.state !== Asyncify.State.Disabled, 'handleSleep called after Asyncify was shut down'); #endif if (ABORT) return; #if ASYNCIFY_DEBUG @@ -361,7 +361,7 @@ addToLibrary({ // as it might break later operations (we can rewind ok now, but if // we unwind again, we would unwind through the extra compiled code // too). - assert(!Asyncify.exportCallStack.length, 'Waking up (starting to rewind) must be done from JS, without compiled code on the stack.'); + assert(!Asyncify.exportCallStack.length, 'waking up (starting to rewind) must be done from JS, without compiled code on the stack'); #endif #if ASYNCIFY_DEBUG dbg(`ASYNCIFY: start rewind ${Asyncify.currData}`); diff --git a/src/lib/libbrowser.js b/src/lib/libbrowser.js index 0b9a043776edb..560b0790f606d 100644 --- a/src/lib/libbrowser.js +++ b/src/lib/libbrowser.js @@ -403,9 +403,9 @@ var LibraryBrowser = { var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset); var scrollY = ((typeof window.scrollY != 'undefined') ? window.scrollY : window.pageYOffset); #if ASSERTIONS - // If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset + // If this assert fires, it's likely because the browser doesn't support scrollX or pageXOffset // and we have no viable fallback. - assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); + assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'unable to retrieve scroll position, mouse positions likely broken'); #endif var adjustedX = pageX - (scrollX + rect.left); var adjustedY = pageY - (scrollY + rect.top); diff --git a/src/lib/libc_preprocessor.js b/src/lib/libc_preprocessor.js index 56259599f6889..a0c117c1d35c8 100644 --- a/src/lib/libc_preprocessor.js +++ b/src/lib/libc_preprocessor.js @@ -65,7 +65,7 @@ addToLibrary({ function classifyChar(str, idx) { var cc = str.charCodeAt(idx); #if ASSERTIONS - assert(!(cc > 127), "Only 7-bit ASCII can be used in preprocessor #if/#ifdef/#define statements!"); + assert(!(cc > 127), "only 7-bit ASCII can be used in preprocessor #if/#ifdef/#define statements"); #endif if (cc > 32) { if (cc < 48) return 1; // an operator symbol, any of !"#$%&'()*+,-./ @@ -221,7 +221,7 @@ addToLibrary({ } // else a number: #if ASSERTIONS - assert(tokens[i] !== ')', 'Parsing failure, mismatched parentheses in parsing!' + tokens.toString()); + assert(tokens[i] !== ')', 'parse failure, mismatched parentheses in parsing' + tokens.toString()); assert(operatorAndPriority == -1); #endif var num = Number(tokens[i]); diff --git a/src/lib/libccall.js b/src/lib/libccall.js index bf48d9a912d5c..4d40b8dbf884c 100644 --- a/src/lib/libccall.js +++ b/src/lib/libccall.js @@ -64,7 +64,7 @@ addToLibrary({ var cArgs = []; var stack = 0; #if ASSERTIONS - assert(returnType !== 'array', 'Return type should not be "array".'); + assert(returnType !== 'array', 'return type should not be "array"'); #endif if (args) { for (var i = 0; i < args.length; i++) { diff --git a/src/lib/libcore.js b/src/lib/libcore.js index ee9cfcedef751..e4e1afc946115 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -1884,7 +1884,7 @@ addToLibrary({ } #if ASSERTIONS && ASYNCIFY != 2 // With JSPI the function stored in the table will be a wrapper. /** @suppress {checkTypes} */ - assert(wasmTable.get({{{ toIndexType('funcPtr') }}}) == func, 'JavaScript-side Wasm function table mirror is out of date!'); + assert(wasmTable.get({{{ toIndexType('funcPtr') }}}) == func, 'table mirror is out of date'); #endif return func; }, diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index ab8ba1dd5b293..2cb4a896d081d 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -1107,7 +1107,7 @@ var LibraryDylink = { if (dso) { // the library is being loaded or has been loaded already. #if ASSERTIONS - assert(dso.exports !== 'loading', `Attempt to load '${libName}' twice before the first load completed`); + assert(dso.exports !== 'loading', `attempt to load '${libName}' a second time, before the first load completed`); #endif if (!flags.global) { if (localScope) { diff --git a/src/lib/libembind.js b/src/lib/libembind.js index 19080626392f3..465f72126d1b6 100644 --- a/src/lib/libembind.js +++ b/src/lib/libembind.js @@ -694,7 +694,7 @@ var LibraryEmbind = { } #if ASSERTIONS && ASYNCIFY != 2 - assert(!isAsync, 'Async bindings are only supported with JSPI.'); + assert(!isAsync, 'async bindings are only supported with JSPI'); #endif var isClassMethodFunc = (argTypes[1] !== null && classType !== null); @@ -821,7 +821,7 @@ var LibraryEmbind = { ], $embind__requireFunction: (signature, rawFunction, isAsync = false) => { #if ASSERTIONS && ASYNCIFY != 2 - assert(!isAsync, 'Async bindings are only supported with JSPI.'); + assert(!isAsync, 'async bindings are only supported with JSPI'); #endif signature = AsciiToString(signature); diff --git a/src/lib/libemval.js b/src/lib/libemval.js index ada9d19e87529..b71a44c5da1af 100644 --- a/src/lib/libemval.js +++ b/src/lib/libemval.js @@ -91,7 +91,7 @@ var LibraryEmVal = { _emval_decref: (handle) => { if (handle > {{{ EMVAL_LAST_RESERVED_HANDLE }}} && 0 === --emval_handles[handle + 1]) { #if ASSERTIONS - assert(emval_handles[handle] !== undefined, `Decref for unallocated handle.`); + assert(emval_handles[handle] !== undefined, `decref for unallocated handle`); #endif var value = emval_handles[handle]; emval_handles[handle] = undefined; diff --git a/src/lib/libeventloop.js b/src/lib/libeventloop.js index 8e0a84474edd6..24f958b23d1e9 100644 --- a/src/lib/libeventloop.js +++ b/src/lib/libeventloop.js @@ -395,7 +395,7 @@ LibraryJSEventLoop = { */`, $setMainLoop: (iterFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => { #if ASSERTIONS - assert(!MainLoop.func, 'emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.'); + assert(!MainLoop.func, 'emscripten_set_main_loop: there can only be one main loop function at once') #endif MainLoop.func = iterFunc; MainLoop.arg = arg; diff --git a/src/lib/libglfw.js b/src/lib/libglfw.js index efc5e96bf7371..b7a103b418905 100644 --- a/src/lib/libglfw.js +++ b/src/lib/libglfw.js @@ -1328,7 +1328,7 @@ var LibraryGLFW = { #if ASSERTIONS // If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset // and we have no viable fallback. - assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.'); + assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'unable to retrieve scroll position, mouse positions likely broken'); #endif var adjustedX = pageX - (scrollX + rect.left); var adjustedY = pageY - (scrollY + rect.top); diff --git a/src/lib/libhtml5.js b/src/lib/libhtml5.js index f8088f2c13b06..7735438de3b89 100644 --- a/src/lib/libhtml5.js +++ b/src/lib/libhtml5.js @@ -2002,7 +2002,7 @@ var LibraryHTML5 = { emscripten_get_num_gamepads__deps: ['$JSEvents'], emscripten_get_num_gamepads: () => { #if ASSERTIONS - assert(JSEvents.lastGamepadState, 'emscripten_get_num_gamepads() can only be called after having first called emscripten_sample_gamepad_data() and that function has returned EMSCRIPTEN_RESULT_SUCCESS!'); + assert(JSEvents.lastGamepadState, 'emscripten_get_num_gamepads() called before emscripten_sample_gamepad_data()'); #endif // N.B. Do not call emscripten_get_num_gamepads() unless having first called emscripten_sample_gamepad_data(), and that has returned EMSCRIPTEN_RESULT_SUCCESS. // Otherwise the following line will throw an exception. @@ -2013,7 +2013,7 @@ var LibraryHTML5 = { emscripten_get_gamepad_status__deps: ['$JSEvents', '$fillGamepadEventData'], emscripten_get_gamepad_status: (index, gamepadState) => { #if ASSERTIONS - assert(JSEvents.lastGamepadState, 'emscripten_get_gamepad_status() can only be called after having first called emscripten_sample_gamepad_data() and that function has returned EMSCRIPTEN_RESULT_SUCCESS!'); + assert(JSEvents.lastGamepadState, 'emscripten_get_gamepad_status() called before emscripten_sample_gamepad_data()'); #endif // INVALID_PARAM is returned on a Gamepad index that never was there. if (index < 0 || index >= JSEvents.lastGamepadState.length) return {{{ cDefs.EMSCRIPTEN_RESULT_INVALID_PARAM }}}; diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index 206c6edb55f7d..a771961ba8b85 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -172,7 +172,7 @@ var LibraryPThread = { terminateAllThreads: () => { #if ASSERTIONS - assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! terminateAllThreads() can only ever be called from main application thread!'); + assert(!ENVIRONMENT_IS_PTHREAD, 'terminateAllThreads() should only be called from the main thread'); #endif #if PTHREADS_DEBUG dbg('terminateAllThreads'); @@ -196,7 +196,7 @@ var LibraryPThread = { terminateRuntime: () => { #if ASSERTIONS - assert(!ENVIRONMENT_IS_PTHREAD, 'terminateRuntime() can only ever be called from main application thread!'); + assert(!ENVIRONMENT_IS_PTHREAD, 'terminateRuntime() should only be called from the main thread'); #endif PThread.terminateAllThreads(); var pthread_ptr = _pthread_self(); @@ -280,7 +280,7 @@ var LibraryPThread = { if (targetWorker) { targetWorker.postMessage(d, d.transferList); } else { - err(`Internal error! Worker sent a message "${cmd}" to target pthread ${d.targetThread}, but that thread no longer exists!`); + err(`worker sent message (${cmd}) to pthread (${d.targetThread}) that no longer exists`); } return; } @@ -357,9 +357,9 @@ var LibraryPThread = { #endif #if ASSERTIONS - assert(wasmMemory instanceof WebAssembly.Memory, 'WebAssembly memory should have been loaded by now!'); + assert(wasmMemory instanceof WebAssembly.Memory, 'wasmMemory should have been loaded by now'); #if !WASM_ESM_INTEGRATION - assert(wasmModule instanceof WebAssembly.Module, 'WebAssembly Module should have been loaded by now!'); + assert(wasmModule instanceof WebAssembly.Module, 'wasmModule should have been loaded by now'); #endif #endif @@ -617,8 +617,8 @@ var LibraryPThread = { dbg(`cleanupThread: ${ptrToString(pthread_ptr)}`) #endif #if ASSERTIONS - assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! cleanupThread() can only ever be called from main application thread!'); - assert(pthread_ptr, 'Internal Error! Null pthread_ptr in cleanupThread!'); + assert(!ENVIRONMENT_IS_PTHREAD, 'cleanupThread() should only be called from the main thread'); + assert(pthread_ptr, 'null pthread_ptr passed to cleanupThread'); #endif var worker = PThread.pthreads[pthread_ptr]; #if MAIN_MODULE @@ -675,8 +675,8 @@ var LibraryPThread = { $spawnThread: (threadParams) => { #if ASSERTIONS - assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! spawnThread() can only ever be called from main application thread!'); - assert(threadParams.pthread_ptr, 'Internal error, no pthread ptr!'); + assert(!ENVIRONMENT_IS_PTHREAD, 'spawnThread() should only be called from the main thread'); + assert(threadParams.pthread_ptr, 'spawnThread called with null pthread ptr'); #endif var worker = PThread.getNewWorker(); @@ -685,7 +685,7 @@ var LibraryPThread = { return {{{ cDefs.EAGAIN }}}; } #if ASSERTIONS - assert(!worker.pthread_ptr, 'Internal error!'); + assert(!worker.pthread_ptr); #endif PThread.runningWorkers.push(worker); @@ -1206,7 +1206,7 @@ var LibraryPThread = { dbg("dlsyncThreadsAsync caller=" + ptrToString(caller)); #endif #if ASSERTIONS - assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! dlsyncThreadsAsync() can only ever be called from main thread'); + assert(!ENVIRONMENT_IS_PTHREAD, 'dlsyncThreadsAsync() should only be called from the main thread'); assert(Object.keys(PThread.outstandingPromises).length === 0); #endif diff --git a/src/lib/libstrings.js b/src/lib/libstrings.js index a048f0ec31613..9af1429a14dc3 100644 --- a/src/lib/libstrings.js +++ b/src/lib/libstrings.js @@ -214,7 +214,7 @@ addToLibrary({ $stringToUTF8__deps: ['$stringToUTF8Array'], $stringToUTF8: (str, outPtr, maxBytesToWrite) => { #if ASSERTIONS - assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); + assert(typeof maxBytesToWrite == 'number', 'stringToUTF8 requires a third parameter that specifies the length of the output buffer'); #endif return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); }, @@ -313,7 +313,7 @@ addToLibrary({ $UTF16ToString__deps: ['$UTF16Decoder', '$findStringEnd'], $UTF16ToString: (ptr, maxBytesToRead, ignoreNul) => { #if ASSERTIONS - assert(ptr % 2 == 0, 'Pointer passed to UTF16ToString must be aligned to two bytes!'); + assert(ptr % 2 == 0, 'pointer passed to UTF16ToString must be 2-byte aligned'); #endif var idx = {{{ getHeapOffset('ptr', 'u16') }}}; var endIdx = findStringEnd(HEAPU16, idx, maxBytesToRead / 2, ignoreNul); @@ -359,10 +359,10 @@ addToLibrary({ // Returns the number of bytes written, EXCLUDING the null terminator. $stringToUTF16: (str, outPtr, maxBytesToWrite) => { #if ASSERTIONS - assert(outPtr % 2 == 0, 'Pointer passed to stringToUTF16 must be aligned to two bytes!'); + assert(outPtr % 2 == 0, 'pointer passed to stringToUTF16 must be 2-byte aligned'); #endif #if ASSERTIONS - assert(typeof maxBytesToWrite == 'number', 'stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); + assert(typeof maxBytesToWrite == 'number', 'stringToUTF16 requires a third parameter that specifies the length of the output buffer'); #endif // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed. maxBytesToWrite ??= 0x7FFFFFFF; @@ -387,7 +387,7 @@ addToLibrary({ $UTF32ToString: (ptr, maxBytesToRead, ignoreNul) => { #if ASSERTIONS - assert(ptr % 4 == 0, 'Pointer passed to UTF32ToString must be aligned to four bytes!'); + assert(ptr % 4 == 0, 'pointer passed to UTF32ToString must be 2-byte aligned'); #endif var str = ''; var startIdx = {{{ getHeapOffset('ptr', 'u32') }}}; @@ -421,10 +421,10 @@ addToLibrary({ outPtr >>>= 0; #endif #if ASSERTIONS - assert(outPtr % 4 == 0, 'Pointer passed to stringToUTF32 must be aligned to four bytes!'); + assert(outPtr % 4 == 0, 'pointer passed to stringToUTF32 must be 4-byte aligned'); #endif #if ASSERTIONS - assert(typeof maxBytesToWrite == 'number', 'stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!'); + assert(typeof maxBytesToWrite == 'number', 'stringToUTF32 requires a third parameter that specifies the length of the output buffer'); #endif // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed. maxBytesToWrite ??= 0x7FFFFFFF; diff --git a/src/lib/libwasm_worker.js b/src/lib/libwasm_worker.js index 1542573fb715c..88787a7947712 100644 --- a/src/lib/libwasm_worker.js +++ b/src/lib/libwasm_worker.js @@ -234,7 +234,7 @@ if (ENVIRONMENT_IS_WASM_WORKER emscripten_terminate_wasm_worker: (id) => { #if ASSERTIONS - assert(id != 0, 'emscripten_terminate_wasm_worker() cannot be called with id=0!'); + assert(id != 0, 'emscripten_terminate_wasm_worker() cannot be called with id=0'); #endif if (_wasmWorkers[id]) { _wasmWorkers[id].terminate(); @@ -244,7 +244,7 @@ if (ENVIRONMENT_IS_WASM_WORKER emscripten_terminate_all_wasm_workers: () => { #if ASSERTIONS - assert(!ENVIRONMENT_IS_WASM_WORKER, 'emscripten_terminate_all_wasm_workers() cannot be called from a Wasm Worker: only the main browser thread has visibility to terminate all Workers!'); + assert(!ENVIRONMENT_IS_WASM_WORKER, 'emscripten_terminate_all_wasm_workers() should only be called from the main thread'); #endif Object.values(_wasmWorkers).forEach((worker) => worker.terminate()); _wasmWorkers = {}; @@ -282,7 +282,7 @@ if (ENVIRONMENT_IS_WASM_WORKER assert(id >= 0); assert(funcPtr); assert(sigPtr); - assert(UTF8ToString(sigPtr)[0] != 'v', 'Do NOT specify the return argument in the signature string for a call to emscripten_wasm_worker_post_function_sig(), just pass the function arguments.'); + assert(UTF8ToString(sigPtr)[0] != 'v', 'emscripten_wasm_worker_post_function_sig() supports only void return type'); assert(varargs); #endif _wasmWorkers[id].postMessage({'_wsc': funcPtr, 'x': readEmAsmArgs(sigPtr, varargs) }); diff --git a/src/lib/libwebaudio.js b/src/lib/libwebaudio.js index 29e84909cc970..81c91fa71741a 100644 --- a/src/lib/libwebaudio.js +++ b/src/lib/libwebaudio.js @@ -19,7 +19,7 @@ var LibraryWebAudio = { $emscriptenRegisterAudioObject__deps: ['$emAudio', '$emAudioCounter'], $emscriptenRegisterAudioObject: (object) => { #if ASSERTIONS - assert(object, 'Called emscriptenRegisterAudioObject() with a null object handle!'); + assert(object, 'null pointer passed to emscriptenRegisterAudioObject'); #endif emAudio[++emAudioCounter] = object; #if WEBAUDIO_DEBUG @@ -36,7 +36,7 @@ var LibraryWebAudio = { #endif #if ASSERTIONS var obj = emAudio[handle]; - assert(obj, `Called ${methodName}() on a nonexisting handle ${handle}`); + assert(obj, `${methodName}() called on a nonexisting handle ${handle}`); return obj; #endif }, @@ -180,11 +180,11 @@ var LibraryWebAudio = { var audioWorklet = audioContext.audioWorklet; #if ASSERTIONS - assert(stackLowestAddress != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS!'); - assert(stackLowestAddress % 16 == 0, `AudioWorklet stack should be aligned to 16 bytes! (was ${stackLowestAddress} == ${stackLowestAddress%16} mod 16) Use e.g. memalign(16, stackSize) to align the stack!`); - assert(stackSize != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS!'); + assert(stackLowestAddress != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS'); + assert(stackLowestAddress % 16 == 0, `AudioWorklet stack should be aligned to 16 bytes (was ${stackLowestAddress} == ${stackLowestAddress%16} mod 16) Use e.g. memalign(16, stackSize) to align the stack`); + assert(stackSize != 0, 'AudioWorklets require a dedicated stack space for audio data marshalling between Wasm and JS'); assert(stackSize % 16 == 0, `AudioWorklet stack size should be a multiple of 16 bytes! (was ${stackSize} == ${stackSize%16} mod 16)`); - assert(!audioContext.audioWorkletInitialized, `emscripten_create_wasm_audio_worklet() was already called for AudioContext ${contextHandle}! Only call this function once per AudioContext!`); + assert(!audioContext.audioWorkletInitialized, `emscripten_create_wasm_audio_worklet() was already called for AudioContext ${contextHandle}! Only call this function once per AudioContext`); audioContext.audioWorkletInitialized = 1; #endif @@ -449,7 +449,7 @@ var LibraryWebAudio = { emscripten_audio_worklet_post_function_sig: (audioContext, funcPtr, sigPtr, varargs) => { #if ASSERTIONS assert(sigPtr); - assert(UTF8ToString(sigPtr)[0] != 'v', 'Do NOT specify the return argument in the signature string for a call to emscripten_audio_worklet_post_function_sig(), just pass the function arguments.'); + assert(UTF8ToString(sigPtr)[0] != 'v', 'emscripten_audio_worklet_post_function_sig() supports only void return type'); assert(varargs); #endif emAudioWorkletPostFunction(audioContext, funcPtr, readEmAsmArgs(sigPtr, varargs)); diff --git a/src/lib/libwebgl.js b/src/lib/libwebgl.js index abed4624e4cd5..bc95cd1b21bc0 100644 --- a/src/lib/libwebgl.js +++ b/src/lib/libwebgl.js @@ -648,7 +648,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; err(`Invalid vertex attribute data type GLenum ${dataType} passed to GL function!`); } if (dimension == 0x80E1 /* GL_BGRA */) { - err('WebGL does not support size=GL_BGRA in a call to glVertexAttribPointer! Please use size=4 and type=GL_UNSIGNED_BYTE instead!'); + err('WebGL does not support size=GL_BGRA in a call to glVertexAttribPointer! Please use size=4 and type=GL_UNSIGNED_BYTE instead'); } else if (dimension < 1 || dimension > 4) { err(`Invalid dimension=${dimension} in call to glVertexAttribPointer, must be 1,2,3 or 4.`); } @@ -1084,7 +1084,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; // data between threads var handle = _malloc({{{ 2 * POINTER_SIZE }}}); #if GL_ASSERTIONS - assert(handle, 'malloc() failed in GL.registerContext!'); + assert(handle, 'malloc() failed in GL.registerContext'); #endif #if GL_SUPPORT_EXPLICIT_SWAP_CONTROL {{{ makeSetValue('handle', 0, 'webGLContextAttributes.explicitSwapControl', 'i8')}}}; @@ -1137,7 +1137,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; #if GL_DEBUG if (webGLContextAttributes.renderViaOffscreenBackBuffer) { - dbg('renderViaOffscreenBackBuffer=true specified in WebGL context creation attributes, pass linker flag -sOFFSCREEN_FRAMEBUFFER to enable support!'); + dbg('renderViaOffscreenBackBuffer=true specified in WebGL context creation attributes, pass linker flag -sOFFSCREEN_FRAMEBUFFER to enable support'); } #endif @@ -1644,7 +1644,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; var sizePerPixel = colorChannelsInGlTextureFormat(format) * heap.BYTES_PER_ELEMENT; var bytes = computeUnpackAlignedImageSize(width, height, sizePerPixel); #if GL_ASSERTIONS - assert(pixels % heap.BYTES_PER_ELEMENT == 0, 'Pointer to texture data passed to texture get function must be aligned to the byte size of the pixel type!'); + assert(pixels % heap.BYTES_PER_ELEMENT == 0, 'Pointer to texture data passed to texture get function must be aligned to the byte size of the pixel type'); #endif return heap.subarray(toTypedArrayIndex(pixels, heap), toTypedArrayIndex(pixels + bytes, heap)); }, @@ -1933,7 +1933,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; if (!query) { GL.recordError(0x502 /* GL_INVALID_OPERATION */); #if GL_ASSERTIONS - err('GL_INVALID_OPERATION in glGenQueriesEXT: GLctx.disjointTimerQueryExt.createQueryEXT returned null - most likely GL context is lost!'); + err('GL_INVALID_OPERATION in glGenQueriesEXT: GLctx.disjointTimerQueryExt.createQueryEXT returned null - most likely GL context is lost'); #endif while (i < n) {{{ makeSetValue('ids', 'i++*4', 0, 'i32') }}}; return; @@ -2471,7 +2471,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform1iv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform1iv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform1iv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform1iv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2512,7 +2512,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform2iv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform2iv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform2iv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform2iv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2555,7 +2555,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform3iv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform3iv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform3iv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform3iv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2599,7 +2599,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform4iv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform4iv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform4iv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform4iv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2644,7 +2644,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform1fv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform1fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniform1fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform1fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2685,7 +2685,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform2fv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform2fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniform2fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform2fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2728,7 +2728,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform3fv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform3fv', 'location'); - assert((value % 4) == 0, 'Pointer to float data passed to glUniform3fv must be aligned to four bytes!' + value); + assert((value % 4) == 0, 'pointer passed to glUniform3fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2772,7 +2772,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniform4fv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform4fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniform4fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform4fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2821,7 +2821,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniformMatrix2fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix2fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix2fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix2fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2866,7 +2866,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniformMatrix3fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix3fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix3fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix3fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -2916,7 +2916,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glUniformMatrix4fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix4fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix4fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix4fv must be 4-byte aligned'); #endif #if MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS @@ -3016,8 +3016,8 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glVertexAttrib1fv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to float data passed to glVertexAttrib1fv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttrib1fv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttrib1fv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttrib1fv'); #endif GLctx.vertexAttrib1f(index, HEAPF32[v>>2]); @@ -3025,8 +3025,8 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glVertexAttrib2fv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to float data passed to glVertexAttrib2fv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttrib2fv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttrib2fv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttrib2fv'); #endif GLctx.vertexAttrib2f(index, HEAPF32[v>>2], HEAPF32[v+4>>2]); @@ -3034,8 +3034,8 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glVertexAttrib3fv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to float data passed to glVertexAttrib3fv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttrib3fv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttrib3fv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttrib3fv'); #endif GLctx.vertexAttrib3f(index, HEAPF32[v>>2], HEAPF32[v+4>>2], HEAPF32[v+8>>2]); @@ -3043,8 +3043,8 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; glVertexAttrib4fv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to float data passed to glVertexAttrib4fv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttrib4fv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttrib4fv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttrib4fv'); #endif GLctx.vertexAttrib4f(index, HEAPF32[v>>2], HEAPF32[v+4>>2], HEAPF32[v+8>>2], HEAPF32[v+12>>2]); diff --git a/src/lib/libwebgl2.js b/src/lib/libwebgl2.js index e03277d08c2aa..0be9060a9b23b 100644 --- a/src/lib/libwebgl2.js +++ b/src/lib/libwebgl2.js @@ -632,7 +632,7 @@ var LibraryWebGL2 = { glClearBufferiv: (buffer, drawbuffer, value) => { #if GL_ASSERTIONS - assert((value & 3) == 0, 'Pointer to integer data passed to glClearBufferiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glClearBufferiv must be 4-byte aligned'); #endif GLctx.clearBufferiv(buffer, drawbuffer, HEAP32, {{{ getHeapOffset('value', 'i32') }}}); @@ -640,7 +640,7 @@ var LibraryWebGL2 = { glClearBufferuiv: (buffer, drawbuffer, value) => { #if GL_ASSERTIONS - assert((value & 3) == 0, 'Pointer to integer data passed to glClearBufferuiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glClearBufferuiv must be 4-byte aligned'); #endif GLctx.clearBufferuiv(buffer, drawbuffer, HEAPU32, {{{ getHeapOffset('value', 'u32') }}}); @@ -648,7 +648,7 @@ var LibraryWebGL2 = { glClearBufferfv: (buffer, drawbuffer, value) => { #if GL_ASSERTIONS - assert((value & 3) == 0, 'Pointer to float data passed to glClearBufferfv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glClearBufferfv must be 4-byte aligned'); #endif GLctx.clearBufferfv(buffer, drawbuffer, HEAPF32, {{{ getHeapOffset('value', 'float') }}}); @@ -787,7 +787,7 @@ var LibraryWebGL2 = { glUniform1uiv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform1uiv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform1uiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform1uiv must be 4-byte aligned'); #endif count && GLctx.uniform1uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'u32') }}}, count); }, @@ -796,7 +796,7 @@ var LibraryWebGL2 = { glUniform2uiv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform2uiv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform2uiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform2uiv must be 4-byte aligned'); #endif count && GLctx.uniform2uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'u32') }}}, count*2); }, @@ -805,7 +805,7 @@ var LibraryWebGL2 = { glUniform3uiv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform3uiv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform3uiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform3uiv must be 4-byte aligned'); #endif count && GLctx.uniform3uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'u32') }}}, count*3); }, @@ -814,7 +814,7 @@ var LibraryWebGL2 = { glUniform4uiv: (location, count, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform4uiv', 'location'); - assert((value & 3) == 0, 'Pointer to integer data passed to glUniform4uiv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniform4uiv must be 4-byte aligned'); #endif count && GLctx.uniform4uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'u32') }}}, count*4); }, @@ -823,7 +823,7 @@ var LibraryWebGL2 = { glUniformMatrix2x3fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix2x3fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix2x3fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix2x3fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix2x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*6); }, @@ -832,7 +832,7 @@ var LibraryWebGL2 = { glUniformMatrix3x2fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix3x2fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix3x2fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix3x2fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix3x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*6); }, @@ -841,7 +841,7 @@ var LibraryWebGL2 = { glUniformMatrix2x4fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix2x4fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix2x4fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix2x4fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix2x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*8); }, @@ -850,7 +850,7 @@ var LibraryWebGL2 = { glUniformMatrix4x2fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix4x2fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix4x2fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix4x2fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix4x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*8); }, @@ -859,7 +859,7 @@ var LibraryWebGL2 = { glUniformMatrix3x4fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix3x4fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix3x4fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix3x4fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix3x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*12); }, @@ -868,23 +868,23 @@ var LibraryWebGL2 = { glUniformMatrix4x3fv: (location, count, transpose, value) => { #if GL_ASSERTIONS GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix4x3fv', 'location'); - assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix4x3fv must be aligned to four bytes!'); + assert((value & 3) == 0, 'pointer passed to glUniformMatrix4x3fv must be 4-byte aligned'); #endif count && GLctx.uniformMatrix4x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*12); }, glVertexAttribI4iv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to integer data passed to glVertexAttribI4iv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttribI4iv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttribI4iv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttribI4iv'); #endif GLctx.vertexAttribI4i(index, HEAP32[v>>2], HEAP32[v+4>>2], HEAP32[v+8>>2], HEAP32[v+12>>2]); }, glVertexAttribI4uiv: (index, v) => { #if GL_ASSERTIONS - assert((v & 3) == 0, 'Pointer to integer data passed to glVertexAttribI4uiv must be aligned to four bytes!'); - assert(v != 0, 'Null pointer passed to glVertexAttribI4uiv!'); + assert((v & 3) == 0, 'pointer passed to glVertexAttribI4uiv must be 4-byte aligned'); + assert(v != 0, 'null pointer passed to glVertexAttribI4uiv'); #endif GLctx.vertexAttribI4ui(index, HEAPU32[v>>2], HEAPU32[v+4>>2], HEAPU32[v+8>>2], HEAPU32[v+12>>2]); }, @@ -1039,7 +1039,7 @@ var webgl2PassthroughFuncs = [ // If user passes -sMAX_WEBGL_VERSION >= 2 -sSTRICT but not -lGL (to link in // WebGL 1), then WebGL2 library should not be linked in as well. if (typeof createGLPassthroughFunctions == 'undefined') { - error('In order to use WebGL 2 in strict mode with -sMAX_WEBGL_VERSION=2, you need to link in WebGL support with -lGL!'); + error('In order to use WebGL 2 in strict mode with -sMAX_WEBGL_VERSION=2, you need to link in WebGL support with -lGL'); } createGLPassthroughFunctions(LibraryWebGL2, webgl2PassthroughFuncs); diff --git a/src/parseTools.mjs b/src/parseTools.mjs index 544d7bd808250..28c192bf2290a 100644 --- a/src/parseTools.mjs +++ b/src/parseTools.mjs @@ -674,7 +674,7 @@ function makeDynCall(sig, funcPtr, promising = false) { !sig.includes('j'), 'Cannot specify 64-bit signatures ("j" in signature string) with makeDynCall!', ); - assert(!(DYNCALLS && promising), 'DYNCALLS cannot be used with JSPI.'); + assert(!(DYNCALLS && promising), 'DYNCALLS cannot be used with JSPI'); let args = []; for (let i = 1; i < sig.length; ++i) { diff --git a/src/shell.js b/src/shell.js index 3968682f855ed..df03698b4ffde 100644 --- a/src/shell.js +++ b/src/shell.js @@ -384,24 +384,24 @@ assert( #if ENVIRONMENT_MAY_BE_AUDIO_WORKLET ENVIRONMENT_IS_AUDIO_WORKLET || #endif - ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER || ENVIRONMENT_IS_NODE, 'Pthreads do not work in this environment yet (need Web Workers, or an alternative to them)'); + ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER || ENVIRONMENT_IS_NODE, 'pthreads do not work in this environment yet (need Web Workers, or an alternative to them)'); #else #endif // PTHREADS #if !ENVIRONMENT_MAY_BE_WEB -assert(!ENVIRONMENT_IS_WEB, 'web environment detected but not enabled at build time. Add `web` to `-sENVIRONMENT` to enable.'); +assert(!ENVIRONMENT_IS_WEB, 'web environment detected but not enabled at build time (add `web` to `-sENVIRONMENT` to enable)'); #endif #if !ENVIRONMENT_MAY_BE_WORKER -assert(!ENVIRONMENT_IS_WORKER, 'worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable.'); +assert(!ENVIRONMENT_IS_WORKER, 'worker environment detected but not enabled at build time (add `worker` to `-sENVIRONMENT` to enable)'); #endif #if !ENVIRONMENT_MAY_BE_NODE -assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.'); +assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time (add `node` to `-sENVIRONMENT` to enable)'); #endif #if !ENVIRONMENT_MAY_BE_SHELL -assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.'); +assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time (add `shell` to `-sENVIRONMENT` to enable)'); #endif #endif // ASSERTIONS diff --git a/test/core/embind_lib_with_asyncify.test.js b/test/core/embind_lib_with_asyncify.test.js index 758726d665377..426e402a08934 100644 --- a/test/core/embind_lib_with_asyncify.test.js +++ b/test/core/embind_lib_with_asyncify.test.js @@ -44,7 +44,7 @@ Module['onRuntimeInitialized'] = async () => { } catch (e) { err = e.message; } - assert(err.includes('Assertion failed: Cannot have multiple async operations in flight at once)'), `"${err}" doesn't contain the assertion error`); + assert(err.includes('Assertion failed: cannot have multiple async operations in flight at once)'), `"${err}" doesn't contain the assertion error`); } console.log('ok'); diff --git a/test/core/test_asyncify_assertions.out b/test/core/test_asyncify_assertions.out index fd22d60681b54..895ba767ce4e9 100644 --- a/test/core/test_asyncify_assertions.out +++ b/test/core/test_asyncify_assertions.out @@ -1 +1 @@ -Aborted(Assertion failed: Waking up (starting to rewind) must be done from JS, without compiled code on the stack.) +Aborted(Assertion failed: waking up (starting to rewind) must be done from JS, without compiled code on the stack) diff --git a/test/test_browser.py b/test/test_browser.py index a28805e0bedd8..3972f5c465588 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -5237,7 +5237,7 @@ def test_wasm_worker_condvar_waitinf(self): # Tests that calling any proxied function in a Wasm Worker will abort at runtime when ASSERTIONS are enabled. def test_wasm_worker_proxied_function(self): - error_msg = "abort:Assertion failed: Attempted to call proxied function '_proxied_js_function' in a Wasm Worker, but in Wasm Worker enabled builds, proxied function architecture is not available!" + error_msg = "abort:Assertion failed: attempt to call proxied function '_proxied_js_function' from a Wasm Worker (where proxying is not possible)" # Test that program aborts in ASSERTIONS-enabled builds self.btest('wasm_worker/proxied_function.c', expected=error_msg, cflags=['--js-library', test_file('wasm_worker/proxied_function.js'), '-sWASM_WORKERS', '-sASSERTIONS']) # Test that code does not crash in ASSERTIONS-disabled builds diff --git a/test/test_other.py b/test/test_other.py index 30fddb5cbfac6..fdacf8d23120b 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -12942,7 +12942,7 @@ def test_missing_shell_support(self): # By default shell support is not included self.run_process([EMCC, test_file('hello_world.c')]) err = self.run_js('a.out.js', assert_returncode=NON_ZERO) - self.assertContained('shell environment detected but not enabled at build time.', err) + self.assertContained('shell environment detected but not enabled at build time', err) def test_removed_runtime_function(self): create_file('post.js', 'alignMemory(100, 4);')