Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed erroneous escape usages in VS2010+ #746

Merged
merged 3 commits into from
Apr 24, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/actions/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@
function m.nmakePreprocessorDefinitions(cfg)
if cfg.kind ~= p.NONE and #cfg.defines > 0 then
local defines = table.concat(cfg.defines, ";")
defines = p.esc(defines) .. ";$(NMakePreprocessorDefinitions)"
defines = defines .. ";$(NMakePreprocessorDefinitions)"
m.element('NMakePreprocessorDefinitions', nil, defines)
end
end
Expand Down Expand Up @@ -1912,7 +1912,7 @@
if escapeQuotes then
defines = defines:gsub('"', '\\"')
end
defines = p.esc(defines) .. ";%%(PreprocessorDefinitions)"
defines = defines .. ";%%(PreprocessorDefinitions)"
m.element('PreprocessorDefinitions', condition, defines)
end
end
Expand All @@ -1924,7 +1924,7 @@
if escapeQuotes then
undefines = undefines:gsub('"', '\\"')
end
undefines = p.esc(undefines) .. ";%%(UndefinePreprocessorDefinitions)"
undefines = undefines .. ";%%(UndefinePreprocessorDefinitions)"
m.element('UndefinePreprocessorDefinitions', condition, undefines)
end
end
Expand Down Expand Up @@ -2142,7 +2142,7 @@
function m.disableSpecificWarnings(cfg, condition)
if #cfg.disablewarnings > 0 then
local warnings = table.concat(cfg.disablewarnings, ";")
warnings = p.esc(warnings) .. ";%%(DisableSpecificWarnings)"
warnings = warnings .. ";%%(DisableSpecificWarnings)"
m.element('DisableSpecificWarnings', condition, warnings)
end
end
Expand All @@ -2151,7 +2151,7 @@
function m.treatSpecificWarningsAsErrors(cfg, condition)
if #cfg.fatalwarnings > 0 then
local fatal = table.concat(cfg.fatalwarnings, ";")
fatal = p.esc(fatal) .. ";%%(TreatSpecificWarningsAsErrors)"
fatal = fatal .. ";%%(TreatSpecificWarningsAsErrors)"
m.element('TreatSpecificWarningsAsErrors', condition, fatal)
end
end
Expand Down
18 changes: 18 additions & 0 deletions tests/actions/vstudio/vc2010/test_compile_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,24 @@
end


--
-- If defines are specified with escapable characters, they should be escaped.
--

function suite.preprocessorDefinitions_onDefines()
premake.escaper(premake.vstudio.vs2010.esc)
defines { "&", "<", ">" }
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>&amp;;&lt;;&gt;;%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
premake.escaper(nil)
end


--
-- If undefines are specified, the <UndefinePreprocessorDefinitions> element should be added.
--
Expand Down
13 changes: 13 additions & 0 deletions tests/actions/vstudio/vc2010/test_nmake_props.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,19 @@ command 2</NMakeBuildCommandLine>
]]
end

function suite.onEscapedDefines()
premake.escaper(premake.vstudio.vs2010.esc)
defines { "&", "<", ">" }
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<NMakeOutput>$(OutDir)MyProject</NMakeOutput>
<NMakePreprocessorDefinitions>&amp;;&lt;;&gt;;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
</PropertyGroup>
]]
premake.escaper(nil)
end

function suite.onIncludeDirs()
includedirs { "include/lua", "include/zlib" }
prepare()
Expand Down