From bdd5bbb6b0adaf29e84c1bc1f9b193e46212f009 Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Sat, 9 Jun 2018 16:31:37 +0100 Subject: [PATCH] ask CL preprocessor for UTF-8 output --- buildspec-windows.yml | 1 - src/ansi-c/c_preprocess.cpp | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/buildspec-windows.yml b/buildspec-windows.yml index 41e83802342..db0fdc5218d 100644 --- a/buildspec-windows.yml +++ b/buildspec-windows.yml @@ -35,7 +35,6 @@ phases: Remove-Item ansi-c\Forward_Declaration2 -Force -Recurse Remove-Item ansi-c\Incomplete_Type1 -Force -Recurse Remove-Item ansi-c\Union_Padding1 -Force -Recurse - Remove-Item ansi-c\Universal_characters1 -Force -Recurse Remove-Item ansi-c\function_return1 -Force -Recurse Remove-Item ansi-c\gcc_attributes7 -Force -Recurse Remove-Item ansi-c\gcc_version1 -Force -Recurse diff --git a/src/ansi-c/c_preprocess.cpp b/src/ansi-c/c_preprocess.cpp index aed837448b9..dd85db6719e 100644 --- a/src/ansi-c/c_preprocess.cpp +++ b/src/ansi-c/c_preprocess.cpp @@ -335,8 +335,14 @@ bool c_preprocess_visual_studio( // understands. command_file << char(0xef) << char(0xbb) << char(0xbf); - command_file << "/nologo" << "\n"; - command_file << "/E" << "\n"; + command_file << "/nologo" << '\n'; + command_file << "/E" << '\n'; + + // This option will make CL produce utf-8 output, as + // opposed to 8-bit with some code page. + // It only works on Visual Studio 2015 or newer. + command_file << "/source-charset:utf-8" << '\n'; + command_file << "/D__CPROVER__" << "\n"; command_file << "/D__WORDSIZE=" << config.ansi_c.pointer_width << "\n";