aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-29 10:33:03 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-29 13:22:29 +0200
commit85c2470ce4d3349affdaf085c298d4e6a33dd318 (patch)
treeae9fb5ef23bd4ad3249f7f1f1b41b439aefa41a0
parent7716133d4d89c248c92f0fcd34adad33c69f0b09 (diff)
Signature embedding: Use raw string literals
On macOS, the strings cause warnings like: /shiboken6/libshiboken/embed/signature_inc.h:1518:1: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation] "pIG+LQEAc2lnbmF0dXJlX2Jvb3RzdHJhcC5weVBLBQYAAAAAIQAhAHEKAAC+OAEAAAA=" ^ /Users/berlin/dev/kleint/pyside-setup/build/testenvd/build/shiboken6/libshiboken/embed/signature_inc.h:1517:1: note: place parentheses around the string literal to silence warning "dXJlX2Jvb3RzdHJhcC5weWNQSwECFAMUAAAACABgTX1WeyhE3MwKAADjGwAAFgAAAAAAAAAAAAAA" Use raw string literals to suppress this. Pick-to: 6.5 Change-Id: I72a3abf72ce55970e888c77db0d66e1ef1bdf731 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r--sources/shiboken6/libshiboken/embed/embedding_generator.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/sources/shiboken6/libshiboken/embed/embedding_generator.py b/sources/shiboken6/libshiboken/embed/embedding_generator.py
index 96f66b949..a058fd372 100644
--- a/sources/shiboken6/libshiboken/embed/embedding_generator.py
+++ b/sources/shiboken6/libshiboken/embed/embedding_generator.py
@@ -122,22 +122,23 @@ def _embed_file(fin, fout):
limit = 50
text = fin.readlines()
print(textwrap.dedent("""
- /*
- * This is a ZIP archive of all Python files in the directory
- * "shiboken6/shibokenmodule/files.dir/shibokensupport/signature"
- * There is also a toplevel file "signature_bootstrap.py[c]" that will be
- * directly executed from C++ as a bootstrap loader.
- */
+ // This is a ZIP archive of all Python files in the directory
+ // "shiboken6/shibokenmodule/files.dir/shibokensupport/signature"
+ // There is also a toplevel file "signature_bootstrap.py[c]" that will be
+ // directly executed from C++ as a bootstrap loader.
""").strip(), file=fout)
block, blocks = 0, len(text) // limit + 1
for idx, line in enumerate(text):
if idx % limit == 0:
+ if block:
+ fout.write(')"\n')
comma = "," if block else ""
block += 1
- print(file=fout)
- print(f'/* Block {block} of {blocks} */{comma}', file=fout)
- print(f'\"{line.strip()}\"', file=fout)
- print(f'/* Sentinel */, \"\"', file=fout)
+ fout.write(f'\n{comma} // Block {block} of {blocks}\nR"(')
+ else:
+ fout.write('\n')
+ fout.write(line.strip())
+ fout.write(')"\n\n/* Sentinel */, ""\n')
def _embed_bytefile(fin, fout, is_text):