Skip to content

Commit 951b904

Browse files
authored
[empath-split] End module names with : in manfests (#25659)
This makes better distinction of module names and function lists. Suggested by by @sbc100 (#25577 (comment)). This has to land after WebAssembly/binaryen#8003.
1 parent 9f751bb commit 951b904

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

test/test_other.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15119,14 +15119,14 @@ def test_empath_split(self):
1511915119
void foo() { std::cout << "foo" << std::endl; }
1512015120
''')
1512115121
create_file('path_list.txt', r'''
15122-
myapp
15122+
myapp:
1512315123
main.cpp
1512415124
foo.cpp
1512515125

15126-
lib1
15126+
lib1:
1512715127
/emsdk/emscripten/system
1512815128

15129-
lib2
15129+
lib2:
1513015130
/emsdk/emscripten/system/lib/libc/musl
1513115131
/emsdk/emscripten/system/lib/libcxx
1513215132
''')

tools/empath-split.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
to split modules. The format is similar to the manifest file for wasm-split, but
2626
with paths instead of function names. A module is defined by a name on a line,
2727
followed by paths on subsequent lines. Modules are separated by empty lines.
28+
Module names be written with a colon (:).
2829
For example:
29-
module1
30+
module1:
3031
path/to/a
3132
path/to/b
3233
33-
module2
34+
module2:
3435
path/to/c
3536
3637
This will create two modules, 'module1' and 'module2'. 'module1' will contain
@@ -276,7 +277,11 @@ def parse_paths_file(paths_file_content):
276277
continue
277278

278279
if not cur_module:
279-
cur_module = line
280+
if line[-1] != ':':
281+
exit_with_error(f'Module name should end with a colon: {line}')
282+
if len(line) == 1:
283+
exit_with_error('Module name is empty')
284+
cur_module = line[:-1]
280285
else:
281286
path = normalize_path(line)
282287
if path in path_to_module:
@@ -337,7 +342,7 @@ def main():
337342
print(' ' + func)
338343
print()
339344

340-
f.write(f'{module}\n')
345+
f.write(f'{module}:\n')
341346
for func in funcs:
342347
f.write(func + '\n')
343348
f.close()

0 commit comments

Comments
 (0)