summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen/gl_enums.py
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2015-12-01 13:02:05 -0700
committerBrian Paul <[email protected]>2015-12-01 14:28:45 -0700
commitf391b95105489be58f33991eb49a24d3d509f897 (patch)
tree1d7c0c0f3514e717d1e3e8fad19997928a4d5dd7 /src/mapi/glapi/gen/gl_enums.py
parent148c2f5b175eb0c6355d9f1fc4a60c2f7013535d (diff)
glapi: work-around MSVC 65K string length limitation for enums.c
String literals cannot exceed 65535 characters for MSVC. Instead of emiting a string, emit an array of characters. v2: fix indentation and add comment in the gl_enums.py file about this ugliness. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen/gl_enums.py')
-rw-r--r--src/mapi/glapi/gen/gl_enums.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 6e18f156f38..62cc1b36300 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -156,14 +156,21 @@ _mesa_lookup_prim_by_nr(GLuint nr)
print '# define LONGSTRING'
print '#endif'
print ''
- print 'LONGSTRING static const char enum_string_table[] = '
+ print 'LONGSTRING static const char enum_string_table[] = {'
+ # We express the very long concatenation of enum strings as an array
+ # of characters rather than as a string literal to work-around MSVC's
+ # 65535 character limit.
for enum in sorted_enum_values:
(name, pri) = self.enum_table[enum]
- print ' "%s\\0"' % (name)
+ print " ",
+ for ch in name:
+ print "'%c'," % ch,
+ print "'\\0',"
+
string_offsets[ enum ] = i
i += len(name) + 1
- print ' ;'
+ print '};'
print ''