diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/c/codegen/CCompilerInvoker.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/c/codegen/CCompilerInvoker.java index a81746028076..9ab5e8c0b9d5 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/c/codegen/CCompilerInvoker.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/c/codegen/CCompilerInvoker.java @@ -122,17 +122,32 @@ protected List getVersionInfoOptions() { } @Override - protected CompilerInfo createCompilerInfo(Path compilerPath, Scanner scanner) { - try { + protected CompilerInfo createCompilerInfo(Path compilerPath, Scanner outerScanner) { + try (Scanner scanner = new Scanner(outerScanner.nextLine())) { + String targetArch = null; /* For cl.exe the first line holds all necessary information */ - scanner.findInLine("Microsoft.?\\(R\\) C/C\\+\\+ Optimizing Compiler Version "); + if (scanner.hasNext("\u7528\u4E8E")) { + /* Simplified-Chinese has targetArch first */ + scanner.next(); + targetArch = scanner.next(); + } + if (scanner.findInLine("Microsoft.*\\(R\\) C/C\\+\\+") == null) { + return null; + } scanner.useDelimiter("[. ]"); + while (!scanner.hasNextInt()) { + scanner.next(); + } int major = scanner.nextInt(); int minor0 = scanner.nextInt(); int minor1 = scanner.nextInt(); - scanner.reset(); /* back to default delimiters */ - scanner.findInLine("for "); - String targetArch = scanner.next(); + if (targetArch == null) { + scanner.reset(); + while (scanner.hasNext()) { + /* targetArch is last token in line */ + targetArch = scanner.next(); + } + } return new CompilerInfo(compilerPath, "microsoft", "C/C++ Optimizing Compiler", "cl", major, minor0, minor1, targetArch); } catch (NoSuchElementException e) { return null;