wasm: prepend underscore for invalid EXPORT_NAMEs
JS identifiers may not start with a digit: em++: error: EXPORT_NAME is not a valid JS identifier: `2dpainting_entry` Change the regex to match leading digits as well (note it is inverted). Prepend an underscore instead of replacing the invalid character; this makes sure we don't create new conflicts between for example "2dpainting" and "3dpainting". Change-Id: If78a87e7ed352b88bc99aee7c5829facf1fc35a0 Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io> (cherry picked from commit a3ab79ec8cab51255b108646f475c5796448d1a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
fd1066ad41
commit
56d0227a73
@ -135,8 +135,12 @@ function(_qt_internal_wasm_export_name_for_target out target)
|
|||||||
if(export_name)
|
if(export_name)
|
||||||
set(${out} "${export_name}" PARENT_SCOPE)
|
set(${out} "${export_name}" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
string(REGEX REPLACE "[^a-zA-Z0-9_]" "_" target "${target}")
|
string(REGEX MATCH "[^a-zA-Z_]" has_invalid_char "${target}")
|
||||||
set(${out} "${target}_entry" PARENT_SCOPE)
|
if(has_invalid_char)
|
||||||
|
set(${out} "_${target}_entry" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${out} "${target}_entry" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user