Merge remote-tracking branch 'origin/master' into omit-frame-pointer

This commit is contained in:
thomas desveaux 2018-04-12 19:24:09 +02:00
commit 906e86d994
14 changed files with 212 additions and 3 deletions

View File

@ -234,3 +234,29 @@ cmd2</StartupCommands>
</Completion>
]]
end
---------------------------------------------------------------------------
-- Setup/Teardown
---------------------------------------------------------------------------
function suite.OnProjectCfg_UnsignedCharOn()
unsignedchar "On"
prepare()
codelite.project.compiler(cfg)
test.capture [[
<Compiler Options="-funsigned-char" C_Options="-funsigned-char" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
</Compiler>
]]
end
function suite.OnProjectCfg_UnsignedCharOff()
unsignedchar "Off"
prepare()
codelite.project.compiler(cfg)
test.capture [[
<Compiler Options="-fno-unsigned-char" C_Options="-fno-unsigned-char" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
</Compiler>
]]
end

View File

@ -116,6 +116,17 @@
tokens = true,
}
p.api.register {
name = "debuggerflavor",
scope = "config",
kind = "string",
allowed = {
"Local",
"Remote",
"WebBrowser",
"WebService"
}
}
--
-- Decide when the full module should be loaded.

View File

@ -1227,6 +1227,35 @@
]]
end
--
-- Check UnsignedChar.
--
function suite.unsignedChar_On()
unsignedchar "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalOptions>/J %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
]]
end
function suite.unsignedChar_Off()
unsignedchar "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
--
-- Check OmitFramePointer
--
@ -1257,7 +1286,6 @@
]]
end
function suite.omitFramePointer_DeprecationFlag()
flags "NoFramePointer"
prepare()

View File

@ -101,3 +101,22 @@ foo=bar</LocalDebuggerEnvironment>
]]
end
--
-- Test Debugger Flavor
--
function suite.debuggerFlavor_OnWindowsLocal()
debuggerflavor "Local"
prepare()
test.capture [[
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
]]
end
function suite.debuggerFlavor_OnWindowsRemote()
debuggerflavor "Remote"
prepare()
test.capture [[
<DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
]]
end

View File

@ -1355,6 +1355,12 @@
table.insert(opts, "/std:c++latest")
end
end
if cfg.toolset and cfg.toolset:startswith("msc") then
local value = iif(cfg.unsignedchar, "On", "Off")
table.insert(opts, p.tools.msc.shared.unsignedchar[value])
end
if #opts > 0 then
opts = table.concat(opts, " ")
m.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)

View File

@ -79,7 +79,17 @@
function m.debuggerFlavor(cfg)
if cfg.debugdir or cfg.debugcommand then
local map = {
Local = "WindowsLocalDebugger",
Remote = "WindowsRemoteDebugger",
WebBrowser = "WebBrowserDebugger",
WebService = "WebServiceDebugger"
}
local value = map[cfg.debuggerflavor]
if value then
p.w('<DebuggerFlavor>%s</DebuggerFlavor>', value)
elseif cfg.debugdir or cfg.debugcommand then
p.w('<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>')
end
end

View File

@ -2486,6 +2486,58 @@
]]
end
function suite.XCBuildConfigurationProject_OnUnsignedCharOn()
workspace("MyWorkspace")
unsignedchar "On"
prepare()
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
test.capture [[
[MyProject:Debug(2)] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = obj/Debug;
ONLY_ACTIVE_ARCH = NO;
SYMROOT = bin/Debug;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationProject_OnUnsignedCharOff()
workspace("MyWorkspace")
unsignedchar "Off"
prepare()
xcode.XCBuildConfiguration_Project(tr, tr.configs[1])
test.capture [[
[MyProject:Debug(2)] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = obj/Debug;
ONLY_ACTIVE_ARCH = NO;
SYMROOT = bin/Debug;
};
name = Debug;
};
]]
end
---------------------------------------------------------------------------
-- XCBuildConfigurationList tests
---------------------------------------------------------------------------

View File

@ -1100,6 +1100,10 @@
settings["GCC_SYMBOLS_PRIVATE_EXTERN"] = 'NO'
if cfg.unsignedchar ~= nil then
settings['GCC_CHAR_IS_UNSIGNED_CHAR'] = iif(cfg.unsignedchar, "YES", "NO")
end
if cfg.flags.FatalWarnings then
settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
end

View File

@ -1336,6 +1336,12 @@
}
}
api.register {
name = "unsignedchar",
scope = "config",
kind = "boolean",
}
api.register {
name = "omitframepointer",
scope = "config",
@ -1347,7 +1353,6 @@
}
}
-----------------------------------------------------------------------------
--
-- Field name aliases for backward compatibility

View File

@ -62,6 +62,7 @@
isaextensions = gcc.shared.isaextensions,
warnings = gcc.shared.warnings,
symbols = gcc.shared.symbols,
unsignedchar = gcc.shared.unsignedchar,
omitframepointer = gcc.shared.omitframepointer
}

View File

@ -96,6 +96,10 @@
symbols = {
On = "-g"
},
unsignedchar = {
On = "-funsigned-char",
Off = "-fno-unsigned-char"
},
omitframepointer = {
On = "-fomit-frame-pointer",
Off = "-fno-omit-frame-pointer"

View File

@ -99,7 +99,11 @@
},
symbols = {
On = "/Z7"
},
unsignedchar = {
On = "/J",
}
}
msc.cflags = {

View File

@ -789,6 +789,26 @@
test.contains({ }, gcc.getcflags(cfg))
end
--
-- Test unsigned-char flags.
--
function suite.sharedflags_onUnsignedChar()
unsignedchar "On"
prepare()
test.contains({ "-funsigned-char" }, gcc.getcxxflags(cfg))
test.contains({ "-funsigned-char" }, gcc.getcflags(cfg))
end
function suite.sharedflags_onNoUnsignedChar()
unsignedchar "Off"
prepare()
test.contains({ "-fno-unsigned-char" }, gcc.getcxxflags(cfg))
test.contains({ "-fno-unsigned-char" }, gcc.getcflags(cfg))
end
--
-- Test omit-frame-pointer flags.
--

View File

@ -160,6 +160,25 @@
end
--
-- Check the translation of unsignedchar.
--
function suite.sharedflags_onUnsignedCharOn()
unsignedchar "On"
prepare()
test.contains({ "/J" }, msc.getcflags(cfg))
test.contains({ "/J" }, msc.getcxxflags(cfg))
end
function suite.sharedflags_onUnsignedCharOff()
unsignedchar "Off"
prepare()
test.excludes({ "/J" }, msc.getcflags(cfg))
test.excludes({ "/J" }, msc.getcxxflags(cfg))
end
--
-- Check handling of debugging support.
--