amd: Work around MSVC limit for string literals
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7791>
This commit is contained in:
@@ -40,6 +40,10 @@ sys.path.append(AMD_REGISTERS)
|
||||
from regdb import Object, RegisterDatabase
|
||||
|
||||
|
||||
def string_to_chars(string):
|
||||
return "'" + "', '".join(string) + "', '\\0',"
|
||||
|
||||
|
||||
class StringTable:
|
||||
"""
|
||||
A class for collecting multiple strings in a single larger string that is
|
||||
@@ -70,13 +74,14 @@ class StringTable:
|
||||
to filp.
|
||||
"""
|
||||
fragments = [
|
||||
'"%s\\0" /* %s */' % (
|
||||
'%s /* %s (%s) */' % (
|
||||
string_to_chars(te[0].encode('unicode_escape').decode()),
|
||||
te[0].encode('unicode_escape').decode(),
|
||||
', '.join(str(idx) for idx in sorted(te[2]))
|
||||
)
|
||||
for te in self.table
|
||||
]
|
||||
filp.write('%sconst char %s[] =\n%s;\n' % (
|
||||
filp.write('%sconst char %s[] = {\n%s\n};\n' % (
|
||||
'static ' if static else '',
|
||||
name,
|
||||
'\n'.join('\t' + fragment for fragment in fragments)
|
||||
|
Reference in New Issue
Block a user