Skip to content

Commit 197e803

Browse files
committed
Deprecate EM_LOG_FUNC_PARAMS flag to emscripten_log/emscripten_get_callstack
Supporting this flag requires using `arguments.callee` which is deprecated, and won't work if any of functions on the callstack are in strict mode (or are arrow function, which implies strict mode). This effects of these flag seem to not actually be tested, even though it is used in `test_emscripten_log`.
1 parent a6b8143 commit 197e803

7 files changed

Lines changed: 4 additions & 35 deletions

File tree

site/source/docs/api_reference/emscripten.h.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,10 +1042,6 @@ Defines
10421042
10431043
If specified, the pathnames of the file information in the call stack will be omitted.
10441044
1045-
.. c:macro:: EM_LOG_FUNC_PARAMS
1046-
1047-
If specified, prints out the actual values of the parameters the functions were invoked with.
1048-
10491045
10501046
Functions
10511047
---------

src/generated_struct_info32.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@
220220
"EM_LOG_CONSOLE": 1,
221221
"EM_LOG_C_STACK": 8,
222222
"EM_LOG_DEBUG": 256,
223-
"EM_LOG_DEMANGLE": 32,
224223
"EM_LOG_ERROR": 4,
225-
"EM_LOG_FUNC_PARAMS": 128,
226224
"EM_LOG_INFO": 512,
227225
"EM_LOG_JS_STACK": 16,
228226
"EM_LOG_NO_PATHS": 64,

src/generated_struct_info64.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@
220220
"EM_LOG_CONSOLE": 1,
221221
"EM_LOG_C_STACK": 8,
222222
"EM_LOG_DEBUG": 256,
223-
"EM_LOG_DEMANGLE": 32,
224223
"EM_LOG_ERROR": 4,
225-
"EM_LOG_FUNC_PARAMS": 128,
226224
"EM_LOG_INFO": 512,
227225
"EM_LOG_JS_STACK": 16,
228226
"EM_LOG_NO_PATHS": 64,

src/library.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,10 +2453,6 @@ mergeInto(LibraryManager.library, {
24532453
var iNextLine = callstack.indexOf('\n', Math.max(iThisFunc, iThisFunc2))+1;
24542454
callstack = callstack.slice(iNextLine);
24552455

2456-
if (flags & {{{ cDefs.EM_LOG_DEMANGLE }}}) {
2457-
warnOnce('EM_LOG_DEMANGLE is deprecated; ignoring');
2458-
}
2459-
24602456
// If user requested to see the original source stack, but no source map
24612457
// information is available, just fall back to showing the JS stack.
24622458
if (flags & {{{ cDefs.EM_LOG_C_STACK }}} && typeof emscripten_source_map == 'undefined') {
@@ -2465,15 +2461,6 @@ mergeInto(LibraryManager.library, {
24652461
flags |= {{{ cDefs.EM_LOG_JS_STACK }}};
24662462
}
24672463

2468-
var stack_args = null;
2469-
if (flags & {{{ cDefs.EM_LOG_FUNC_PARAMS }}}) {
2470-
// To get the actual parameters to the functions, traverse the stack via
2471-
// the unfortunately deprecated 'arguments.callee' method, if it works:
2472-
stack_args = traverseStack(arguments);
2473-
while (stack_args[1].includes('_emscripten_'))
2474-
stack_args = traverseStack(stack_args[0]);
2475-
}
2476-
24772464
// Process all lines:
24782465
var lines = callstack.split('\n');
24792466
callstack = '';
@@ -2537,16 +2524,6 @@ mergeInto(LibraryManager.library, {
25372524
}
25382525
callstack += (haveSourceMap ? (` = ${symbolName}`) : (` at ${symbolName}`)) + ` (${file}:${lineno}:${column})\n`;
25392526
}
2540-
2541-
// If we are still keeping track with the callstack by traversing via
2542-
// 'arguments.callee', print the function parameters as well.
2543-
if (flags & {{{ cDefs.EM_LOG_FUNC_PARAMS }}} && stack_args[0]) {
2544-
if (stack_args[1] == symbolName && stack_args[2].length > 0) {
2545-
callstack = callstack.replace(/\s+$/, '');
2546-
callstack += ' with values: ' + stack_args[1] + stack_args[2] + '\n';
2547-
}
2548-
stack_args = traverseStack(stack_args[0]);
2549-
}
25502527
}
25512528
// Trim extra whitespace at the end of the output.
25522529
callstack = callstack.replace(/\s+$/, '');

src/struct_info.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,9 +978,7 @@
978978
"EM_LOG_ERROR",
979979
"EM_LOG_C_STACK",
980980
"EM_LOG_JS_STACK",
981-
"EM_LOG_DEMANGLE",
982981
"EM_LOG_NO_PATHS",
983-
"EM_LOG_FUNC_PARAMS",
984982
"EM_LOG_DEBUG",
985983
"EM_LOG_INFO",
986984
"EM_TIMING_SETTIMEOUT",

system/include/emscripten/emscripten.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ char *emscripten_get_preloaded_image_data_from_FILE(FILE *file, int *w, int *h);
155155
#define EM_LOG_C_STACK 8
156156
#define EM_LOG_JS_STACK 16
157157
#define EM_LOG_DEMANGLE 32 // deprecated
158+
#pragma clang deprecated(EM_LOG_DEMANGLE)
158159
#define EM_LOG_NO_PATHS 64
159-
#define EM_LOG_FUNC_PARAMS 128
160+
#define EM_LOG_FUNC_PARAMS 128 // deprecated
161+
#pragma clang deprecated(EM_LOG_FUNC_PARAMS)
160162
#define EM_LOG_DEBUG 256
161163
#define EM_LOG_INFO 512
162164

test/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8035,7 +8035,7 @@ def test_emscripten_log(self):
80358035
self.set_setting('DEMANGLE_SUPPORT')
80368036
if '-g' not in self.emcc_args:
80378037
self.emcc_args.append('-g')
8038-
self.emcc_args += ['-DRUN_FROM_JS_SHELL']
8038+
self.emcc_args += ['-DRUN_FROM_JS_SHELL', '-Wno-deprecated-pragma']
80398039
self.do_run_in_out_file_test('emscripten_log/emscripten_log.cpp', interleaved_output=False)
80408040
# test closure compiler as well
80418041
if self.maybe_closure():

0 commit comments

Comments
 (0)