Merge remote-tracking branch 'origin/master' into struct-member-align

This commit is contained in:
Thomas Desveaux 2018-04-11 14:08:50 +02:00
commit 80e2bb02e6
14 changed files with 213 additions and 2 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

@ -1239,6 +1239,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 StructMemberAlignment
--

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

@ -1370,6 +1370,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",
}
p.api.register {
name = "structmemberalign",
scope = "config",

View File

@ -61,7 +61,8 @@
vectorextensions = gcc.shared.vectorextensions,
isaextensions = gcc.shared.isaextensions,
warnings = gcc.shared.warnings,
symbols = gcc.shared.symbols
symbols = gcc.shared.symbols,
unsignedchar = gcc.shared.unsignedchar
}
clang.cflags = table.merge(gcc.cflags, {

View File

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

View File

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

View File

@ -788,3 +788,23 @@
test.contains({ "-std=gnu++17" }, gcc.getcxxflags(cfg))
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

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.
--