Fix issue #62: emit stdlib code as char array, not a string
MSVC 2010 issues an error if given a string larger than 64k characters long. To work around this, the pre-processed stdlib.ispc code is now stored as an array of characters terminated with a NUL (i.e. the same thing in the end); MSVC is fine with arrays larger than 64k characters.
This commit is contained in:
@@ -625,7 +625,7 @@ DefineStdlib(SymbolTable *symbolTable, llvm::LLVMContext *ctx, llvm::Module *mod
|
|||||||
// If the user wants the standard library to be included, parse the
|
// If the user wants the standard library to be included, parse the
|
||||||
// serialized version of the stdlib.ispc file to get its definitions
|
// serialized version of the stdlib.ispc file to get its definitions
|
||||||
// added.
|
// added.
|
||||||
extern const char *stdlib_code;
|
extern char stdlib_code[];
|
||||||
yy_scan_string(stdlib_code);
|
yy_scan_string(stdlib_code);
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
print "const char *stdlib_code = "
|
print "char stdlib_code[] = { "
|
||||||
for line in sys.stdin:
|
|
||||||
l=line.rstrip()
|
|
||||||
l=l.replace('"', '\\"')
|
|
||||||
print "\"" + l + "\\n\""
|
|
||||||
|
|
||||||
print ";"
|
for line in sys.stdin:
|
||||||
|
for c in line:
|
||||||
|
print ord(c)
|
||||||
|
print ", "
|
||||||
|
|
||||||
|
print "0 };"
|
||||||
|
|||||||
Reference in New Issue
Block a user